From a31e166fed70c80d81310487dd074a6e1bf8c246 Mon Sep 17 00:00:00 2001 From: Yao Tong Date: Mon, 28 Oct 2024 13:33:05 -0400 Subject: [PATCH] generate code --- .../connectedmachine/_assess_patches.py | 6 +- .../aaz/latest/connectedmachine/_delete.py | 6 +- .../connectedmachine/_install_patches.py | 6 +- .../aaz/latest/connectedmachine/_list.py | 85 +- .../aaz/latest/connectedmachine/_show.py | 84 +- .../aaz/latest/connectedmachine/_update.py | 86 +- .../connectedmachine/_upgrade_extension.py | 6 +- .../connectedmachine/extension/_create.py | 6 +- .../connectedmachine/extension/_delete.py | 6 +- .../connectedmachine/extension/_list.py | 6 +- .../connectedmachine/extension/_show.py | 6 +- .../connectedmachine/extension/_update.py | 8 +- .../connectedmachine/extension/_wait.py | 4 +- .../connectedmachine/extension/image/_list.py | 6 +- .../connectedmachine/extension/image/_show.py | 6 +- .../connectedmachine/license/_create.py | 6 +- .../connectedmachine/license/_delete.py | 6 +- .../latest/connectedmachine/license/_list.py | 6 +- .../latest/connectedmachine/license/_show.py | 6 +- .../connectedmachine/license/_update.py | 8 +- .../latest/connectedmachine/license/_wait.py | 4 +- .../license_profile/__cmd_group.py | 23 + .../license_profile/__init__.py | 16 + .../license_profile/_create.py | 532 ++++++++++++ .../connectedmachine/license_profile/_list.py | 395 +++++++++ .../connectedmachine/license_profile/_show.py | 395 +++++++++ .../license_profile/_update.py | 685 ++++++++++++++++ .../connectedmachine/license_profile/_wait.py | 394 +++++++++ .../private_endpoint_connection/_delete.py | 6 +- .../private_endpoint_connection/_list.py | 6 +- .../private_endpoint_connection/_show.py | 6 +- .../private_endpoint_connection/_update.py | 8 +- .../private_endpoint_connection/_wait.py | 4 +- .../private_link_resource/_list.py | 6 +- .../private_link_resource/_show.py | 6 +- .../private_link_scope/_create.py | 6 +- .../private_link_scope/_delete.py | 6 +- .../private_link_scope/_list.py | 10 +- .../private_link_scope/_show.py | 6 +- .../private_link_scope/_update.py | 8 +- .../private_link_scope/_wait.py | 4 +- .../_list.py | 6 +- .../_reconcile.py | 8 +- .../_show.py | 6 +- .../run_command/__cmd_group.py | 24 + .../connectedmachine/run_command/__init__.py | 17 + .../connectedmachine/run_command/_create.py | 602 ++++++++++++++ .../connectedmachine/run_command/_delete.py | 180 ++++ .../connectedmachine/run_command/_list.py | 367 +++++++++ .../connectedmachine/run_command/_show.py | 363 +++++++++ .../connectedmachine/run_command/_update.py | 766 ++++++++++++++++++ .../connectedmachine/run_command/_wait.py | 358 ++++++++ 52 files changed, 5466 insertions(+), 116 deletions(-) create mode 100644 src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/__cmd_group.py create mode 100644 src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/__init__.py create mode 100644 src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/_create.py create mode 100644 src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/_list.py create mode 100644 src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/_show.py create mode 100644 src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/_update.py create mode 100644 src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/_wait.py create mode 100644 src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/__cmd_group.py create mode 100644 src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/__init__.py create mode 100644 src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_create.py create mode 100644 src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_delete.py create mode 100644 src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_list.py create mode 100644 src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_show.py create mode 100644 src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_update.py create mode 100644 src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_wait.py diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_assess_patches.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_assess_patches.py index 7f478cfb7ab..f4e13626300 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_assess_patches.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_assess_patches.py @@ -22,9 +22,9 @@ class AssessPatches(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/assesspatches", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/assesspatches", "2024-07-31-preview"], ] } @@ -137,7 +137,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_delete.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_delete.py index 7abf0bce92a..600c240f05a 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_delete.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_delete.py @@ -23,9 +23,9 @@ class Delete(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}", "2024-07-31-preview"], ] } @@ -124,7 +124,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_install_patches.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_install_patches.py index 9a367d20508..bdd6ddd101c 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_install_patches.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_install_patches.py @@ -22,9 +22,9 @@ class InstallPatches(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/installpatches", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/installpatches", "2024-07-31-preview"], ] } @@ -222,7 +222,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_list.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_list.py index a06a2077300..752ed1cf5ed 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_list.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_list.py @@ -19,13 +19,12 @@ class List(AAZCommand): :example: Sample command for list az connectedmachine list --resource-group myResourceGroup - az connectedmachine list """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines", "2024-07-31-preview"], ] } @@ -120,7 +119,7 @@ def query_parameters(self): "$expand", self.ctx.args.expand, ), **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } @@ -245,6 +244,14 @@ def _build_schema_on_200(cls): flags={"read_only": True}, ) properties.extensions = AAZListType() + properties.firmware_profile = AAZObjectType( + serialized_name="firmwareProfile", + flags={"read_only": True}, + ) + properties.hardware_profile = AAZObjectType( + serialized_name="hardwareProfile", + flags={"read_only": True}, + ) properties.last_status_change = AAZStrType( serialized_name="lastStatusChange", flags={"read_only": True}, @@ -304,6 +311,10 @@ def _build_schema_on_200(cls): properties.status = AAZStrType( flags={"read_only": True}, ) + properties.storage_profile = AAZObjectType( + serialized_name="storageProfile", + flags={"read_only": True}, + ) properties.vm_id = AAZStrType( serialized_name="vmId", ) @@ -405,6 +416,42 @@ def _build_schema_on_200(cls): extensions.Element = AAZObjectType() _ListHelper._build_schema_machine_extension_instance_view_read(extensions.Element) + firmware_profile = cls._schema_on_200.value.Element.properties.firmware_profile + firmware_profile.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"read_only": True}, + ) + firmware_profile.type = AAZStrType( + flags={"read_only": True}, + ) + + hardware_profile = cls._schema_on_200.value.Element.properties.hardware_profile + hardware_profile.number_of_cpu_sockets = AAZIntType( + serialized_name="numberOfCpuSockets", + flags={"read_only": True}, + ) + hardware_profile.processors = AAZListType( + flags={"read_only": True}, + ) + hardware_profile.total_physical_memory_in_bytes = AAZIntType( + serialized_name="totalPhysicalMemoryInBytes", + flags={"read_only": True}, + ) + + processors = cls._schema_on_200.value.Element.properties.hardware_profile.processors + processors.Element = AAZObjectType( + flags={"read_only": True}, + ) + + _element = cls._schema_on_200.value.Element.properties.hardware_profile.processors.Element + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.number_of_cores = AAZIntType( + serialized_name="numberOfCores", + flags={"read_only": True}, + ) + license_profile = cls._schema_on_200.value.Element.properties.license_profile license_profile.esu_profile = AAZObjectType( serialized_name="esuProfile", @@ -619,9 +666,14 @@ def _build_schema_on_200(cls): ) _element = cls._schema_on_200.value.Element.properties.network_profile.network_interfaces.Element + _element.id = AAZStrType() _element.ip_addresses = AAZListType( serialized_name="ipAddresses", ) + _element.mac_address = AAZStrType( + serialized_name="macAddress", + ) + _element.name = AAZStrType() ip_addresses = cls._schema_on_200.value.Element.properties.network_profile.network_interfaces.Element.ip_addresses ip_addresses.Element = AAZObjectType( @@ -678,6 +730,31 @@ def _build_schema_on_200(cls): ) _ListHelper._build_schema_service_status_read(service_statuses.guest_configuration_service) + storage_profile = cls._schema_on_200.value.Element.properties.storage_profile + storage_profile.disks = AAZListType() + + disks = cls._schema_on_200.value.Element.properties.storage_profile.disks + disks.Element = AAZObjectType( + flags={"read_only": True}, + ) + + _element = cls._schema_on_200.value.Element.properties.storage_profile.disks.Element + _element.disk_type = AAZStrType( + serialized_name="diskType", + ) + _element.generated_id = AAZStrType( + serialized_name="generatedId", + ) + _element.id = AAZStrType() + _element.max_size_in_bytes = AAZIntType( + serialized_name="maxSizeInBytes", + ) + _element.name = AAZStrType() + _element.path = AAZStrType() + _element.used_space_in_bytes = AAZIntType( + serialized_name="usedSpaceInBytes", + ) + resources = cls._schema_on_200.value.Element.resources resources.Element = AAZObjectType() diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_show.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_show.py index 891407f684a..63657ea2511 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_show.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_show.py @@ -22,9 +22,9 @@ class Show(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}", "2024-07-31-preview"], ] } @@ -133,7 +133,7 @@ def query_parameters(self): "$expand", self.ctx.args.expand, ), **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } @@ -247,6 +247,14 @@ def _build_schema_on_200(cls): flags={"read_only": True}, ) properties.extensions = AAZListType() + properties.firmware_profile = AAZObjectType( + serialized_name="firmwareProfile", + flags={"read_only": True}, + ) + properties.hardware_profile = AAZObjectType( + serialized_name="hardwareProfile", + flags={"read_only": True}, + ) properties.last_status_change = AAZStrType( serialized_name="lastStatusChange", flags={"read_only": True}, @@ -306,6 +314,10 @@ def _build_schema_on_200(cls): properties.status = AAZStrType( flags={"read_only": True}, ) + properties.storage_profile = AAZObjectType( + serialized_name="storageProfile", + flags={"read_only": True}, + ) properties.vm_id = AAZStrType( serialized_name="vmId", ) @@ -407,6 +419,42 @@ def _build_schema_on_200(cls): extensions.Element = AAZObjectType() _ShowHelper._build_schema_machine_extension_instance_view_read(extensions.Element) + firmware_profile = cls._schema_on_200.properties.firmware_profile + firmware_profile.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"read_only": True}, + ) + firmware_profile.type = AAZStrType( + flags={"read_only": True}, + ) + + hardware_profile = cls._schema_on_200.properties.hardware_profile + hardware_profile.number_of_cpu_sockets = AAZIntType( + serialized_name="numberOfCpuSockets", + flags={"read_only": True}, + ) + hardware_profile.processors = AAZListType( + flags={"read_only": True}, + ) + hardware_profile.total_physical_memory_in_bytes = AAZIntType( + serialized_name="totalPhysicalMemoryInBytes", + flags={"read_only": True}, + ) + + processors = cls._schema_on_200.properties.hardware_profile.processors + processors.Element = AAZObjectType( + flags={"read_only": True}, + ) + + _element = cls._schema_on_200.properties.hardware_profile.processors.Element + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.number_of_cores = AAZIntType( + serialized_name="numberOfCores", + flags={"read_only": True}, + ) + license_profile = cls._schema_on_200.properties.license_profile license_profile.esu_profile = AAZObjectType( serialized_name="esuProfile", @@ -621,9 +669,14 @@ def _build_schema_on_200(cls): ) _element = cls._schema_on_200.properties.network_profile.network_interfaces.Element + _element.id = AAZStrType() _element.ip_addresses = AAZListType( serialized_name="ipAddresses", ) + _element.mac_address = AAZStrType( + serialized_name="macAddress", + ) + _element.name = AAZStrType() ip_addresses = cls._schema_on_200.properties.network_profile.network_interfaces.Element.ip_addresses ip_addresses.Element = AAZObjectType( @@ -680,6 +733,31 @@ def _build_schema_on_200(cls): ) _ShowHelper._build_schema_service_status_read(service_statuses.guest_configuration_service) + storage_profile = cls._schema_on_200.properties.storage_profile + storage_profile.disks = AAZListType() + + disks = cls._schema_on_200.properties.storage_profile.disks + disks.Element = AAZObjectType( + flags={"read_only": True}, + ) + + _element = cls._schema_on_200.properties.storage_profile.disks.Element + _element.disk_type = AAZStrType( + serialized_name="diskType", + ) + _element.generated_id = AAZStrType( + serialized_name="generatedId", + ) + _element.id = AAZStrType() + _element.max_size_in_bytes = AAZIntType( + serialized_name="maxSizeInBytes", + ) + _element.name = AAZStrType() + _element.path = AAZStrType() + _element.used_space_in_bytes = AAZIntType( + serialized_name="usedSpaceInBytes", + ) + resources = cls._schema_on_200.resources resources.Element = AAZObjectType() diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_update.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_update.py index 0708204e193..2746189003d 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_update.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_update.py @@ -22,9 +22,9 @@ class Update(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}", "2024-07-31-preview"], ] } @@ -558,7 +558,7 @@ def query_parameters(self): "$expand", self.ctx.args.expand, ), **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } @@ -644,7 +644,7 @@ def query_parameters(self): "$expand", self.ctx.args.expand, ), **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } @@ -1065,6 +1065,14 @@ def _build_schema_machine_read(cls, _schema): flags={"read_only": True}, ) properties.extensions = AAZListType() + properties.firmware_profile = AAZObjectType( + serialized_name="firmwareProfile", + flags={"read_only": True}, + ) + properties.hardware_profile = AAZObjectType( + serialized_name="hardwareProfile", + flags={"read_only": True}, + ) properties.last_status_change = AAZStrType( serialized_name="lastStatusChange", flags={"read_only": True}, @@ -1124,6 +1132,10 @@ def _build_schema_machine_read(cls, _schema): properties.status = AAZStrType( flags={"read_only": True}, ) + properties.storage_profile = AAZObjectType( + serialized_name="storageProfile", + flags={"read_only": True}, + ) properties.vm_id = AAZStrType( serialized_name="vmId", ) @@ -1225,6 +1237,42 @@ def _build_schema_machine_read(cls, _schema): extensions.Element = AAZObjectType() cls._build_schema_machine_extension_instance_view_read(extensions.Element) + firmware_profile = _schema_machine_read.properties.firmware_profile + firmware_profile.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"read_only": True}, + ) + firmware_profile.type = AAZStrType( + flags={"read_only": True}, + ) + + hardware_profile = _schema_machine_read.properties.hardware_profile + hardware_profile.number_of_cpu_sockets = AAZIntType( + serialized_name="numberOfCpuSockets", + flags={"read_only": True}, + ) + hardware_profile.processors = AAZListType( + flags={"read_only": True}, + ) + hardware_profile.total_physical_memory_in_bytes = AAZIntType( + serialized_name="totalPhysicalMemoryInBytes", + flags={"read_only": True}, + ) + + processors = _schema_machine_read.properties.hardware_profile.processors + processors.Element = AAZObjectType( + flags={"read_only": True}, + ) + + _element = _schema_machine_read.properties.hardware_profile.processors.Element + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.number_of_cores = AAZIntType( + serialized_name="numberOfCores", + flags={"read_only": True}, + ) + license_profile = _schema_machine_read.properties.license_profile license_profile.esu_profile = AAZObjectType( serialized_name="esuProfile", @@ -1439,9 +1487,14 @@ def _build_schema_machine_read(cls, _schema): ) _element = _schema_machine_read.properties.network_profile.network_interfaces.Element + _element.id = AAZStrType() _element.ip_addresses = AAZListType( serialized_name="ipAddresses", ) + _element.mac_address = AAZStrType( + serialized_name="macAddress", + ) + _element.name = AAZStrType() ip_addresses = _schema_machine_read.properties.network_profile.network_interfaces.Element.ip_addresses ip_addresses.Element = AAZObjectType( @@ -1498,6 +1551,31 @@ def _build_schema_machine_read(cls, _schema): ) cls._build_schema_service_status_read(service_statuses.guest_configuration_service) + storage_profile = _schema_machine_read.properties.storage_profile + storage_profile.disks = AAZListType() + + disks = _schema_machine_read.properties.storage_profile.disks + disks.Element = AAZObjectType( + flags={"read_only": True}, + ) + + _element = _schema_machine_read.properties.storage_profile.disks.Element + _element.disk_type = AAZStrType( + serialized_name="diskType", + ) + _element.generated_id = AAZStrType( + serialized_name="generatedId", + ) + _element.id = AAZStrType() + _element.max_size_in_bytes = AAZIntType( + serialized_name="maxSizeInBytes", + ) + _element.name = AAZStrType() + _element.path = AAZStrType() + _element.used_space_in_bytes = AAZIntType( + serialized_name="usedSpaceInBytes", + ) + resources = _schema_machine_read.resources resources.Element = AAZObjectType() diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_upgrade_extension.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_upgrade_extension.py index 84046501f15..b3f8fec9032 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_upgrade_extension.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_upgrade_extension.py @@ -22,9 +22,9 @@ class UpgradeExtension(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/upgradeextensions", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/upgradeextensions", "2024-07-31-preview"], ] } @@ -156,7 +156,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_create.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_create.py index 19f165a82f4..a0969a3297e 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_create.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_create.py @@ -22,9 +22,9 @@ class Create(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/extensions/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/extensions/{}", "2024-07-31-preview"], ] } @@ -258,7 +258,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_delete.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_delete.py index ef0a7a16268..e6c139c5915 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_delete.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_delete.py @@ -23,9 +23,9 @@ class Delete(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/extensions/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/extensions/{}", "2024-07-31-preview"], ] } @@ -158,7 +158,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_list.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_list.py index 8cfd2b95e92..5ddcd632c6b 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_list.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_list.py @@ -22,9 +22,9 @@ class List(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/extensions", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/extensions", "2024-07-31-preview"], ] } @@ -133,7 +133,7 @@ def query_parameters(self): "$expand", self.ctx.args.expand, ), **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_show.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_show.py index acc4b117e80..19d78983c38 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_show.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_show.py @@ -22,9 +22,9 @@ class Show(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/extensions/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/extensions/{}", "2024-07-31-preview"], ] } @@ -135,7 +135,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_update.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_update.py index 3f74177abc9..52a4b387739 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_update.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_update.py @@ -22,9 +22,9 @@ class Update(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/extensions/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/extensions/{}", "2024-07-31-preview"], ] } @@ -274,7 +274,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } @@ -377,7 +377,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_wait.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_wait.py index 806ebea66ef..4f5396cbc88 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_wait.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_wait.py @@ -20,7 +20,7 @@ class Wait(AAZWaitCommand): _aaz_info = { "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/extensions/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/extensions/{}", "2024-07-31-preview"], ] } @@ -131,7 +131,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/image/_list.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/image/_list.py index b91263eb9c5..a436d63710e 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/image/_list.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/image/_list.py @@ -22,9 +22,9 @@ class List(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.hybridcompute/locations/{}/publishers/{}/extensiontypes/{}/versions", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.hybridcompute/locations/{}/publishers/{}/extensiontypes/{}/versions", "2024-07-31-preview"], ] } @@ -128,7 +128,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/image/_show.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/image/_show.py index f83e63c2d49..7d31d89ac21 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/image/_show.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/image/_show.py @@ -22,9 +22,9 @@ class Show(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.hybridcompute/locations/{}/publishers/{}/extensiontypes/{}/versions/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.hybridcompute/locations/{}/publishers/{}/extensiontypes/{}/versions/{}", "2024-07-31-preview"], ] } @@ -141,7 +141,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_create.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_create.py index e2427a0dc28..ce8d8bd5761 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_create.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_create.py @@ -22,9 +22,9 @@ class Create(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/licenses/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/licenses/{}", "2024-07-31-preview"], ] } @@ -226,7 +226,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_delete.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_delete.py index 3bda6a25729..d1bbd0e00fc 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_delete.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_delete.py @@ -23,9 +23,9 @@ class Delete(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/licenses/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/licenses/{}", "2024-07-31-preview"], ] } @@ -146,7 +146,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_list.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_list.py index f2c5bb7e562..aea35ac8d42 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_list.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_list.py @@ -22,9 +22,9 @@ class List(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.hybridcompute/licenses", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.hybridcompute/licenses", "2024-07-31-preview"], ] } @@ -103,7 +103,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_show.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_show.py index 8cebd378b9b..cff53e62add 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_show.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_show.py @@ -22,9 +22,9 @@ class Show(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/licenses/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/licenses/{}", "2024-07-31-preview"], ] } @@ -123,7 +123,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_update.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_update.py index 3e121e164a2..e87c8e791e3 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_update.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_update.py @@ -22,9 +22,9 @@ class Update(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/licenses/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/licenses/{}", "2024-07-31-preview"], ] } @@ -233,7 +233,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } @@ -332,7 +332,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_wait.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_wait.py index 24c7b824206..69fab31f1d2 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_wait.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license/_wait.py @@ -20,7 +20,7 @@ class Wait(AAZWaitCommand): _aaz_info = { "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/licenses/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/licenses/{}", "2024-07-31-preview"], ] } @@ -119,7 +119,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/__cmd_group.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/__cmd_group.py new file mode 100644 index 00000000000..8c733ab035c --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/__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( + "connectedmachine license-profile", +) +class __CMDGroup(AAZCommandGroup): + """Manages all Pay-As-You-Go licenses for an Azure Arc-Enabled Server. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/__init__.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/__init__.py new file mode 100644 index 00000000000..629118c9446 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/__init__.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._list import * +from ._show import * +from ._update import * +from ._wait import * diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/_create.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/_create.py new file mode 100644 index 00000000000..25208dc50aa --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/_create.py @@ -0,0 +1,532 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "connectedmachine license-profile create", +) +class Create(AAZCommand): + """Create operation to create a license profile. + """ + + _aaz_info = { + "version": "2024-07-31-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/licenseprofiles/{}", "2024-07-31-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.license_profile_name = AAZStrArg( + options=["-n", "--name", "--license-profile-name"], + help="The name of the license profile.", + required=True, + enum={"default": "default"}, + fmt=AAZStrArgFormat( + pattern="[a-zA-Z0-9-_\.]+", + ), + ) + _args_schema.machine_name = AAZStrArg( + options=["--machine-name"], + help="The name of the hybrid machine.", + required=True, + fmt=AAZStrArgFormat( + pattern="[a-zA-Z0-9-_\.]+", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "EsuProfile" + + _args_schema = cls._args_schema + _args_schema.assigned_license = AAZStrArg( + options=["--assigned-license"], + arg_group="EsuProfile", + help="The resource id of the license.", + ) + + # define Arg Group "Parameters" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Parameters", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Parameters", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "ProductProfile" + + _args_schema = cls._args_schema + _args_schema.product_features = AAZListArg( + options=["--product-features"], + arg_group="ProductProfile", + help="The list of product features.", + ) + _args_schema.product_type = AAZStrArg( + options=["--product-type"], + arg_group="ProductProfile", + help="Indicates the product type of the license.", + enum={"WindowsIoTEnterprise": "WindowsIoTEnterprise", "WindowsServer": "WindowsServer"}, + ) + _args_schema.subscription_status = AAZStrArg( + options=["--subscription-status"], + arg_group="ProductProfile", + help="Indicates the subscription status of the product.", + enum={"Disabled": "Disabled", "Disabling": "Disabling", "Enabled": "Enabled", "Enabling": "Enabling", "Failed": "Failed", "Unknown": "Unknown"}, + ) + + product_features = cls._args_schema.product_features + product_features.Element = AAZObjectArg() + + _element = cls._args_schema.product_features.Element + _element.name = AAZStrArg( + options=["name"], + help="Product feature name.", + ) + _element.subscription_status = AAZStrArg( + options=["subscription-status"], + help="Indicates the current status of the product features.", + enum={"Disabled": "Disabled", "Disabling": "Disabling", "Enabled": "Enabled", "Enabling": "Enabling", "Failed": "Failed", "Unknown": "Unknown"}, + ) + + # define Arg Group "SoftwareAssurance" + + _args_schema = cls._args_schema + _args_schema.software_assurance_customer = AAZBoolArg( + options=["--software-assurance-customer"], + arg_group="SoftwareAssurance", + help="Specifies if this machine is licensed as part of a Software Assurance agreement.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.LicenseProfilesCreateOrUpdate(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 LicenseProfilesCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "licenseProfileName", self.ctx.args.license_profile_name, + required=True, + ), + **self.serialize_url_param( + "machineName", self.ctx.args.machine_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", "2024-07-31-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("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("esuProfile", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + properties.set_prop("productProfile", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + properties.set_prop("softwareAssurance", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + esu_profile = _builder.get(".properties.esuProfile") + if esu_profile is not None: + esu_profile.set_prop("assignedLicense", AAZStrType, ".assigned_license") + + product_profile = _builder.get(".properties.productProfile") + if product_profile is not None: + product_profile.set_prop("productFeatures", AAZListType, ".product_features") + product_profile.set_prop("productType", AAZStrType, ".product_type") + product_profile.set_prop("subscriptionStatus", AAZStrType, ".subscription_status") + + product_features = _builder.get(".properties.productProfile.productFeatures") + if product_features is not None: + product_features.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.productProfile.productFeatures[]") + if _elements is not None: + _elements.set_prop("name", AAZStrType, ".name") + _elements.set_prop("subscriptionStatus", AAZStrType, ".subscription_status") + + software_assurance = _builder.get(".properties.softwareAssurance") + if software_assurance is not None: + software_assurance.set_prop("softwareAssuranceCustomer", AAZBoolType, ".software_assurance_customer") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.esu_profile = AAZObjectType( + serialized_name="esuProfile", + flags={"client_flatten": True}, + ) + properties.product_profile = AAZObjectType( + serialized_name="productProfile", + flags={"client_flatten": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.software_assurance = AAZObjectType( + serialized_name="softwareAssurance", + flags={"client_flatten": True}, + ) + + esu_profile = cls._schema_on_200_201.properties.esu_profile + esu_profile.assigned_license = AAZStrType( + serialized_name="assignedLicense", + ) + esu_profile.assigned_license_immutable_id = AAZStrType( + serialized_name="assignedLicenseImmutableId", + flags={"read_only": True}, + ) + esu_profile.esu_eligibility = AAZStrType( + serialized_name="esuEligibility", + flags={"read_only": True}, + ) + esu_profile.esu_key_state = AAZStrType( + serialized_name="esuKeyState", + flags={"read_only": True}, + ) + esu_profile.esu_keys = AAZListType( + serialized_name="esuKeys", + flags={"read_only": True}, + ) + esu_profile.server_type = AAZStrType( + serialized_name="serverType", + flags={"read_only": True}, + ) + + esu_keys = cls._schema_on_200_201.properties.esu_profile.esu_keys + esu_keys.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.esu_profile.esu_keys.Element + _element.license_status = AAZIntType( + serialized_name="licenseStatus", + ) + _element.sku = AAZStrType() + + product_profile = cls._schema_on_200_201.properties.product_profile + product_profile.billing_end_date = AAZStrType( + serialized_name="billingEndDate", + flags={"read_only": True}, + ) + product_profile.billing_start_date = AAZStrType( + serialized_name="billingStartDate", + flags={"read_only": True}, + ) + product_profile.disenrollment_date = AAZStrType( + serialized_name="disenrollmentDate", + flags={"read_only": True}, + ) + product_profile.enrollment_date = AAZStrType( + serialized_name="enrollmentDate", + flags={"read_only": True}, + ) + product_profile.error = AAZObjectType( + flags={"read_only": True}, + ) + _CreateHelper._build_schema_error_detail_read(product_profile.error) + product_profile.product_features = AAZListType( + serialized_name="productFeatures", + ) + product_profile.product_type = AAZStrType( + serialized_name="productType", + ) + product_profile.subscription_status = AAZStrType( + serialized_name="subscriptionStatus", + ) + + product_features = cls._schema_on_200_201.properties.product_profile.product_features + product_features.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.product_profile.product_features.Element + _element.billing_end_date = AAZStrType( + serialized_name="billingEndDate", + flags={"read_only": True}, + ) + _element.billing_start_date = AAZStrType( + serialized_name="billingStartDate", + flags={"read_only": True}, + ) + _element.disenrollment_date = AAZStrType( + serialized_name="disenrollmentDate", + flags={"read_only": True}, + ) + _element.enrollment_date = AAZStrType( + serialized_name="enrollmentDate", + flags={"read_only": True}, + ) + _element.error = AAZObjectType( + flags={"read_only": True}, + ) + _CreateHelper._build_schema_error_detail_read(_element.error) + _element.name = AAZStrType() + _element.subscription_status = AAZStrType( + serialized_name="subscriptionStatus", + ) + + software_assurance = cls._schema_on_200_201.properties.software_assurance + software_assurance.software_assurance_customer = AAZBoolType( + serialized_name="softwareAssuranceCustomer", + ) + + system_data = cls._schema_on_200_201.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_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType( + flags={"read_only": True} + ) + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.info = AAZObjectType( + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType( + flags={"read_only": True}, + ) + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + +__all__ = ["Create"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/_list.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/_list.py new file mode 100644 index 00000000000..c3530aa8065 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/_list.py @@ -0,0 +1,395 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "connectedmachine license-profile list", +) +class List(AAZCommand): + """List operation to get all license profiles of a non-Azure machine + """ + + _aaz_info = { + "version": "2024-07-31-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/licenseprofiles", "2024-07-31-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.machine_name = AAZStrArg( + options=["--machine-name"], + help="The name of the machine.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-_\.]{1,54}$", + max_length=54, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.LicenseProfilesList(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 LicenseProfilesList(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.HybridCompute/machines/{machineName}/licenseProfiles", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "machineName", self.ctx.args.machine_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", "2024-07-31-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={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.esu_profile = AAZObjectType( + serialized_name="esuProfile", + flags={"client_flatten": True}, + ) + properties.product_profile = AAZObjectType( + serialized_name="productProfile", + flags={"client_flatten": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.software_assurance = AAZObjectType( + serialized_name="softwareAssurance", + flags={"client_flatten": True}, + ) + + esu_profile = cls._schema_on_200.value.Element.properties.esu_profile + esu_profile.assigned_license = AAZStrType( + serialized_name="assignedLicense", + ) + esu_profile.assigned_license_immutable_id = AAZStrType( + serialized_name="assignedLicenseImmutableId", + flags={"read_only": True}, + ) + esu_profile.esu_eligibility = AAZStrType( + serialized_name="esuEligibility", + flags={"read_only": True}, + ) + esu_profile.esu_key_state = AAZStrType( + serialized_name="esuKeyState", + flags={"read_only": True}, + ) + esu_profile.esu_keys = AAZListType( + serialized_name="esuKeys", + flags={"read_only": True}, + ) + esu_profile.server_type = AAZStrType( + serialized_name="serverType", + flags={"read_only": True}, + ) + + esu_keys = cls._schema_on_200.value.Element.properties.esu_profile.esu_keys + esu_keys.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.esu_profile.esu_keys.Element + _element.license_status = AAZIntType( + serialized_name="licenseStatus", + ) + _element.sku = AAZStrType() + + product_profile = cls._schema_on_200.value.Element.properties.product_profile + product_profile.billing_end_date = AAZStrType( + serialized_name="billingEndDate", + flags={"read_only": True}, + ) + product_profile.billing_start_date = AAZStrType( + serialized_name="billingStartDate", + flags={"read_only": True}, + ) + product_profile.disenrollment_date = AAZStrType( + serialized_name="disenrollmentDate", + flags={"read_only": True}, + ) + product_profile.enrollment_date = AAZStrType( + serialized_name="enrollmentDate", + flags={"read_only": True}, + ) + product_profile.error = AAZObjectType( + flags={"read_only": True}, + ) + _ListHelper._build_schema_error_detail_read(product_profile.error) + product_profile.product_features = AAZListType( + serialized_name="productFeatures", + ) + product_profile.product_type = AAZStrType( + serialized_name="productType", + ) + product_profile.subscription_status = AAZStrType( + serialized_name="subscriptionStatus", + ) + + product_features = cls._schema_on_200.value.Element.properties.product_profile.product_features + product_features.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.product_profile.product_features.Element + _element.billing_end_date = AAZStrType( + serialized_name="billingEndDate", + flags={"read_only": True}, + ) + _element.billing_start_date = AAZStrType( + serialized_name="billingStartDate", + flags={"read_only": True}, + ) + _element.disenrollment_date = AAZStrType( + serialized_name="disenrollmentDate", + flags={"read_only": True}, + ) + _element.enrollment_date = AAZStrType( + serialized_name="enrollmentDate", + flags={"read_only": True}, + ) + _element.error = AAZObjectType( + flags={"read_only": True}, + ) + _ListHelper._build_schema_error_detail_read(_element.error) + _element.name = AAZStrType() + _element.subscription_status = AAZStrType( + serialized_name="subscriptionStatus", + ) + + software_assurance = cls._schema_on_200.value.Element.properties.software_assurance + software_assurance.software_assurance_customer = AAZBoolType( + serialized_name="softwareAssuranceCustomer", + ) + + 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""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType( + flags={"read_only": True} + ) + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.info = AAZObjectType( + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType( + flags={"read_only": True}, + ) + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + +__all__ = ["List"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/_show.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/_show.py new file mode 100644 index 00000000000..7249c765d8d --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/_show.py @@ -0,0 +1,395 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "connectedmachine license-profile show", +) +class Show(AAZCommand): + """Get information about the view of a license profile. + """ + + _aaz_info = { + "version": "2024-07-31-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/licenseprofiles/{}", "2024-07-31-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.license_profile_name = AAZStrArg( + options=["-n", "--name", "--license-profile-name"], + help="The name of the license profile.", + required=True, + id_part="child_name_1", + enum={"default": "default"}, + fmt=AAZStrArgFormat( + pattern="[a-zA-Z0-9-_\.]+", + ), + ) + _args_schema.machine_name = AAZStrArg( + options=["--machine-name"], + help="The name of the hybrid machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="[a-zA-Z0-9-_\.]+", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.LicenseProfilesGet(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 LicenseProfilesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "licenseProfileName", self.ctx.args.license_profile_name, + required=True, + ), + **self.serialize_url_param( + "machineName", self.ctx.args.machine_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", "2024-07-31-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.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.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.esu_profile = AAZObjectType( + serialized_name="esuProfile", + flags={"client_flatten": True}, + ) + properties.product_profile = AAZObjectType( + serialized_name="productProfile", + flags={"client_flatten": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.software_assurance = AAZObjectType( + serialized_name="softwareAssurance", + flags={"client_flatten": True}, + ) + + esu_profile = cls._schema_on_200.properties.esu_profile + esu_profile.assigned_license = AAZStrType( + serialized_name="assignedLicense", + ) + esu_profile.assigned_license_immutable_id = AAZStrType( + serialized_name="assignedLicenseImmutableId", + flags={"read_only": True}, + ) + esu_profile.esu_eligibility = AAZStrType( + serialized_name="esuEligibility", + flags={"read_only": True}, + ) + esu_profile.esu_key_state = AAZStrType( + serialized_name="esuKeyState", + flags={"read_only": True}, + ) + esu_profile.esu_keys = AAZListType( + serialized_name="esuKeys", + flags={"read_only": True}, + ) + esu_profile.server_type = AAZStrType( + serialized_name="serverType", + flags={"read_only": True}, + ) + + esu_keys = cls._schema_on_200.properties.esu_profile.esu_keys + esu_keys.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.esu_profile.esu_keys.Element + _element.license_status = AAZIntType( + serialized_name="licenseStatus", + ) + _element.sku = AAZStrType() + + product_profile = cls._schema_on_200.properties.product_profile + product_profile.billing_end_date = AAZStrType( + serialized_name="billingEndDate", + flags={"read_only": True}, + ) + product_profile.billing_start_date = AAZStrType( + serialized_name="billingStartDate", + flags={"read_only": True}, + ) + product_profile.disenrollment_date = AAZStrType( + serialized_name="disenrollmentDate", + flags={"read_only": True}, + ) + product_profile.enrollment_date = AAZStrType( + serialized_name="enrollmentDate", + flags={"read_only": True}, + ) + product_profile.error = AAZObjectType( + flags={"read_only": True}, + ) + _ShowHelper._build_schema_error_detail_read(product_profile.error) + product_profile.product_features = AAZListType( + serialized_name="productFeatures", + ) + product_profile.product_type = AAZStrType( + serialized_name="productType", + ) + product_profile.subscription_status = AAZStrType( + serialized_name="subscriptionStatus", + ) + + product_features = cls._schema_on_200.properties.product_profile.product_features + product_features.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.product_profile.product_features.Element + _element.billing_end_date = AAZStrType( + serialized_name="billingEndDate", + flags={"read_only": True}, + ) + _element.billing_start_date = AAZStrType( + serialized_name="billingStartDate", + flags={"read_only": True}, + ) + _element.disenrollment_date = AAZStrType( + serialized_name="disenrollmentDate", + flags={"read_only": True}, + ) + _element.enrollment_date = AAZStrType( + serialized_name="enrollmentDate", + flags={"read_only": True}, + ) + _element.error = AAZObjectType( + flags={"read_only": True}, + ) + _ShowHelper._build_schema_error_detail_read(_element.error) + _element.name = AAZStrType() + _element.subscription_status = AAZStrType( + serialized_name="subscriptionStatus", + ) + + software_assurance = cls._schema_on_200.properties.software_assurance + software_assurance.software_assurance_customer = AAZBoolType( + serialized_name="softwareAssuranceCustomer", + ) + + 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""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType( + flags={"read_only": True} + ) + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.info = AAZObjectType( + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType( + flags={"read_only": True}, + ) + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + +__all__ = ["Show"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/_update.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/_update.py new file mode 100644 index 00000000000..a32eaf61270 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/_update.py @@ -0,0 +1,685 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "connectedmachine license-profile update", +) +class Update(AAZCommand): + """Update operation to update a license profile. + """ + + _aaz_info = { + "version": "2024-07-31-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/licenseprofiles/{}", "2024-07-31-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.license_profile_name = AAZStrArg( + options=["-n", "--name", "--license-profile-name"], + help="The name of the license profile.", + required=True, + id_part="child_name_1", + enum={"default": "default"}, + fmt=AAZStrArgFormat( + pattern="[a-zA-Z0-9-_\.]+", + ), + ) + _args_schema.machine_name = AAZStrArg( + options=["--machine-name"], + help="The name of the hybrid machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="[a-zA-Z0-9-_\.]+", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "EsuProfile" + + _args_schema = cls._args_schema + _args_schema.assigned_license = AAZStrArg( + options=["--assigned-license"], + arg_group="EsuProfile", + help="The resource id of the license.", + nullable=True, + ) + + # define Arg Group "Parameters" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Parameters", + help="Resource tags.", + nullable=True, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg( + nullable=True, + ) + + # define Arg Group "ProductProfile" + + _args_schema = cls._args_schema + _args_schema.product_features = AAZListArg( + options=["--product-features"], + arg_group="ProductProfile", + help="The list of product features.", + nullable=True, + ) + _args_schema.product_type = AAZStrArg( + options=["--product-type"], + arg_group="ProductProfile", + help="Indicates the product type of the license.", + nullable=True, + enum={"WindowsIoTEnterprise": "WindowsIoTEnterprise", "WindowsServer": "WindowsServer"}, + ) + _args_schema.subscription_status = AAZStrArg( + options=["--subscription-status"], + arg_group="ProductProfile", + help="Indicates the subscription status of the product.", + nullable=True, + enum={"Disabled": "Disabled", "Disabling": "Disabling", "Enabled": "Enabled", "Enabling": "Enabling", "Failed": "Failed", "Unknown": "Unknown"}, + ) + + product_features = cls._args_schema.product_features + product_features.Element = AAZObjectArg( + nullable=True, + ) + + _element = cls._args_schema.product_features.Element + _element.name = AAZStrArg( + options=["name"], + help="Product feature name.", + nullable=True, + ) + _element.subscription_status = AAZStrArg( + options=["subscription-status"], + help="Indicates the current status of the product features.", + nullable=True, + enum={"Disabled": "Disabled", "Disabling": "Disabling", "Enabled": "Enabled", "Enabling": "Enabling", "Failed": "Failed", "Unknown": "Unknown"}, + ) + + # define Arg Group "SoftwareAssurance" + + _args_schema = cls._args_schema + _args_schema.software_assurance_customer = AAZBoolArg( + options=["--software-assurance-customer"], + arg_group="SoftwareAssurance", + help="Specifies if this machine is licensed as part of a Software Assurance agreement.", + nullable=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.LicenseProfilesGet(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.LicenseProfilesCreateOrUpdate(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 LicenseProfilesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "licenseProfileName", self.ctx.args.license_profile_name, + required=True, + ), + **self.serialize_url_param( + "machineName", self.ctx.args.machine_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", "2024-07-31-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_license_profile_read(cls._schema_on_200) + + return cls._schema_on_200 + + class LicenseProfilesCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "licenseProfileName", self.ctx.args.license_profile_name, + required=True, + ), + **self.serialize_url_param( + "machineName", self.ctx.args.machine_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", "2024-07-31-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_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + _UpdateHelper._build_schema_license_profile_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("esuProfile", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + properties.set_prop("productProfile", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + properties.set_prop("softwareAssurance", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + esu_profile = _builder.get(".properties.esuProfile") + if esu_profile is not None: + esu_profile.set_prop("assignedLicense", AAZStrType, ".assigned_license") + + product_profile = _builder.get(".properties.productProfile") + if product_profile is not None: + product_profile.set_prop("productFeatures", AAZListType, ".product_features") + product_profile.set_prop("productType", AAZStrType, ".product_type") + product_profile.set_prop("subscriptionStatus", AAZStrType, ".subscription_status") + + product_features = _builder.get(".properties.productProfile.productFeatures") + if product_features is not None: + product_features.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.productProfile.productFeatures[]") + if _elements is not None: + _elements.set_prop("name", AAZStrType, ".name") + _elements.set_prop("subscriptionStatus", AAZStrType, ".subscription_status") + + software_assurance = _builder.get(".properties.softwareAssurance") + if software_assurance is not None: + software_assurance.set_prop("softwareAssuranceCustomer", AAZBoolType, ".software_assurance_customer") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return _instance_value + + class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance_by_generic( + self.ctx.vars.instance, + self.ctx.generic_update_args + ) + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType( + flags={"read_only": True} + ) + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.info = AAZObjectType( + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType( + flags={"read_only": True}, + ) + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_license_profile_read = None + + @classmethod + def _build_schema_license_profile_read(cls, _schema): + if cls._schema_license_profile_read is not None: + _schema.id = cls._schema_license_profile_read.id + _schema.location = cls._schema_license_profile_read.location + _schema.name = cls._schema_license_profile_read.name + _schema.properties = cls._schema_license_profile_read.properties + _schema.system_data = cls._schema_license_profile_read.system_data + _schema.tags = cls._schema_license_profile_read.tags + _schema.type = cls._schema_license_profile_read.type + return + + cls._schema_license_profile_read = _schema_license_profile_read = AAZObjectType() + + license_profile_read = _schema_license_profile_read + license_profile_read.id = AAZStrType( + flags={"read_only": True}, + ) + license_profile_read.location = AAZStrType( + flags={"required": True}, + ) + license_profile_read.name = AAZStrType( + flags={"read_only": True}, + ) + license_profile_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + license_profile_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + license_profile_read.tags = AAZDictType() + license_profile_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_license_profile_read.properties + properties.esu_profile = AAZObjectType( + serialized_name="esuProfile", + flags={"client_flatten": True}, + ) + properties.product_profile = AAZObjectType( + serialized_name="productProfile", + flags={"client_flatten": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.software_assurance = AAZObjectType( + serialized_name="softwareAssurance", + flags={"client_flatten": True}, + ) + + esu_profile = _schema_license_profile_read.properties.esu_profile + esu_profile.assigned_license = AAZStrType( + serialized_name="assignedLicense", + ) + esu_profile.assigned_license_immutable_id = AAZStrType( + serialized_name="assignedLicenseImmutableId", + flags={"read_only": True}, + ) + esu_profile.esu_eligibility = AAZStrType( + serialized_name="esuEligibility", + flags={"read_only": True}, + ) + esu_profile.esu_key_state = AAZStrType( + serialized_name="esuKeyState", + flags={"read_only": True}, + ) + esu_profile.esu_keys = AAZListType( + serialized_name="esuKeys", + flags={"read_only": True}, + ) + esu_profile.server_type = AAZStrType( + serialized_name="serverType", + flags={"read_only": True}, + ) + + esu_keys = _schema_license_profile_read.properties.esu_profile.esu_keys + esu_keys.Element = AAZObjectType() + + _element = _schema_license_profile_read.properties.esu_profile.esu_keys.Element + _element.license_status = AAZIntType( + serialized_name="licenseStatus", + ) + _element.sku = AAZStrType() + + product_profile = _schema_license_profile_read.properties.product_profile + product_profile.billing_end_date = AAZStrType( + serialized_name="billingEndDate", + flags={"read_only": True}, + ) + product_profile.billing_start_date = AAZStrType( + serialized_name="billingStartDate", + flags={"read_only": True}, + ) + product_profile.disenrollment_date = AAZStrType( + serialized_name="disenrollmentDate", + flags={"read_only": True}, + ) + product_profile.enrollment_date = AAZStrType( + serialized_name="enrollmentDate", + flags={"read_only": True}, + ) + product_profile.error = AAZObjectType( + flags={"read_only": True}, + ) + cls._build_schema_error_detail_read(product_profile.error) + product_profile.product_features = AAZListType( + serialized_name="productFeatures", + ) + product_profile.product_type = AAZStrType( + serialized_name="productType", + ) + product_profile.subscription_status = AAZStrType( + serialized_name="subscriptionStatus", + ) + + product_features = _schema_license_profile_read.properties.product_profile.product_features + product_features.Element = AAZObjectType() + + _element = _schema_license_profile_read.properties.product_profile.product_features.Element + _element.billing_end_date = AAZStrType( + serialized_name="billingEndDate", + flags={"read_only": True}, + ) + _element.billing_start_date = AAZStrType( + serialized_name="billingStartDate", + flags={"read_only": True}, + ) + _element.disenrollment_date = AAZStrType( + serialized_name="disenrollmentDate", + flags={"read_only": True}, + ) + _element.enrollment_date = AAZStrType( + serialized_name="enrollmentDate", + flags={"read_only": True}, + ) + _element.error = AAZObjectType( + flags={"read_only": True}, + ) + cls._build_schema_error_detail_read(_element.error) + _element.name = AAZStrType() + _element.subscription_status = AAZStrType( + serialized_name="subscriptionStatus", + ) + + software_assurance = _schema_license_profile_read.properties.software_assurance + software_assurance.software_assurance_customer = AAZBoolType( + serialized_name="softwareAssuranceCustomer", + ) + + system_data = _schema_license_profile_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", + ) + + tags = _schema_license_profile_read.tags + tags.Element = AAZStrType() + + _schema.id = cls._schema_license_profile_read.id + _schema.location = cls._schema_license_profile_read.location + _schema.name = cls._schema_license_profile_read.name + _schema.properties = cls._schema_license_profile_read.properties + _schema.system_data = cls._schema_license_profile_read.system_data + _schema.tags = cls._schema_license_profile_read.tags + _schema.type = cls._schema_license_profile_read.type + + +__all__ = ["Update"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/_wait.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/_wait.py new file mode 100644 index 00000000000..9ebc0325700 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/license_profile/_wait.py @@ -0,0 +1,394 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "connectedmachine license-profile 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.hybridcompute/machines/{}/licenseprofiles/{}", "2024-07-31-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.license_profile_name = AAZStrArg( + options=["-n", "--name", "--license-profile-name"], + help="The name of the license profile.", + required=True, + id_part="child_name_1", + enum={"default": "default"}, + fmt=AAZStrArgFormat( + pattern="[a-zA-Z0-9-_\.]+", + ), + ) + _args_schema.machine_name = AAZStrArg( + options=["--machine-name"], + help="The name of the hybrid machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="[a-zA-Z0-9-_\.]+", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.LicenseProfilesGet(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 LicenseProfilesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "licenseProfileName", self.ctx.args.license_profile_name, + required=True, + ), + **self.serialize_url_param( + "machineName", self.ctx.args.machine_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", "2024-07-31-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.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.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.esu_profile = AAZObjectType( + serialized_name="esuProfile", + flags={"client_flatten": True}, + ) + properties.product_profile = AAZObjectType( + serialized_name="productProfile", + flags={"client_flatten": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.software_assurance = AAZObjectType( + serialized_name="softwareAssurance", + flags={"client_flatten": True}, + ) + + esu_profile = cls._schema_on_200.properties.esu_profile + esu_profile.assigned_license = AAZStrType( + serialized_name="assignedLicense", + ) + esu_profile.assigned_license_immutable_id = AAZStrType( + serialized_name="assignedLicenseImmutableId", + flags={"read_only": True}, + ) + esu_profile.esu_eligibility = AAZStrType( + serialized_name="esuEligibility", + flags={"read_only": True}, + ) + esu_profile.esu_key_state = AAZStrType( + serialized_name="esuKeyState", + flags={"read_only": True}, + ) + esu_profile.esu_keys = AAZListType( + serialized_name="esuKeys", + flags={"read_only": True}, + ) + esu_profile.server_type = AAZStrType( + serialized_name="serverType", + flags={"read_only": True}, + ) + + esu_keys = cls._schema_on_200.properties.esu_profile.esu_keys + esu_keys.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.esu_profile.esu_keys.Element + _element.license_status = AAZIntType( + serialized_name="licenseStatus", + ) + _element.sku = AAZStrType() + + product_profile = cls._schema_on_200.properties.product_profile + product_profile.billing_end_date = AAZStrType( + serialized_name="billingEndDate", + flags={"read_only": True}, + ) + product_profile.billing_start_date = AAZStrType( + serialized_name="billingStartDate", + flags={"read_only": True}, + ) + product_profile.disenrollment_date = AAZStrType( + serialized_name="disenrollmentDate", + flags={"read_only": True}, + ) + product_profile.enrollment_date = AAZStrType( + serialized_name="enrollmentDate", + flags={"read_only": True}, + ) + product_profile.error = AAZObjectType( + flags={"read_only": True}, + ) + _WaitHelper._build_schema_error_detail_read(product_profile.error) + product_profile.product_features = AAZListType( + serialized_name="productFeatures", + ) + product_profile.product_type = AAZStrType( + serialized_name="productType", + ) + product_profile.subscription_status = AAZStrType( + serialized_name="subscriptionStatus", + ) + + product_features = cls._schema_on_200.properties.product_profile.product_features + product_features.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.product_profile.product_features.Element + _element.billing_end_date = AAZStrType( + serialized_name="billingEndDate", + flags={"read_only": True}, + ) + _element.billing_start_date = AAZStrType( + serialized_name="billingStartDate", + flags={"read_only": True}, + ) + _element.disenrollment_date = AAZStrType( + serialized_name="disenrollmentDate", + flags={"read_only": True}, + ) + _element.enrollment_date = AAZStrType( + serialized_name="enrollmentDate", + flags={"read_only": True}, + ) + _element.error = AAZObjectType( + flags={"read_only": True}, + ) + _WaitHelper._build_schema_error_detail_read(_element.error) + _element.name = AAZStrType() + _element.subscription_status = AAZStrType( + serialized_name="subscriptionStatus", + ) + + software_assurance = cls._schema_on_200.properties.software_assurance + software_assurance.software_assurance_customer = AAZBoolType( + serialized_name="softwareAssuranceCustomer", + ) + + 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""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType( + flags={"read_only": True} + ) + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.info = AAZObjectType( + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType( + flags={"read_only": True}, + ) + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + +__all__ = ["Wait"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_delete.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_delete.py index efada7f5750..e3669d95bce 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_delete.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_delete.py @@ -23,9 +23,9 @@ class Delete(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/privateendpointconnections/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/privateendpointconnections/{}", "2024-07-31-preview"], ] } @@ -156,7 +156,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_list.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_list.py index d789cf6c04b..96f109a29e4 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_list.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_list.py @@ -22,9 +22,9 @@ class List(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/privateendpointconnections", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/privateendpointconnections", "2024-07-31-preview"], ] } @@ -124,7 +124,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_show.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_show.py index 7dbbf539f0f..268d155b5c0 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_show.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_show.py @@ -22,9 +22,9 @@ class Show(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/privateendpointconnections/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/privateendpointconnections/{}", "2024-07-31-preview"], ] } @@ -133,7 +133,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_update.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_update.py index c36a91095b2..e4ddb904519 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_update.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_update.py @@ -22,9 +22,9 @@ class Update(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/privateendpointconnections/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/privateendpointconnections/{}", "2024-07-31-preview"], ] } @@ -180,7 +180,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } @@ -283,7 +283,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_wait.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_wait.py index e5010f91531..052e49efadd 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_wait.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_wait.py @@ -20,7 +20,7 @@ class Wait(AAZWaitCommand): _aaz_info = { "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/privateendpointconnections/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/privateendpointconnections/{}", "2024-07-31-preview"], ] } @@ -129,7 +129,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_resource/_list.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_resource/_list.py index 413ded576aa..af40e44dfd9 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_resource/_list.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_resource/_list.py @@ -22,9 +22,9 @@ class List(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/privatelinkresources", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/privatelinkresources", "2024-07-31-preview"], ] } @@ -124,7 +124,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_resource/_show.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_resource/_show.py index 8192a80417b..cf6ec9fa569 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_resource/_show.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_resource/_show.py @@ -22,9 +22,9 @@ class Show(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/privatelinkresources/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/privatelinkresources/{}", "2024-07-31-preview"], ] } @@ -133,7 +133,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_create.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_create.py index a0528ad944a..0f757fd1ed8 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_create.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_create.py @@ -22,9 +22,9 @@ class Create(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}", "2024-07-31-preview"], ] } @@ -153,7 +153,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_delete.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_delete.py index 06470fb8336..6c4abdcf6b2 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_delete.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_delete.py @@ -23,9 +23,9 @@ class Delete(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}", "2024-07-31-preview"], ] } @@ -146,7 +146,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_list.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_list.py index dc537132de5..c7a7f39d44f 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_list.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_list.py @@ -23,10 +23,10 @@ class List(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.hybridcompute/privatelinkscopes", "2024-07-10"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.hybridcompute/privatelinkscopes", "2024-07-31-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes", "2024-07-31-preview"], ] } @@ -117,7 +117,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } @@ -311,7 +311,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_show.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_show.py index 128001266bb..0e81713f649 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_show.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_show.py @@ -22,9 +22,9 @@ class Show(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}", "2024-07-31-preview"], ] } @@ -123,7 +123,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_update.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_update.py index 90b4bd34eb3..7c98874d6c7 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_update.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_update.py @@ -22,9 +22,9 @@ class Update(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}", "2024-07-31-preview"], ] } @@ -164,7 +164,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } @@ -247,7 +247,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_wait.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_wait.py index cb84c65b6ab..3d08ebe43ba 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_wait.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_wait.py @@ -20,7 +20,7 @@ class Wait(AAZWaitCommand): _aaz_info = { "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}", "2024-07-31-preview"], ] } @@ -119,7 +119,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/network_security_perimeter_configuration/_list.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/network_security_perimeter_configuration/_list.py index 8c59becbe31..a025eb42d19 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/network_security_perimeter_configuration/_list.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/network_security_perimeter_configuration/_list.py @@ -22,9 +22,9 @@ class List(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/networksecurityperimeterconfigurations", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/networksecurityperimeterconfigurations", "2024-07-31-preview"], ] } @@ -124,7 +124,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/network_security_perimeter_configuration/_reconcile.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/network_security_perimeter_configuration/_reconcile.py index 11b1f067c76..0e260cf1a38 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/network_security_perimeter_configuration/_reconcile.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/network_security_perimeter_configuration/_reconcile.py @@ -15,16 +15,16 @@ "connectedmachine private-link-scope network-security-perimeter-configuration reconcile", ) class Reconcile(AAZCommand): - """Forces the network security perimeter configuration to refresh for a private link scope. + """Force the network security perimeter configuration to refresh for a private link scope. :example: Sample command for NSP reconcile az connectedmachine private-link-scope network-security-perimeter-configuration reconcile --resource-group myResourceGroup --scope-name myPrivateLinkScope --perimeter-name aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee.myAssociation """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/networksecurityperimeterconfigurations/{}/reconcile", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/networksecurityperimeterconfigurations/{}/reconcile", "2024-07-31-preview"], ] } @@ -153,7 +153,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/network_security_perimeter_configuration/_show.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/network_security_perimeter_configuration/_show.py index 20c2da0d3f6..37c2f603930 100644 --- a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/network_security_perimeter_configuration/_show.py +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/network_security_perimeter_configuration/_show.py @@ -22,9 +22,9 @@ class Show(AAZCommand): """ _aaz_info = { - "version": "2024-07-10", + "version": "2024-07-31-preview", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/networksecurityperimeterconfigurations/{}", "2024-07-10"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/networksecurityperimeterconfigurations/{}", "2024-07-31-preview"], ] } @@ -136,7 +136,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2024-07-10", + "api-version", "2024-07-31-preview", required=True, ), } diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/__cmd_group.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/__cmd_group.py new file mode 100644 index 00000000000..01cd5c3a7b1 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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( + "connectedmachine run-command", + is_preview=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage run commands on an Azure Arc-Enabled Server. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/__init__.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/__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/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_create.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_create.py new file mode 100644 index 00000000000..540d7313558 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_create.py @@ -0,0 +1,602 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "connectedmachine run-command create", + is_preview=True, +) +class Create(AAZCommand): + """Create a run command. + + :example: Sample command for run-command create + az connectedmachine run-command create --resource-group myResourceGroup --location "WestUS" --async false --parameters "[{"name":"param1","value":"value1"}]" --password "" --user "user1" --script "Write-Host Hello World!" --timeout 3600 --name myRunCommand --machine-name myMachine --subscription mySubscription + az connectedmachine run-command create --resource-group myResourceGroup --location "WestUS" --script "Write-Host Hello World!" --name myRunCommand --machine-name myMachine --output-uri "outputuri" --subscription mySubscription + """ + + _aaz_info = { + "version": "2024-07-31-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/runcommands/{}", "2024-07-31-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.machine_name = AAZStrArg( + options=["--machine-name"], + help="The name of the hybrid machine.", + required=True, + fmt=AAZStrArgFormat( + pattern="[a-zA-Z0-9-_\.]+", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.run_command_name = AAZStrArg( + options=["-n", "--name", "--run-command-name"], + help="The name of the run command.", + required=True, + fmt=AAZStrArgFormat( + pattern="[a-zA-Z0-9-_\.]+", + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.async_execution = AAZBoolArg( + options=["--async-execution"], + arg_group="Properties", + help="Optional. If set to true, provisioning will complete as soon as script starts and will not wait for script to complete.", + default=False, + ) + _args_schema.error_blob_managed_identity = AAZObjectArg( + options=["--error-blob-id", "--error-blob-managed-identity"], + arg_group="Properties", + help="User-assigned managed identity that has access to errorBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given access to blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged", + ) + cls._build_args_run_command_managed_identity_create(_args_schema.error_blob_managed_identity) + _args_schema.error_blob_uri = AAZStrArg( + options=["--error-blob-uri"], + arg_group="Properties", + help="Specifies the Azure storage blob where script error stream will be uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to provide the VM access to the blob. Refer errorBlobManagedIdentity parameter.", + ) + _args_schema.output_blob_managed_identity = AAZObjectArg( + options=["--output-blob-id", "--output-blob-managed-identity"], + arg_group="Properties", + help="User-assigned managed identity that has access to outputBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given access to blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged", + ) + cls._build_args_run_command_managed_identity_create(_args_schema.output_blob_managed_identity) + _args_schema.output_blob_uri = AAZStrArg( + options=["--output-blob-uri"], + arg_group="Properties", + help="Specifies the Azure storage blob where script output stream will be uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to provide the VM access to the blob. Refer outputBlobManagedIdentity parameter. ", + ) + _args_schema.parameters = AAZListArg( + options=["--parameters"], + arg_group="Properties", + help="The parameters used by the script.", + ) + _args_schema.protected_parameters = AAZListArg( + options=["--protected-parameters"], + arg_group="Properties", + help="The parameters used by the script.", + ) + _args_schema.run_as_password = AAZStrArg( + options=["--run-as-password"], + arg_group="Properties", + help="Specifies the user account password on the machine when executing the run command.", + ) + _args_schema.run_as_user = AAZStrArg( + options=["--run-as-user"], + arg_group="Properties", + help="Specifies the user account on the machine when executing the run command.", + ) + _args_schema.timeout_in_seconds = AAZIntArg( + options=["--timeout-in-seconds"], + arg_group="Properties", + help="The timeout in seconds to execute the run command.", + ) + + parameters = cls._args_schema.parameters + parameters.Element = AAZObjectArg() + cls._build_args_run_command_input_parameter_create(parameters.Element) + + protected_parameters = cls._args_schema.protected_parameters + protected_parameters.Element = AAZObjectArg() + cls._build_args_run_command_input_parameter_create(protected_parameters.Element) + + # define Arg Group "RunCommandProperties" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="RunCommandProperties", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="RunCommandProperties", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Source" + + _args_schema = cls._args_schema + _args_schema.command_id = AAZStrArg( + options=["--command-id"], + arg_group="Source", + help="Specifies the commandId of predefined built-in script.", + ) + _args_schema.script = AAZStrArg( + options=["--script"], + arg_group="Source", + help="Specifies the script content to be executed on the machine.", + ) + _args_schema.script_uri = AAZStrArg( + options=["--script-uri"], + arg_group="Source", + help="Specifies the script download location. It can be either SAS URI of an Azure storage blob with read access or public URI.", + ) + _args_schema.script_uri_managed_identity = AAZObjectArg( + options=["--script-uri-id", "--script-uri-managed-identity"], + arg_group="Source", + help="User-assigned managed identity that has access to scriptUri in case of Azure storage blob. Use an empty object in case of system-assigned identity. Make sure the Azure storage blob exists, and managed identity has been given access to blob's container with 'Storage Blob Data Reader' role assignment. In case of user-assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged.", + ) + cls._build_args_run_command_managed_identity_create(_args_schema.script_uri_managed_identity) + return cls._args_schema + + _args_run_command_input_parameter_create = None + + @classmethod + def _build_args_run_command_input_parameter_create(cls, _schema): + if cls._args_run_command_input_parameter_create is not None: + _schema.name = cls._args_run_command_input_parameter_create.name + _schema.value = cls._args_run_command_input_parameter_create.value + return + + cls._args_run_command_input_parameter_create = AAZObjectArg() + + run_command_input_parameter_create = cls._args_run_command_input_parameter_create + run_command_input_parameter_create.name = AAZStrArg( + options=["name"], + help="The run command parameter name.", + required=True, + ) + run_command_input_parameter_create.value = AAZStrArg( + options=["value"], + help="The run command parameter value.", + required=True, + ) + + _schema.name = cls._args_run_command_input_parameter_create.name + _schema.value = cls._args_run_command_input_parameter_create.value + + _args_run_command_managed_identity_create = None + + @classmethod + def _build_args_run_command_managed_identity_create(cls, _schema): + if cls._args_run_command_managed_identity_create is not None: + _schema.client_id = cls._args_run_command_managed_identity_create.client_id + _schema.object_id = cls._args_run_command_managed_identity_create.object_id + return + + cls._args_run_command_managed_identity_create = AAZObjectArg() + + run_command_managed_identity_create = cls._args_run_command_managed_identity_create + run_command_managed_identity_create.client_id = AAZStrArg( + options=["client-id"], + help="Client Id (GUID value) of the user-assigned managed identity. ObjectId should not be used if this is provided.", + ) + run_command_managed_identity_create.object_id = AAZStrArg( + options=["object-id"], + help="Object Id (GUID value) of the user-assigned managed identity. ClientId should not be used if this is provided.", + ) + + _schema.client_id = cls._args_run_command_managed_identity_create.client_id + _schema.object_id = cls._args_run_command_managed_identity_create.object_id + + def _execute_operations(self): + self.pre_operations() + yield self.MachineRunCommandsCreateOrUpdate(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 MachineRunCommandsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/runCommands/{runCommandName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "machineName", self.ctx.args.machine_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "runCommandName", self.ctx.args.run_command_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-07-31-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("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("asyncExecution", AAZBoolType, ".async_execution") + _CreateHelper._build_schema_run_command_managed_identity_create(properties.set_prop("errorBlobManagedIdentity", AAZObjectType, ".error_blob_managed_identity")) + properties.set_prop("errorBlobUri", AAZStrType, ".error_blob_uri") + _CreateHelper._build_schema_run_command_managed_identity_create(properties.set_prop("outputBlobManagedIdentity", AAZObjectType, ".output_blob_managed_identity")) + properties.set_prop("outputBlobUri", AAZStrType, ".output_blob_uri") + properties.set_prop("parameters", AAZListType, ".parameters") + properties.set_prop("protectedParameters", AAZListType, ".protected_parameters") + properties.set_prop("runAsPassword", AAZStrType, ".run_as_password", typ_kwargs={"flags": {"secret": True}}) + properties.set_prop("runAsUser", AAZStrType, ".run_as_user") + properties.set_prop("source", AAZObjectType) + properties.set_prop("timeoutInSeconds", AAZIntType, ".timeout_in_seconds") + + parameters = _builder.get(".properties.parameters") + if parameters is not None: + _CreateHelper._build_schema_run_command_input_parameter_create(parameters.set_elements(AAZObjectType, ".")) + + protected_parameters = _builder.get(".properties.protectedParameters") + if protected_parameters is not None: + _CreateHelper._build_schema_run_command_input_parameter_create(protected_parameters.set_elements(AAZObjectType, ".")) + + source = _builder.get(".properties.source") + if source is not None: + source.set_prop("commandId", AAZStrType, ".command_id") + source.set_prop("script", AAZStrType, ".script") + source.set_prop("scriptUri", AAZStrType, ".script_uri") + _CreateHelper._build_schema_run_command_managed_identity_create(source.set_prop("scriptUriManagedIdentity", AAZObjectType, ".script_uri_managed_identity")) + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.async_execution = AAZBoolType( + serialized_name="asyncExecution", + ) + properties.error_blob_managed_identity = AAZObjectType( + serialized_name="errorBlobManagedIdentity", + ) + _CreateHelper._build_schema_run_command_managed_identity_read(properties.error_blob_managed_identity) + properties.error_blob_uri = AAZStrType( + serialized_name="errorBlobUri", + ) + properties.instance_view = AAZObjectType( + serialized_name="instanceView", + flags={"read_only": True}, + ) + properties.output_blob_managed_identity = AAZObjectType( + serialized_name="outputBlobManagedIdentity", + ) + _CreateHelper._build_schema_run_command_managed_identity_read(properties.output_blob_managed_identity) + properties.output_blob_uri = AAZStrType( + serialized_name="outputBlobUri", + ) + properties.parameters = AAZListType() + properties.protected_parameters = AAZListType( + serialized_name="protectedParameters", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.run_as_password = AAZStrType( + serialized_name="runAsPassword", + flags={"secret": True}, + ) + properties.run_as_user = AAZStrType( + serialized_name="runAsUser", + ) + properties.source = AAZObjectType() + properties.timeout_in_seconds = AAZIntType( + serialized_name="timeoutInSeconds", + ) + + instance_view = cls._schema_on_200_201.properties.instance_view + instance_view.end_time = AAZStrType( + serialized_name="endTime", + ) + instance_view.error = AAZStrType() + instance_view.execution_message = AAZStrType( + serialized_name="executionMessage", + ) + instance_view.execution_state = AAZStrType( + serialized_name="executionState", + ) + instance_view.exit_code = AAZIntType( + serialized_name="exitCode", + ) + instance_view.output = AAZStrType() + instance_view.start_time = AAZStrType( + serialized_name="startTime", + ) + instance_view.statuses = AAZListType() + + statuses = cls._schema_on_200_201.properties.instance_view.statuses + statuses.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.instance_view.statuses.Element + _element.code = AAZStrType() + _element.display_status = AAZStrType( + serialized_name="displayStatus", + ) + _element.level = AAZStrType() + _element.message = AAZStrType() + _element.time = AAZStrType() + + parameters = cls._schema_on_200_201.properties.parameters + parameters.Element = AAZObjectType() + _CreateHelper._build_schema_run_command_input_parameter_read(parameters.Element) + + protected_parameters = cls._schema_on_200_201.properties.protected_parameters + protected_parameters.Element = AAZObjectType() + _CreateHelper._build_schema_run_command_input_parameter_read(protected_parameters.Element) + + source = cls._schema_on_200_201.properties.source + source.command_id = AAZStrType( + serialized_name="commandId", + ) + source.script = AAZStrType() + source.script_uri = AAZStrType( + serialized_name="scriptUri", + ) + source.script_uri_managed_identity = AAZObjectType( + serialized_name="scriptUriManagedIdentity", + ) + _CreateHelper._build_schema_run_command_managed_identity_read(source.script_uri_managed_identity) + + system_data = cls._schema_on_200_201.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_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + @classmethod + def _build_schema_run_command_input_parameter_create(cls, _builder): + if _builder is None: + return + _builder.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("value", AAZStrType, ".value", typ_kwargs={"flags": {"required": True}}) + + @classmethod + def _build_schema_run_command_managed_identity_create(cls, _builder): + if _builder is None: + return + _builder.set_prop("clientId", AAZStrType, ".client_id") + _builder.set_prop("objectId", AAZStrType, ".object_id") + + _schema_run_command_input_parameter_read = None + + @classmethod + def _build_schema_run_command_input_parameter_read(cls, _schema): + if cls._schema_run_command_input_parameter_read is not None: + _schema.name = cls._schema_run_command_input_parameter_read.name + _schema.value = cls._schema_run_command_input_parameter_read.value + return + + cls._schema_run_command_input_parameter_read = _schema_run_command_input_parameter_read = AAZObjectType() + + run_command_input_parameter_read = _schema_run_command_input_parameter_read + run_command_input_parameter_read.name = AAZStrType( + flags={"required": True}, + ) + run_command_input_parameter_read.value = AAZStrType( + flags={"required": True}, + ) + + _schema.name = cls._schema_run_command_input_parameter_read.name + _schema.value = cls._schema_run_command_input_parameter_read.value + + _schema_run_command_managed_identity_read = None + + @classmethod + def _build_schema_run_command_managed_identity_read(cls, _schema): + if cls._schema_run_command_managed_identity_read is not None: + _schema.client_id = cls._schema_run_command_managed_identity_read.client_id + _schema.object_id = cls._schema_run_command_managed_identity_read.object_id + return + + cls._schema_run_command_managed_identity_read = _schema_run_command_managed_identity_read = AAZObjectType() + + run_command_managed_identity_read = _schema_run_command_managed_identity_read + run_command_managed_identity_read.client_id = AAZStrType( + serialized_name="clientId", + ) + run_command_managed_identity_read.object_id = AAZStrType( + serialized_name="objectId", + ) + + _schema.client_id = cls._schema_run_command_managed_identity_read.client_id + _schema.object_id = cls._schema_run_command_managed_identity_read.object_id + + +__all__ = ["Create"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_delete.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_delete.py new file mode 100644 index 00000000000..f7962b53249 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_delete.py @@ -0,0 +1,180 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "connectedmachine run-command delete", + is_preview=True, + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete a run command. + + :example: Sample command for run-command delete + az connectedmachine run-command delete --resource-group myResourceGroup --machine-name myMachine --name myRunCommand + """ + + _aaz_info = { + "version": "2024-07-31-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/runcommands/{}", "2024-07-31-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.machine_name = AAZStrArg( + options=["--machine-name"], + help="The name of the hybrid machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="[a-zA-Z0-9-_\.]+", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.run_command_name = AAZStrArg( + options=["-n", "--name", "--run-command-name"], + help="The name of the run command.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="[a-zA-Z0-9-_\.]+", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.MachineRunCommandsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class MachineRunCommandsDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "location"}, + 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": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/runCommands/{runCommandName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "machineName", self.ctx.args.machine_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "runCommandName", self.ctx.args.run_command_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-07-31-preview", + required=True, + ), + } + return parameters + + def on_204(self, session): + pass + + def on_200_201(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_list.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_list.py new file mode 100644 index 00000000000..1e96b9fe118 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_list.py @@ -0,0 +1,367 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "connectedmachine run-command list", + is_preview=True, +) +class List(AAZCommand): + """Get all the run commands of a non-Azure machine. + + :example: Sample command for run-command list + az connectedmachine run-command list --resource-group myResourceGroup --machine-name myMachine --subscription mySubscription + """ + + _aaz_info = { + "version": "2024-07-31-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/runcommands", "2024-07-31-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.machine_name = AAZStrArg( + options=["--machine-name"], + help="The name of the hybrid machine.", + required=True, + fmt=AAZStrArgFormat( + pattern="[a-zA-Z0-9-_\.]+", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.expand = AAZStrArg( + options=["--expand"], + help="The expand expression to apply on the operation.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MachineRunCommandsList(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 MachineRunCommandsList(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.HybridCompute/machines/{machineName}/runCommands", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "machineName", self.ctx.args.machine_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "$expand", self.ctx.args.expand, + ), + **self.serialize_query_param( + "api-version", "2024-07-31-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() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.async_execution = AAZBoolType( + serialized_name="asyncExecution", + ) + properties.error_blob_managed_identity = AAZObjectType( + serialized_name="errorBlobManagedIdentity", + ) + _ListHelper._build_schema_run_command_managed_identity_read(properties.error_blob_managed_identity) + properties.error_blob_uri = AAZStrType( + serialized_name="errorBlobUri", + ) + properties.instance_view = AAZObjectType( + serialized_name="instanceView", + flags={"read_only": True}, + ) + properties.output_blob_managed_identity = AAZObjectType( + serialized_name="outputBlobManagedIdentity", + ) + _ListHelper._build_schema_run_command_managed_identity_read(properties.output_blob_managed_identity) + properties.output_blob_uri = AAZStrType( + serialized_name="outputBlobUri", + ) + properties.parameters = AAZListType() + properties.protected_parameters = AAZListType( + serialized_name="protectedParameters", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.run_as_password = AAZStrType( + serialized_name="runAsPassword", + flags={"secret": True}, + ) + properties.run_as_user = AAZStrType( + serialized_name="runAsUser", + ) + properties.source = AAZObjectType() + properties.timeout_in_seconds = AAZIntType( + serialized_name="timeoutInSeconds", + ) + + instance_view = cls._schema_on_200.value.Element.properties.instance_view + instance_view.end_time = AAZStrType( + serialized_name="endTime", + ) + instance_view.error = AAZStrType() + instance_view.execution_message = AAZStrType( + serialized_name="executionMessage", + ) + instance_view.execution_state = AAZStrType( + serialized_name="executionState", + ) + instance_view.exit_code = AAZIntType( + serialized_name="exitCode", + ) + instance_view.output = AAZStrType() + instance_view.start_time = AAZStrType( + serialized_name="startTime", + ) + instance_view.statuses = AAZListType() + + statuses = cls._schema_on_200.value.Element.properties.instance_view.statuses + statuses.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.instance_view.statuses.Element + _element.code = AAZStrType() + _element.display_status = AAZStrType( + serialized_name="displayStatus", + ) + _element.level = AAZStrType() + _element.message = AAZStrType() + _element.time = AAZStrType() + + parameters = cls._schema_on_200.value.Element.properties.parameters + parameters.Element = AAZObjectType() + _ListHelper._build_schema_run_command_input_parameter_read(parameters.Element) + + protected_parameters = cls._schema_on_200.value.Element.properties.protected_parameters + protected_parameters.Element = AAZObjectType() + _ListHelper._build_schema_run_command_input_parameter_read(protected_parameters.Element) + + source = cls._schema_on_200.value.Element.properties.source + source.command_id = AAZStrType( + serialized_name="commandId", + ) + source.script = AAZStrType() + source.script_uri = AAZStrType( + serialized_name="scriptUri", + ) + source.script_uri_managed_identity = AAZObjectType( + serialized_name="scriptUriManagedIdentity", + ) + _ListHelper._build_schema_run_command_managed_identity_read(source.script_uri_managed_identity) + + 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""" + + _schema_run_command_input_parameter_read = None + + @classmethod + def _build_schema_run_command_input_parameter_read(cls, _schema): + if cls._schema_run_command_input_parameter_read is not None: + _schema.name = cls._schema_run_command_input_parameter_read.name + _schema.value = cls._schema_run_command_input_parameter_read.value + return + + cls._schema_run_command_input_parameter_read = _schema_run_command_input_parameter_read = AAZObjectType() + + run_command_input_parameter_read = _schema_run_command_input_parameter_read + run_command_input_parameter_read.name = AAZStrType( + flags={"required": True}, + ) + run_command_input_parameter_read.value = AAZStrType( + flags={"required": True}, + ) + + _schema.name = cls._schema_run_command_input_parameter_read.name + _schema.value = cls._schema_run_command_input_parameter_read.value + + _schema_run_command_managed_identity_read = None + + @classmethod + def _build_schema_run_command_managed_identity_read(cls, _schema): + if cls._schema_run_command_managed_identity_read is not None: + _schema.client_id = cls._schema_run_command_managed_identity_read.client_id + _schema.object_id = cls._schema_run_command_managed_identity_read.object_id + return + + cls._schema_run_command_managed_identity_read = _schema_run_command_managed_identity_read = AAZObjectType() + + run_command_managed_identity_read = _schema_run_command_managed_identity_read + run_command_managed_identity_read.client_id = AAZStrType( + serialized_name="clientId", + ) + run_command_managed_identity_read.object_id = AAZStrType( + serialized_name="objectId", + ) + + _schema.client_id = cls._schema_run_command_managed_identity_read.client_id + _schema.object_id = cls._schema_run_command_managed_identity_read.object_id + + +__all__ = ["List"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_show.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_show.py new file mode 100644 index 00000000000..97f9b609680 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_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( + "connectedmachine run-command show", + is_preview=True, +) +class Show(AAZCommand): + """Get a run command. + + :example: Sample command for run-command show + az connectedmachine run-command show --resource-group myResourceGroup --machine-name myMachine --name myRunCommand + """ + + _aaz_info = { + "version": "2024-07-31-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/runcommands/{}", "2024-07-31-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.machine_name = AAZStrArg( + options=["--machine-name"], + help="The name of the hybrid machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="[a-zA-Z0-9-_\.]+", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.run_command_name = AAZStrArg( + options=["-n", "--name", "--run-command-name"], + help="The name of the run command.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="[a-zA-Z0-9-_\.]+", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MachineRunCommandsGet(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 MachineRunCommandsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.HybridCompute/machines/{machineName}/runCommands/{runCommandName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "machineName", self.ctx.args.machine_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "runCommandName", self.ctx.args.run_command_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-07-31-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.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.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.async_execution = AAZBoolType( + serialized_name="asyncExecution", + ) + properties.error_blob_managed_identity = AAZObjectType( + serialized_name="errorBlobManagedIdentity", + ) + _ShowHelper._build_schema_run_command_managed_identity_read(properties.error_blob_managed_identity) + properties.error_blob_uri = AAZStrType( + serialized_name="errorBlobUri", + ) + properties.instance_view = AAZObjectType( + serialized_name="instanceView", + flags={"read_only": True}, + ) + properties.output_blob_managed_identity = AAZObjectType( + serialized_name="outputBlobManagedIdentity", + ) + _ShowHelper._build_schema_run_command_managed_identity_read(properties.output_blob_managed_identity) + properties.output_blob_uri = AAZStrType( + serialized_name="outputBlobUri", + ) + properties.parameters = AAZListType() + properties.protected_parameters = AAZListType( + serialized_name="protectedParameters", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.run_as_password = AAZStrType( + serialized_name="runAsPassword", + flags={"secret": True}, + ) + properties.run_as_user = AAZStrType( + serialized_name="runAsUser", + ) + properties.source = AAZObjectType() + properties.timeout_in_seconds = AAZIntType( + serialized_name="timeoutInSeconds", + ) + + instance_view = cls._schema_on_200.properties.instance_view + instance_view.end_time = AAZStrType( + serialized_name="endTime", + ) + instance_view.error = AAZStrType() + instance_view.execution_message = AAZStrType( + serialized_name="executionMessage", + ) + instance_view.execution_state = AAZStrType( + serialized_name="executionState", + ) + instance_view.exit_code = AAZIntType( + serialized_name="exitCode", + ) + instance_view.output = AAZStrType() + instance_view.start_time = AAZStrType( + serialized_name="startTime", + ) + instance_view.statuses = AAZListType() + + statuses = cls._schema_on_200.properties.instance_view.statuses + statuses.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.instance_view.statuses.Element + _element.code = AAZStrType() + _element.display_status = AAZStrType( + serialized_name="displayStatus", + ) + _element.level = AAZStrType() + _element.message = AAZStrType() + _element.time = AAZStrType() + + parameters = cls._schema_on_200.properties.parameters + parameters.Element = AAZObjectType() + _ShowHelper._build_schema_run_command_input_parameter_read(parameters.Element) + + protected_parameters = cls._schema_on_200.properties.protected_parameters + protected_parameters.Element = AAZObjectType() + _ShowHelper._build_schema_run_command_input_parameter_read(protected_parameters.Element) + + source = cls._schema_on_200.properties.source + source.command_id = AAZStrType( + serialized_name="commandId", + ) + source.script = AAZStrType() + source.script_uri = AAZStrType( + serialized_name="scriptUri", + ) + source.script_uri_managed_identity = AAZObjectType( + serialized_name="scriptUriManagedIdentity", + ) + _ShowHelper._build_schema_run_command_managed_identity_read(source.script_uri_managed_identity) + + 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""" + + _schema_run_command_input_parameter_read = None + + @classmethod + def _build_schema_run_command_input_parameter_read(cls, _schema): + if cls._schema_run_command_input_parameter_read is not None: + _schema.name = cls._schema_run_command_input_parameter_read.name + _schema.value = cls._schema_run_command_input_parameter_read.value + return + + cls._schema_run_command_input_parameter_read = _schema_run_command_input_parameter_read = AAZObjectType() + + run_command_input_parameter_read = _schema_run_command_input_parameter_read + run_command_input_parameter_read.name = AAZStrType( + flags={"required": True}, + ) + run_command_input_parameter_read.value = AAZStrType( + flags={"required": True}, + ) + + _schema.name = cls._schema_run_command_input_parameter_read.name + _schema.value = cls._schema_run_command_input_parameter_read.value + + _schema_run_command_managed_identity_read = None + + @classmethod + def _build_schema_run_command_managed_identity_read(cls, _schema): + if cls._schema_run_command_managed_identity_read is not None: + _schema.client_id = cls._schema_run_command_managed_identity_read.client_id + _schema.object_id = cls._schema_run_command_managed_identity_read.object_id + return + + cls._schema_run_command_managed_identity_read = _schema_run_command_managed_identity_read = AAZObjectType() + + run_command_managed_identity_read = _schema_run_command_managed_identity_read + run_command_managed_identity_read.client_id = AAZStrType( + serialized_name="clientId", + ) + run_command_managed_identity_read.object_id = AAZStrType( + serialized_name="objectId", + ) + + _schema.client_id = cls._schema_run_command_managed_identity_read.client_id + _schema.object_id = cls._schema_run_command_managed_identity_read.object_id + + +__all__ = ["Show"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_update.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_update.py new file mode 100644 index 00000000000..e7751a2edd3 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_update.py @@ -0,0 +1,766 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "connectedmachine run-command update", + is_preview=True, +) +class Update(AAZCommand): + """Update a run command. + + :example: Sample command for run-command update + az connetcedmachine run-command update --resource-group myResourceGroup --name myRunCommand --machine-name myMachine --subscription mySubscription --tags Tag1=Value1 + """ + + _aaz_info = { + "version": "2024-07-31-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/runcommands/{}", "2024-07-31-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.machine_name = AAZStrArg( + options=["--machine-name"], + help="The name of the hybrid machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="[a-zA-Z0-9-_\.]+", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.run_command_name = AAZStrArg( + options=["-n", "--name", "--run-command-name"], + help="The name of the run command.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="[a-zA-Z0-9-_\.]+", + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.async_execution = AAZBoolArg( + options=["--async-execution"], + arg_group="Properties", + help="Optional. If set to true, provisioning will complete as soon as script starts and will not wait for script to complete.", + nullable=True, + ) + _args_schema.error_blob_managed_identity = AAZObjectArg( + options=["--error-blob-id", "--error-blob-managed-identity"], + arg_group="Properties", + help="User-assigned managed identity that has access to errorBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given access to blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged", + nullable=True, + ) + cls._build_args_run_command_managed_identity_update(_args_schema.error_blob_managed_identity) + _args_schema.error_blob_uri = AAZStrArg( + options=["--error-blob-uri"], + arg_group="Properties", + help="Specifies the Azure storage blob where script error stream will be uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to provide the VM access to the blob. Refer errorBlobManagedIdentity parameter.", + nullable=True, + ) + _args_schema.output_blob_managed_identity = AAZObjectArg( + options=["--output-blob-id", "--output-blob-managed-identity"], + arg_group="Properties", + help="User-assigned managed identity that has access to outputBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given access to blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged", + nullable=True, + ) + cls._build_args_run_command_managed_identity_update(_args_schema.output_blob_managed_identity) + _args_schema.output_blob_uri = AAZStrArg( + options=["--output-blob-uri"], + arg_group="Properties", + help="Specifies the Azure storage blob where script output stream will be uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to provide the VM access to the blob. Refer outputBlobManagedIdentity parameter. ", + nullable=True, + ) + _args_schema.parameters = AAZListArg( + options=["--parameters"], + arg_group="Properties", + help="The parameters used by the script.", + nullable=True, + ) + _args_schema.protected_parameters = AAZListArg( + options=["--protected-parameters"], + arg_group="Properties", + help="The parameters used by the script.", + nullable=True, + ) + _args_schema.run_as_password = AAZStrArg( + options=["--run-as-password"], + arg_group="Properties", + help="Specifies the user account password on the machine when executing the run command.", + nullable=True, + ) + _args_schema.run_as_user = AAZStrArg( + options=["--run-as-user"], + arg_group="Properties", + help="Specifies the user account on the machine when executing the run command.", + nullable=True, + ) + _args_schema.timeout_in_seconds = AAZIntArg( + options=["--timeout-in-seconds"], + arg_group="Properties", + help="The timeout in seconds to execute the run command.", + nullable=True, + ) + + parameters = cls._args_schema.parameters + parameters.Element = AAZObjectArg( + nullable=True, + ) + cls._build_args_run_command_input_parameter_update(parameters.Element) + + protected_parameters = cls._args_schema.protected_parameters + protected_parameters.Element = AAZObjectArg( + nullable=True, + ) + cls._build_args_run_command_input_parameter_update(protected_parameters.Element) + + # define Arg Group "RunCommandProperties" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="RunCommandProperties", + help="Resource tags.", + nullable=True, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg( + nullable=True, + ) + + # define Arg Group "Source" + + _args_schema = cls._args_schema + _args_schema.command_id = AAZStrArg( + options=["--command-id"], + arg_group="Source", + help="Specifies the commandId of predefined built-in script.", + nullable=True, + ) + _args_schema.script = AAZStrArg( + options=["--script"], + arg_group="Source", + help="Specifies the script content to be executed on the machine.", + nullable=True, + ) + _args_schema.script_uri = AAZStrArg( + options=["--script-uri"], + arg_group="Source", + help="Specifies the script download location. It can be either SAS URI of an Azure storage blob with read access or public URI.", + nullable=True, + ) + _args_schema.script_uri_managed_identity = AAZObjectArg( + options=["--script-uri-id", "--script-uri-managed-identity"], + arg_group="Source", + help="User-assigned managed identity that has access to scriptUri in case of Azure storage blob. Use an empty object in case of system-assigned identity. Make sure the Azure storage blob exists, and managed identity has been given access to blob's container with 'Storage Blob Data Reader' role assignment. In case of user-assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged.", + nullable=True, + ) + cls._build_args_run_command_managed_identity_update(_args_schema.script_uri_managed_identity) + return cls._args_schema + + _args_run_command_input_parameter_update = None + + @classmethod + def _build_args_run_command_input_parameter_update(cls, _schema): + if cls._args_run_command_input_parameter_update is not None: + _schema.name = cls._args_run_command_input_parameter_update.name + _schema.value = cls._args_run_command_input_parameter_update.value + return + + cls._args_run_command_input_parameter_update = AAZObjectArg( + nullable=True, + ) + + run_command_input_parameter_update = cls._args_run_command_input_parameter_update + run_command_input_parameter_update.name = AAZStrArg( + options=["name"], + help="The run command parameter name.", + ) + run_command_input_parameter_update.value = AAZStrArg( + options=["value"], + help="The run command parameter value.", + ) + + _schema.name = cls._args_run_command_input_parameter_update.name + _schema.value = cls._args_run_command_input_parameter_update.value + + _args_run_command_managed_identity_update = None + + @classmethod + def _build_args_run_command_managed_identity_update(cls, _schema): + if cls._args_run_command_managed_identity_update is not None: + _schema.client_id = cls._args_run_command_managed_identity_update.client_id + _schema.object_id = cls._args_run_command_managed_identity_update.object_id + return + + cls._args_run_command_managed_identity_update = AAZObjectArg( + nullable=True, + ) + + run_command_managed_identity_update = cls._args_run_command_managed_identity_update + run_command_managed_identity_update.client_id = AAZStrArg( + options=["client-id"], + help="Client Id (GUID value) of the user-assigned managed identity. ObjectId should not be used if this is provided.", + nullable=True, + ) + run_command_managed_identity_update.object_id = AAZStrArg( + options=["object-id"], + help="Object Id (GUID value) of the user-assigned managed identity. ClientId should not be used if this is provided.", + nullable=True, + ) + + _schema.client_id = cls._args_run_command_managed_identity_update.client_id + _schema.object_id = cls._args_run_command_managed_identity_update.object_id + + def _execute_operations(self): + self.pre_operations() + self.MachineRunCommandsGet(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.MachineRunCommandsCreateOrUpdate(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 MachineRunCommandsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.HybridCompute/machines/{machineName}/runCommands/{runCommandName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "machineName", self.ctx.args.machine_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "runCommandName", self.ctx.args.run_command_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-07-31-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_machine_run_command_read(cls._schema_on_200) + + return cls._schema_on_200 + + class MachineRunCommandsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/runCommands/{runCommandName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "machineName", self.ctx.args.machine_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "runCommandName", self.ctx.args.run_command_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-07-31-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_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + _UpdateHelper._build_schema_machine_run_command_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("asyncExecution", AAZBoolType, ".async_execution") + _UpdateHelper._build_schema_run_command_managed_identity_update(properties.set_prop("errorBlobManagedIdentity", AAZObjectType, ".error_blob_managed_identity")) + properties.set_prop("errorBlobUri", AAZStrType, ".error_blob_uri") + _UpdateHelper._build_schema_run_command_managed_identity_update(properties.set_prop("outputBlobManagedIdentity", AAZObjectType, ".output_blob_managed_identity")) + properties.set_prop("outputBlobUri", AAZStrType, ".output_blob_uri") + properties.set_prop("parameters", AAZListType, ".parameters") + properties.set_prop("protectedParameters", AAZListType, ".protected_parameters") + properties.set_prop("runAsPassword", AAZStrType, ".run_as_password", typ_kwargs={"flags": {"secret": True}}) + properties.set_prop("runAsUser", AAZStrType, ".run_as_user") + properties.set_prop("source", AAZObjectType) + properties.set_prop("timeoutInSeconds", AAZIntType, ".timeout_in_seconds") + + parameters = _builder.get(".properties.parameters") + if parameters is not None: + _UpdateHelper._build_schema_run_command_input_parameter_update(parameters.set_elements(AAZObjectType, ".")) + + protected_parameters = _builder.get(".properties.protectedParameters") + if protected_parameters is not None: + _UpdateHelper._build_schema_run_command_input_parameter_update(protected_parameters.set_elements(AAZObjectType, ".")) + + source = _builder.get(".properties.source") + if source is not None: + source.set_prop("commandId", AAZStrType, ".command_id") + source.set_prop("script", AAZStrType, ".script") + source.set_prop("scriptUri", AAZStrType, ".script_uri") + _UpdateHelper._build_schema_run_command_managed_identity_update(source.set_prop("scriptUriManagedIdentity", AAZObjectType, ".script_uri_managed_identity")) + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return _instance_value + + class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance_by_generic( + self.ctx.vars.instance, + self.ctx.generic_update_args + ) + + +class _UpdateHelper: + """Helper class for Update""" + + @classmethod + def _build_schema_run_command_input_parameter_update(cls, _builder): + if _builder is None: + return + _builder.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("value", AAZStrType, ".value", typ_kwargs={"flags": {"required": True}}) + + @classmethod + def _build_schema_run_command_managed_identity_update(cls, _builder): + if _builder is None: + return + _builder.set_prop("clientId", AAZStrType, ".client_id") + _builder.set_prop("objectId", AAZStrType, ".object_id") + + _schema_machine_run_command_read = None + + @classmethod + def _build_schema_machine_run_command_read(cls, _schema): + if cls._schema_machine_run_command_read is not None: + _schema.id = cls._schema_machine_run_command_read.id + _schema.location = cls._schema_machine_run_command_read.location + _schema.name = cls._schema_machine_run_command_read.name + _schema.properties = cls._schema_machine_run_command_read.properties + _schema.system_data = cls._schema_machine_run_command_read.system_data + _schema.tags = cls._schema_machine_run_command_read.tags + _schema.type = cls._schema_machine_run_command_read.type + return + + cls._schema_machine_run_command_read = _schema_machine_run_command_read = AAZObjectType() + + machine_run_command_read = _schema_machine_run_command_read + machine_run_command_read.id = AAZStrType( + flags={"read_only": True}, + ) + machine_run_command_read.location = AAZStrType( + flags={"required": True}, + ) + machine_run_command_read.name = AAZStrType( + flags={"read_only": True}, + ) + machine_run_command_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + machine_run_command_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + machine_run_command_read.tags = AAZDictType() + machine_run_command_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_machine_run_command_read.properties + properties.async_execution = AAZBoolType( + serialized_name="asyncExecution", + ) + properties.error_blob_managed_identity = AAZObjectType( + serialized_name="errorBlobManagedIdentity", + ) + cls._build_schema_run_command_managed_identity_read(properties.error_blob_managed_identity) + properties.error_blob_uri = AAZStrType( + serialized_name="errorBlobUri", + ) + properties.instance_view = AAZObjectType( + serialized_name="instanceView", + flags={"read_only": True}, + ) + properties.output_blob_managed_identity = AAZObjectType( + serialized_name="outputBlobManagedIdentity", + ) + cls._build_schema_run_command_managed_identity_read(properties.output_blob_managed_identity) + properties.output_blob_uri = AAZStrType( + serialized_name="outputBlobUri", + ) + properties.parameters = AAZListType() + properties.protected_parameters = AAZListType( + serialized_name="protectedParameters", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.run_as_password = AAZStrType( + serialized_name="runAsPassword", + flags={"secret": True}, + ) + properties.run_as_user = AAZStrType( + serialized_name="runAsUser", + ) + properties.source = AAZObjectType() + properties.timeout_in_seconds = AAZIntType( + serialized_name="timeoutInSeconds", + ) + + instance_view = _schema_machine_run_command_read.properties.instance_view + instance_view.end_time = AAZStrType( + serialized_name="endTime", + ) + instance_view.error = AAZStrType() + instance_view.execution_message = AAZStrType( + serialized_name="executionMessage", + ) + instance_view.execution_state = AAZStrType( + serialized_name="executionState", + ) + instance_view.exit_code = AAZIntType( + serialized_name="exitCode", + ) + instance_view.output = AAZStrType() + instance_view.start_time = AAZStrType( + serialized_name="startTime", + ) + instance_view.statuses = AAZListType() + + statuses = _schema_machine_run_command_read.properties.instance_view.statuses + statuses.Element = AAZObjectType() + + _element = _schema_machine_run_command_read.properties.instance_view.statuses.Element + _element.code = AAZStrType() + _element.display_status = AAZStrType( + serialized_name="displayStatus", + ) + _element.level = AAZStrType() + _element.message = AAZStrType() + _element.time = AAZStrType() + + parameters = _schema_machine_run_command_read.properties.parameters + parameters.Element = AAZObjectType() + cls._build_schema_run_command_input_parameter_read(parameters.Element) + + protected_parameters = _schema_machine_run_command_read.properties.protected_parameters + protected_parameters.Element = AAZObjectType() + cls._build_schema_run_command_input_parameter_read(protected_parameters.Element) + + source = _schema_machine_run_command_read.properties.source + source.command_id = AAZStrType( + serialized_name="commandId", + ) + source.script = AAZStrType() + source.script_uri = AAZStrType( + serialized_name="scriptUri", + ) + source.script_uri_managed_identity = AAZObjectType( + serialized_name="scriptUriManagedIdentity", + ) + cls._build_schema_run_command_managed_identity_read(source.script_uri_managed_identity) + + system_data = _schema_machine_run_command_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", + ) + + tags = _schema_machine_run_command_read.tags + tags.Element = AAZStrType() + + _schema.id = cls._schema_machine_run_command_read.id + _schema.location = cls._schema_machine_run_command_read.location + _schema.name = cls._schema_machine_run_command_read.name + _schema.properties = cls._schema_machine_run_command_read.properties + _schema.system_data = cls._schema_machine_run_command_read.system_data + _schema.tags = cls._schema_machine_run_command_read.tags + _schema.type = cls._schema_machine_run_command_read.type + + _schema_run_command_input_parameter_read = None + + @classmethod + def _build_schema_run_command_input_parameter_read(cls, _schema): + if cls._schema_run_command_input_parameter_read is not None: + _schema.name = cls._schema_run_command_input_parameter_read.name + _schema.value = cls._schema_run_command_input_parameter_read.value + return + + cls._schema_run_command_input_parameter_read = _schema_run_command_input_parameter_read = AAZObjectType() + + run_command_input_parameter_read = _schema_run_command_input_parameter_read + run_command_input_parameter_read.name = AAZStrType( + flags={"required": True}, + ) + run_command_input_parameter_read.value = AAZStrType( + flags={"required": True}, + ) + + _schema.name = cls._schema_run_command_input_parameter_read.name + _schema.value = cls._schema_run_command_input_parameter_read.value + + _schema_run_command_managed_identity_read = None + + @classmethod + def _build_schema_run_command_managed_identity_read(cls, _schema): + if cls._schema_run_command_managed_identity_read is not None: + _schema.client_id = cls._schema_run_command_managed_identity_read.client_id + _schema.object_id = cls._schema_run_command_managed_identity_read.object_id + return + + cls._schema_run_command_managed_identity_read = _schema_run_command_managed_identity_read = AAZObjectType() + + run_command_managed_identity_read = _schema_run_command_managed_identity_read + run_command_managed_identity_read.client_id = AAZStrType( + serialized_name="clientId", + ) + run_command_managed_identity_read.object_id = AAZStrType( + serialized_name="objectId", + ) + + _schema.client_id = cls._schema_run_command_managed_identity_read.client_id + _schema.object_id = cls._schema_run_command_managed_identity_read.object_id + + +__all__ = ["Update"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_wait.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_wait.py new file mode 100644 index 00000000000..753ede081f5 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/run_command/_wait.py @@ -0,0 +1,358 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "connectedmachine run-command 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.hybridcompute/machines/{}/runcommands/{}", "2024-07-31-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.machine_name = AAZStrArg( + options=["--machine-name"], + help="The name of the hybrid machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="[a-zA-Z0-9-_\.]+", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.run_command_name = AAZStrArg( + options=["-n", "--name", "--run-command-name"], + help="The name of the run command.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="[a-zA-Z0-9-_\.]+", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MachineRunCommandsGet(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 MachineRunCommandsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.HybridCompute/machines/{machineName}/runCommands/{runCommandName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "machineName", self.ctx.args.machine_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "runCommandName", self.ctx.args.run_command_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-07-31-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.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.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.async_execution = AAZBoolType( + serialized_name="asyncExecution", + ) + properties.error_blob_managed_identity = AAZObjectType( + serialized_name="errorBlobManagedIdentity", + ) + _WaitHelper._build_schema_run_command_managed_identity_read(properties.error_blob_managed_identity) + properties.error_blob_uri = AAZStrType( + serialized_name="errorBlobUri", + ) + properties.instance_view = AAZObjectType( + serialized_name="instanceView", + flags={"read_only": True}, + ) + properties.output_blob_managed_identity = AAZObjectType( + serialized_name="outputBlobManagedIdentity", + ) + _WaitHelper._build_schema_run_command_managed_identity_read(properties.output_blob_managed_identity) + properties.output_blob_uri = AAZStrType( + serialized_name="outputBlobUri", + ) + properties.parameters = AAZListType() + properties.protected_parameters = AAZListType( + serialized_name="protectedParameters", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.run_as_password = AAZStrType( + serialized_name="runAsPassword", + flags={"secret": True}, + ) + properties.run_as_user = AAZStrType( + serialized_name="runAsUser", + ) + properties.source = AAZObjectType() + properties.timeout_in_seconds = AAZIntType( + serialized_name="timeoutInSeconds", + ) + + instance_view = cls._schema_on_200.properties.instance_view + instance_view.end_time = AAZStrType( + serialized_name="endTime", + ) + instance_view.error = AAZStrType() + instance_view.execution_message = AAZStrType( + serialized_name="executionMessage", + ) + instance_view.execution_state = AAZStrType( + serialized_name="executionState", + ) + instance_view.exit_code = AAZIntType( + serialized_name="exitCode", + ) + instance_view.output = AAZStrType() + instance_view.start_time = AAZStrType( + serialized_name="startTime", + ) + instance_view.statuses = AAZListType() + + statuses = cls._schema_on_200.properties.instance_view.statuses + statuses.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.instance_view.statuses.Element + _element.code = AAZStrType() + _element.display_status = AAZStrType( + serialized_name="displayStatus", + ) + _element.level = AAZStrType() + _element.message = AAZStrType() + _element.time = AAZStrType() + + parameters = cls._schema_on_200.properties.parameters + parameters.Element = AAZObjectType() + _WaitHelper._build_schema_run_command_input_parameter_read(parameters.Element) + + protected_parameters = cls._schema_on_200.properties.protected_parameters + protected_parameters.Element = AAZObjectType() + _WaitHelper._build_schema_run_command_input_parameter_read(protected_parameters.Element) + + source = cls._schema_on_200.properties.source + source.command_id = AAZStrType( + serialized_name="commandId", + ) + source.script = AAZStrType() + source.script_uri = AAZStrType( + serialized_name="scriptUri", + ) + source.script_uri_managed_identity = AAZObjectType( + serialized_name="scriptUriManagedIdentity", + ) + _WaitHelper._build_schema_run_command_managed_identity_read(source.script_uri_managed_identity) + + 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""" + + _schema_run_command_input_parameter_read = None + + @classmethod + def _build_schema_run_command_input_parameter_read(cls, _schema): + if cls._schema_run_command_input_parameter_read is not None: + _schema.name = cls._schema_run_command_input_parameter_read.name + _schema.value = cls._schema_run_command_input_parameter_read.value + return + + cls._schema_run_command_input_parameter_read = _schema_run_command_input_parameter_read = AAZObjectType() + + run_command_input_parameter_read = _schema_run_command_input_parameter_read + run_command_input_parameter_read.name = AAZStrType( + flags={"required": True}, + ) + run_command_input_parameter_read.value = AAZStrType( + flags={"required": True}, + ) + + _schema.name = cls._schema_run_command_input_parameter_read.name + _schema.value = cls._schema_run_command_input_parameter_read.value + + _schema_run_command_managed_identity_read = None + + @classmethod + def _build_schema_run_command_managed_identity_read(cls, _schema): + if cls._schema_run_command_managed_identity_read is not None: + _schema.client_id = cls._schema_run_command_managed_identity_read.client_id + _schema.object_id = cls._schema_run_command_managed_identity_read.object_id + return + + cls._schema_run_command_managed_identity_read = _schema_run_command_managed_identity_read = AAZObjectType() + + run_command_managed_identity_read = _schema_run_command_managed_identity_read + run_command_managed_identity_read.client_id = AAZStrType( + serialized_name="clientId", + ) + run_command_managed_identity_read.object_id = AAZStrType( + serialized_name="objectId", + ) + + _schema.client_id = cls._schema_run_command_managed_identity_read.client_id + _schema.object_id = cls._schema_run_command_managed_identity_read.object_id + + +__all__ = ["Wait"]