diff --git a/src/connectedmachine/HISTORY.rst b/src/connectedmachine/HISTORY.rst index c434f264b19..52a48b4e6b1 100644 --- a/src/connectedmachine/HISTORY.rst +++ b/src/connectedmachine/HISTORY.rst @@ -2,6 +2,9 @@ Release History =============== +0.6.0 ++++++ +* Add install-patches/assess-patches/Extensionimage API's. 2022/12/27 is used for aaz generation. Migrated to aaz. 0.5.1 +++++ diff --git a/src/connectedmachine/README.md b/src/connectedmachine/README.md index a73a976f4b3..4dfc06bfbb1 100644 --- a/src/connectedmachine/README.md +++ b/src/connectedmachine/README.md @@ -75,16 +75,6 @@ az connectedmachine private-link-scope list --resource-group "my-resource-group" ``` az connectedmachine private-link-scope show --resource-group "my-resource-group" --scope-name "my-privatelinkscope" ``` -##### Show-validation-detail ##### -``` -az connectedmachine private-link-scope show-validation-detail --location "wus2" \ - --private-link-scope-id "f5dc51d3-92ed-4d7e-947a-775ea79b4919" -``` -##### Show-validation-detail-for-machine ##### -``` -az connectedmachine private-link-scope show-validation-detail-for-machine --machine-name "machineName" \ - --resource-group "my-resource-group" -``` ##### Update-tag ##### ``` az connectedmachine private-link-scope update-tag --tags Tag1="Value1" Tag2="Value2" \ diff --git a/src/connectedmachine/azext_connectedmachine/__init__.py b/src/connectedmachine/azext_connectedmachine/__init__.py index 93c378353da..81f952a9db2 100644 --- a/src/connectedmachine/azext_connectedmachine/__init__.py +++ b/src/connectedmachine/azext_connectedmachine/__init__.py @@ -26,6 +26,17 @@ def __init__(self, cli_ctx=None): def load_command_table(self, args): from azext_connectedmachine.generated.commands import load_command_table + from azure.cli.core.aaz import load_aaz_command_table + try: + from . import aaz + except ImportError: + aaz = None + if aaz: + load_aaz_command_table( + loader=self, + aaz_pkg_name=aaz.__name__, + args=args + ) load_command_table(self, args) try: from azext_connectedmachine.manual.commands import load_command_table as load_command_table_manual diff --git a/src/connectedmachine/azext_connectedmachine/aaz/__init__.py b/src/connectedmachine/azext_connectedmachine/aaz/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/__init__.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/__cmd_group.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/__cmd_group.py new file mode 100644 index 00000000000..6f01704472f --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/__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", +) +class __CMDGroup(AAZCommandGroup): + """Manage an Azure Arc-Enabled Server. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/__init__.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/__init__.py new file mode 100644 index 00000000000..15ac6c23c49 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/__init__.py @@ -0,0 +1,18 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._assess_patches import * +from ._delete import * +from ._install_patches import * +from ._list import * +from ._show import * +from ._update import * +from ._upgrade_extension import * diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_assess_patches.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_assess_patches.py new file mode 100644 index 00000000000..1ae0f16f20e --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_assess_patches.py @@ -0,0 +1,301 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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 assess-patches", +) +class AssessPatches(AAZCommand): + """Assess patches on an Azure Arc-Enabled Server. + + :example: Sample command for assess-patches + az connectedmachine assess-patches --resource-group MyResourceGroup --name MyMachine + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/assesspatches", "2022-12-27"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The name of the hybrid machine.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.MachinesAssessPatches(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 MachinesAssessPatches(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/assessPatches", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "name", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-27", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.assessment_activity_id = AAZStrType( + serialized_name="assessmentActivityId", + flags={"read_only": True}, + ) + _schema_on_200.available_patch_count_by_classification = AAZObjectType( + serialized_name="availablePatchCountByClassification", + ) + _schema_on_200.error_details = AAZObjectType( + serialized_name="errorDetails", + ) + _AssessPatchesHelper._build_schema_error_detail_read(_schema_on_200.error_details) + _schema_on_200.last_modified_date_time = AAZStrType( + serialized_name="lastModifiedDateTime", + flags={"read_only": True}, + ) + _schema_on_200.os_type = AAZStrType( + serialized_name="osType", + flags={"read_only": True}, + ) + _schema_on_200.patch_service_used = AAZStrType( + serialized_name="patchServiceUsed", + flags={"read_only": True}, + ) + _schema_on_200.reboot_pending = AAZBoolType( + serialized_name="rebootPending", + flags={"read_only": True}, + ) + _schema_on_200.start_date_time = AAZStrType( + serialized_name="startDateTime", + flags={"read_only": True}, + ) + _schema_on_200.started_by = AAZStrType( + serialized_name="startedBy", + flags={"read_only": True}, + ) + _schema_on_200.status = AAZStrType( + flags={"read_only": True}, + ) + + available_patch_count_by_classification = cls._schema_on_200.available_patch_count_by_classification + available_patch_count_by_classification.critical = AAZIntType( + flags={"read_only": True}, + ) + available_patch_count_by_classification.definition = AAZIntType( + flags={"read_only": True}, + ) + available_patch_count_by_classification.feature_pack = AAZIntType( + serialized_name="featurePack", + flags={"read_only": True}, + ) + available_patch_count_by_classification.other = AAZIntType( + flags={"read_only": True}, + ) + available_patch_count_by_classification.security = AAZIntType( + flags={"read_only": True}, + ) + available_patch_count_by_classification.service_pack = AAZIntType( + serialized_name="servicePack", + flags={"read_only": True}, + ) + available_patch_count_by_classification.tools = AAZIntType( + flags={"read_only": True}, + ) + available_patch_count_by_classification.update_rollup = AAZIntType( + serialized_name="updateRollup", + flags={"read_only": True}, + ) + available_patch_count_by_classification.updates = AAZIntType( + flags={"read_only": True}, + ) + + return cls._schema_on_200 + + +class _AssessPatchesHelper: + """Helper class for AssessPatches""" + + _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() + + 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.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + 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__ = ["AssessPatches"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_delete.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_delete.py new file mode 100644 index 00000000000..66ed632efe5 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_delete.py @@ -0,0 +1,144 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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 delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete an Azure Arc-Enabled Server. + + :example: Sample command for delete + az connectedmachine delete --name myMachine --resource-group myResourceGroup + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}", "2022-12-27"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return None + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.machine_name = AAZStrArg( + options=["-n", "--name", "--machine-name"], + help="The name of the hybrid machine.", + required=True, + id_part="name", + 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.MachinesDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class MachinesDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + if session.http_response.status_code in [204]: + return self.on_204(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}", + **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( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-27", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_install_patches.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_install_patches.py new file mode 100644 index 00000000000..223315a2661 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_install_patches.py @@ -0,0 +1,430 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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 install-patches", +) +class InstallPatches(AAZCommand): + """Install patches on an Azure Arc-Enabled Server. + + :example: Sample command for install-patches + az connectedmachine install-patches --resource-group MyResourceGroup --name MyMachine --maximum-duration PT4H --reboot-setting IfRequired --windows-parameters "{"classificationsToInclude": ["Critical", "Security"]}" + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/installpatches", "2022-12-27"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The name of the hybrid machine.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "InstallPatchesInput" + + _args_schema = cls._args_schema + _args_schema.linux_parameters = AAZObjectArg( + options=["--linux-parameters"], + arg_group="InstallPatchesInput", + help="Input for InstallPatches on a Linux VM, as directly received by the API", + ) + _args_schema.maximum_duration = AAZStrArg( + options=["--maximum-duration"], + arg_group="InstallPatchesInput", + help="Specifies the maximum amount of time that the operation will run. It must be an ISO 8601-compliant duration string such as PT4H (4 hours)", + required=True, + ) + _args_schema.reboot_setting = AAZStrArg( + options=["--reboot-setting"], + arg_group="InstallPatchesInput", + help="Defines when it is acceptable to reboot a VM during a software update operation.", + required=True, + enum={"Always": "Always", "IfRequired": "IfRequired", "Never": "Never"}, + ) + _args_schema.windows_parameters = AAZObjectArg( + options=["--windows-parameters"], + arg_group="InstallPatchesInput", + help="Input for InstallPatches on a Windows VM, as directly received by the API", + ) + + linux_parameters = cls._args_schema.linux_parameters + linux_parameters.classifications_to_include = AAZListArg( + options=["classifications-to-include"], + help="The update classifications to select when installing patches for Linux.", + ) + linux_parameters.package_name_masks_to_exclude = AAZListArg( + options=["package-name-masks-to-exclude"], + help="packages to exclude in the patch operation. Format: packageName_packageVersion", + ) + linux_parameters.package_name_masks_to_include = AAZListArg( + options=["package-name-masks-to-include"], + help="packages to include in the patch operation. Format: packageName_packageVersion", + ) + + classifications_to_include = cls._args_schema.linux_parameters.classifications_to_include + classifications_to_include.Element = AAZStrArg( + enum={"Critical": "Critical", "Other": "Other", "Security": "Security"}, + ) + + package_name_masks_to_exclude = cls._args_schema.linux_parameters.package_name_masks_to_exclude + package_name_masks_to_exclude.Element = AAZStrArg() + + package_name_masks_to_include = cls._args_schema.linux_parameters.package_name_masks_to_include + package_name_masks_to_include.Element = AAZStrArg() + + windows_parameters = cls._args_schema.windows_parameters + windows_parameters.classifications_to_include = AAZListArg( + options=["classifications-to-include"], + help="The update classifications to select when installing patches for Windows.", + ) + windows_parameters.exclude_kbs_requiring_reboot = AAZBoolArg( + options=["exclude-kbs-requiring-reboot"], + help="Filters out Kbs that don't have an InstallationRebootBehavior of 'NeverReboots' when this is set to true.", + ) + windows_parameters.kb_numbers_to_exclude = AAZListArg( + options=["kb-numbers-to-exclude"], + help="Kbs to exclude in the patch operation", + ) + windows_parameters.kb_numbers_to_include = AAZListArg( + options=["kb-numbers-to-include"], + help="Kbs to include in the patch operation", + ) + windows_parameters.max_patch_publish_date = AAZDateTimeArg( + options=["max-patch-publish-date"], + help="This is used to install patches that were published on or before this given max published date.", + ) + + classifications_to_include = cls._args_schema.windows_parameters.classifications_to_include + classifications_to_include.Element = AAZStrArg( + enum={"Critical": "Critical", "Definition": "Definition", "FeaturePack": "FeaturePack", "Security": "Security", "ServicePack": "ServicePack", "Tools": "Tools", "UpdateRollUp": "UpdateRollUp", "Updates": "Updates"}, + ) + + kb_numbers_to_exclude = cls._args_schema.windows_parameters.kb_numbers_to_exclude + kb_numbers_to_exclude.Element = AAZStrArg() + + kb_numbers_to_include = cls._args_schema.windows_parameters.kb_numbers_to_include + kb_numbers_to_include.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.MachinesInstallPatches(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 MachinesInstallPatches(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/installPatches", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "name", self.ctx.args.name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-27", + 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("linuxParameters", AAZObjectType, ".linux_parameters") + _builder.set_prop("maximumDuration", AAZStrType, ".maximum_duration", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("rebootSetting", AAZStrType, ".reboot_setting", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("windowsParameters", AAZObjectType, ".windows_parameters") + + linux_parameters = _builder.get(".linuxParameters") + if linux_parameters is not None: + linux_parameters.set_prop("classificationsToInclude", AAZListType, ".classifications_to_include") + linux_parameters.set_prop("packageNameMasksToExclude", AAZListType, ".package_name_masks_to_exclude") + linux_parameters.set_prop("packageNameMasksToInclude", AAZListType, ".package_name_masks_to_include") + + classifications_to_include = _builder.get(".linuxParameters.classificationsToInclude") + if classifications_to_include is not None: + classifications_to_include.set_elements(AAZStrType, ".") + + package_name_masks_to_exclude = _builder.get(".linuxParameters.packageNameMasksToExclude") + if package_name_masks_to_exclude is not None: + package_name_masks_to_exclude.set_elements(AAZStrType, ".") + + package_name_masks_to_include = _builder.get(".linuxParameters.packageNameMasksToInclude") + if package_name_masks_to_include is not None: + package_name_masks_to_include.set_elements(AAZStrType, ".") + + windows_parameters = _builder.get(".windowsParameters") + if windows_parameters is not None: + windows_parameters.set_prop("classificationsToInclude", AAZListType, ".classifications_to_include") + windows_parameters.set_prop("excludeKbsRequiringReboot", AAZBoolType, ".exclude_kbs_requiring_reboot") + windows_parameters.set_prop("kbNumbersToExclude", AAZListType, ".kb_numbers_to_exclude") + windows_parameters.set_prop("kbNumbersToInclude", AAZListType, ".kb_numbers_to_include") + windows_parameters.set_prop("maxPatchPublishDate", AAZStrType, ".max_patch_publish_date") + + classifications_to_include = _builder.get(".windowsParameters.classificationsToInclude") + if classifications_to_include is not None: + classifications_to_include.set_elements(AAZStrType, ".") + + kb_numbers_to_exclude = _builder.get(".windowsParameters.kbNumbersToExclude") + if kb_numbers_to_exclude is not None: + kb_numbers_to_exclude.set_elements(AAZStrType, ".") + + kb_numbers_to_include = _builder.get(".windowsParameters.kbNumbersToInclude") + if kb_numbers_to_include is not None: + kb_numbers_to_include.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.error_details = AAZObjectType( + serialized_name="errorDetails", + ) + _InstallPatchesHelper._build_schema_error_detail_read(_schema_on_200.error_details) + _schema_on_200.excluded_patch_count = AAZIntType( + serialized_name="excludedPatchCount", + flags={"read_only": True}, + ) + _schema_on_200.failed_patch_count = AAZIntType( + serialized_name="failedPatchCount", + flags={"read_only": True}, + ) + _schema_on_200.installation_activity_id = AAZStrType( + serialized_name="installationActivityId", + flags={"read_only": True}, + ) + _schema_on_200.installed_patch_count = AAZIntType( + serialized_name="installedPatchCount", + flags={"read_only": True}, + ) + _schema_on_200.last_modified_date_time = AAZStrType( + serialized_name="lastModifiedDateTime", + flags={"read_only": True}, + ) + _schema_on_200.maintenance_window_exceeded = AAZBoolType( + serialized_name="maintenanceWindowExceeded", + flags={"read_only": True}, + ) + _schema_on_200.not_selected_patch_count = AAZIntType( + serialized_name="notSelectedPatchCount", + flags={"read_only": True}, + ) + _schema_on_200.os_type = AAZStrType( + serialized_name="osType", + flags={"read_only": True}, + ) + _schema_on_200.patch_service_used = AAZStrType( + serialized_name="patchServiceUsed", + flags={"read_only": True}, + ) + _schema_on_200.pending_patch_count = AAZIntType( + serialized_name="pendingPatchCount", + flags={"read_only": True}, + ) + _schema_on_200.reboot_status = AAZStrType( + serialized_name="rebootStatus", + flags={"read_only": True}, + ) + _schema_on_200.start_date_time = AAZStrType( + serialized_name="startDateTime", + flags={"read_only": True}, + ) + _schema_on_200.started_by = AAZStrType( + serialized_name="startedBy", + flags={"read_only": True}, + ) + _schema_on_200.status = AAZStrType( + flags={"read_only": True}, + ) + + return cls._schema_on_200 + + +class _InstallPatchesHelper: + """Helper class for InstallPatches""" + + _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() + + 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.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + 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__ = ["InstallPatches"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_list.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_list.py new file mode 100644 index 00000000000..5e33a7eb691 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_list.py @@ -0,0 +1,684 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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 list", +) +class List(AAZCommand): + """List all the Azure Arc-Enabled Servers in the specified resource group. + + :example: Sample command for list + az connectedmachine list --resource-group myResourceGroup + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines", "2022-12-27"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MachinesListByResourceGroup(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 MachinesListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-27", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.identity = AAZObjectType() + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.resources = AAZListType( + flags={"read_only": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _ListHelper._build_schema_system_data_read(_element.system_data) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + identity = cls._schema_on_200.value.Element.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType() + + properties = cls._schema_on_200.value.Element.properties + properties.ad_fqdn = AAZStrType( + serialized_name="adFqdn", + flags={"read_only": True}, + ) + properties.agent_configuration = AAZObjectType( + serialized_name="agentConfiguration", + flags={"read_only": True}, + ) + properties.agent_upgrade = AAZObjectType( + serialized_name="agentUpgrade", + ) + properties.agent_version = AAZStrType( + serialized_name="agentVersion", + flags={"read_only": True}, + ) + properties.client_public_key = AAZStrType( + serialized_name="clientPublicKey", + ) + properties.cloud_metadata = AAZObjectType( + serialized_name="cloudMetadata", + ) + properties.detected_properties = AAZDictType( + serialized_name="detectedProperties", + flags={"read_only": True}, + ) + properties.display_name = AAZStrType( + serialized_name="displayName", + flags={"read_only": True}, + ) + properties.dns_fqdn = AAZStrType( + serialized_name="dnsFqdn", + flags={"read_only": True}, + ) + properties.domain_name = AAZStrType( + serialized_name="domainName", + flags={"read_only": True}, + ) + properties.error_details = AAZListType( + serialized_name="errorDetails", + flags={"read_only": True}, + ) + properties.extensions = AAZListType() + properties.last_status_change = AAZStrType( + serialized_name="lastStatusChange", + flags={"read_only": True}, + ) + properties.location_data = AAZObjectType( + serialized_name="locationData", + ) + properties.machine_fqdn = AAZStrType( + serialized_name="machineFqdn", + flags={"read_only": True}, + ) + properties.mssql_discovered = AAZStrType( + serialized_name="mssqlDiscovered", + ) + properties.os_name = AAZStrType( + serialized_name="osName", + flags={"read_only": True}, + ) + properties.os_profile = AAZObjectType( + serialized_name="osProfile", + ) + properties.os_sku = AAZStrType( + serialized_name="osSku", + flags={"read_only": True}, + ) + properties.os_type = AAZStrType( + serialized_name="osType", + ) + properties.os_version = AAZStrType( + serialized_name="osVersion", + flags={"read_only": True}, + ) + properties.parent_cluster_resource_id = AAZStrType( + serialized_name="parentClusterResourceId", + ) + properties.private_link_scope_resource_id = AAZStrType( + serialized_name="privateLinkScopeResourceId", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.service_statuses = AAZObjectType( + serialized_name="serviceStatuses", + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + properties.vm_id = AAZStrType( + serialized_name="vmId", + ) + properties.vm_uuid = AAZStrType( + serialized_name="vmUuid", + flags={"read_only": True}, + ) + + agent_configuration = cls._schema_on_200.value.Element.properties.agent_configuration + agent_configuration.config_mode = AAZStrType( + serialized_name="configMode", + flags={"read_only": True}, + ) + agent_configuration.extensions_allow_list = AAZListType( + serialized_name="extensionsAllowList", + flags={"read_only": True}, + ) + agent_configuration.extensions_block_list = AAZListType( + serialized_name="extensionsBlockList", + flags={"read_only": True}, + ) + agent_configuration.extensions_enabled = AAZStrType( + serialized_name="extensionsEnabled", + flags={"read_only": True}, + ) + agent_configuration.guest_configuration_enabled = AAZStrType( + serialized_name="guestConfigurationEnabled", + flags={"read_only": True}, + ) + agent_configuration.incoming_connections_ports = AAZListType( + serialized_name="incomingConnectionsPorts", + flags={"read_only": True}, + ) + agent_configuration.proxy_bypass = AAZListType( + serialized_name="proxyBypass", + flags={"read_only": True}, + ) + agent_configuration.proxy_url = AAZStrType( + serialized_name="proxyUrl", + flags={"read_only": True}, + ) + + extensions_allow_list = cls._schema_on_200.value.Element.properties.agent_configuration.extensions_allow_list + extensions_allow_list.Element = AAZObjectType() + _ListHelper._build_schema_configuration_extension_read(extensions_allow_list.Element) + + extensions_block_list = cls._schema_on_200.value.Element.properties.agent_configuration.extensions_block_list + extensions_block_list.Element = AAZObjectType() + _ListHelper._build_schema_configuration_extension_read(extensions_block_list.Element) + + incoming_connections_ports = cls._schema_on_200.value.Element.properties.agent_configuration.incoming_connections_ports + incoming_connections_ports.Element = AAZStrType() + + proxy_bypass = cls._schema_on_200.value.Element.properties.agent_configuration.proxy_bypass + proxy_bypass.Element = AAZStrType() + + agent_upgrade = cls._schema_on_200.value.Element.properties.agent_upgrade + agent_upgrade.correlation_id = AAZStrType( + serialized_name="correlationId", + ) + agent_upgrade.desired_version = AAZStrType( + serialized_name="desiredVersion", + ) + agent_upgrade.enable_automatic_upgrade = AAZBoolType( + serialized_name="enableAutomaticUpgrade", + ) + agent_upgrade.last_attempt_message = AAZStrType( + serialized_name="lastAttemptMessage", + flags={"read_only": True}, + ) + agent_upgrade.last_attempt_status = AAZStrType( + serialized_name="lastAttemptStatus", + flags={"read_only": True}, + ) + agent_upgrade.last_attempt_timestamp = AAZStrType( + serialized_name="lastAttemptTimestamp", + flags={"read_only": True}, + ) + + cloud_metadata = cls._schema_on_200.value.Element.properties.cloud_metadata + cloud_metadata.provider = AAZStrType( + flags={"read_only": True}, + ) + + detected_properties = cls._schema_on_200.value.Element.properties.detected_properties + detected_properties.Element = AAZStrType() + + error_details = cls._schema_on_200.value.Element.properties.error_details + error_details.Element = AAZObjectType() + _ListHelper._build_schema_error_detail_read(error_details.Element) + + extensions = cls._schema_on_200.value.Element.properties.extensions + extensions.Element = AAZObjectType() + _ListHelper._build_schema_machine_extension_instance_view_read(extensions.Element) + + location_data = cls._schema_on_200.value.Element.properties.location_data + location_data.city = AAZStrType() + location_data.country_or_region = AAZStrType( + serialized_name="countryOrRegion", + ) + location_data.district = AAZStrType() + location_data.name = AAZStrType( + flags={"required": True}, + ) + + os_profile = cls._schema_on_200.value.Element.properties.os_profile + os_profile.computer_name = AAZStrType( + serialized_name="computerName", + flags={"read_only": True}, + ) + os_profile.linux_configuration = AAZObjectType( + serialized_name="linuxConfiguration", + ) + os_profile.windows_configuration = AAZObjectType( + serialized_name="windowsConfiguration", + ) + + linux_configuration = cls._schema_on_200.value.Element.properties.os_profile.linux_configuration + linux_configuration.patch_settings = AAZObjectType( + serialized_name="patchSettings", + flags={"client_flatten": True}, + ) + _ListHelper._build_schema_patch_settings_read(linux_configuration.patch_settings) + + windows_configuration = cls._schema_on_200.value.Element.properties.os_profile.windows_configuration + windows_configuration.patch_settings = AAZObjectType( + serialized_name="patchSettings", + flags={"client_flatten": True}, + ) + _ListHelper._build_schema_patch_settings_read(windows_configuration.patch_settings) + + service_statuses = cls._schema_on_200.value.Element.properties.service_statuses + service_statuses.extension_service = AAZObjectType( + serialized_name="extensionService", + ) + _ListHelper._build_schema_service_status_read(service_statuses.extension_service) + service_statuses.guest_configuration_service = AAZObjectType( + serialized_name="guestConfigurationService", + ) + _ListHelper._build_schema_service_status_read(service_statuses.guest_configuration_service) + + resources = cls._schema_on_200.value.Element.resources + resources.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.resources.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _ListHelper._build_schema_system_data_read(_element.system_data) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.resources.Element.properties + properties.auto_upgrade_minor_version = AAZBoolType( + serialized_name="autoUpgradeMinorVersion", + ) + properties.enable_automatic_upgrade = AAZBoolType( + serialized_name="enableAutomaticUpgrade", + ) + properties.force_update_tag = AAZStrType( + serialized_name="forceUpdateTag", + ) + properties.instance_view = AAZObjectType( + serialized_name="instanceView", + ) + _ListHelper._build_schema_machine_extension_instance_view_read(properties.instance_view) + properties.protected_settings = AAZFreeFormDictType( + serialized_name="protectedSettings", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.publisher = AAZStrType() + properties.settings = AAZFreeFormDictType() + properties.type = AAZStrType() + properties.type_handler_version = AAZStrType( + serialized_name="typeHandlerVersion", + ) + + tags = cls._schema_on_200.value.Element.resources.Element.tags + tags.Element = AAZStrType() + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + _schema_configuration_extension_read = None + + @classmethod + def _build_schema_configuration_extension_read(cls, _schema): + if cls._schema_configuration_extension_read is not None: + _schema.publisher = cls._schema_configuration_extension_read.publisher + _schema.type = cls._schema_configuration_extension_read.type + return + + cls._schema_configuration_extension_read = _schema_configuration_extension_read = AAZObjectType() + + configuration_extension_read = _schema_configuration_extension_read + configuration_extension_read.publisher = AAZStrType( + flags={"read_only": True}, + ) + configuration_extension_read.type = AAZStrType( + flags={"read_only": True}, + ) + + _schema.publisher = cls._schema_configuration_extension_read.publisher + _schema.type = cls._schema_configuration_extension_read.type + + _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() + + 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.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + 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_machine_extension_instance_view_read = None + + @classmethod + def _build_schema_machine_extension_instance_view_read(cls, _schema): + if cls._schema_machine_extension_instance_view_read is not None: + _schema.name = cls._schema_machine_extension_instance_view_read.name + _schema.status = cls._schema_machine_extension_instance_view_read.status + _schema.type = cls._schema_machine_extension_instance_view_read.type + _schema.type_handler_version = cls._schema_machine_extension_instance_view_read.type_handler_version + return + + cls._schema_machine_extension_instance_view_read = _schema_machine_extension_instance_view_read = AAZObjectType() + + machine_extension_instance_view_read = _schema_machine_extension_instance_view_read + machine_extension_instance_view_read.name = AAZStrType() + machine_extension_instance_view_read.status = AAZObjectType() + machine_extension_instance_view_read.type = AAZStrType() + machine_extension_instance_view_read.type_handler_version = AAZStrType( + serialized_name="typeHandlerVersion", + ) + + status = _schema_machine_extension_instance_view_read.status + status.code = AAZStrType() + status.display_status = AAZStrType( + serialized_name="displayStatus", + ) + status.level = AAZStrType() + status.message = AAZStrType() + status.time = AAZStrType() + + _schema.name = cls._schema_machine_extension_instance_view_read.name + _schema.status = cls._schema_machine_extension_instance_view_read.status + _schema.type = cls._schema_machine_extension_instance_view_read.type + _schema.type_handler_version = cls._schema_machine_extension_instance_view_read.type_handler_version + + _schema_patch_settings_read = None + + @classmethod + def _build_schema_patch_settings_read(cls, _schema): + if cls._schema_patch_settings_read is not None: + _schema.assessment_mode = cls._schema_patch_settings_read.assessment_mode + _schema.patch_mode = cls._schema_patch_settings_read.patch_mode + return + + cls._schema_patch_settings_read = _schema_patch_settings_read = AAZObjectType() + + patch_settings_read = _schema_patch_settings_read + patch_settings_read.assessment_mode = AAZStrType( + serialized_name="assessmentMode", + ) + patch_settings_read.patch_mode = AAZStrType( + serialized_name="patchMode", + ) + + _schema.assessment_mode = cls._schema_patch_settings_read.assessment_mode + _schema.patch_mode = cls._schema_patch_settings_read.patch_mode + + _schema_service_status_read = None + + @classmethod + def _build_schema_service_status_read(cls, _schema): + if cls._schema_service_status_read is not None: + _schema.startup_type = cls._schema_service_status_read.startup_type + _schema.status = cls._schema_service_status_read.status + return + + cls._schema_service_status_read = _schema_service_status_read = AAZObjectType() + + service_status_read = _schema_service_status_read + service_status_read.startup_type = AAZStrType( + serialized_name="startupType", + ) + service_status_read.status = AAZStrType() + + _schema.startup_type = cls._schema_service_status_read.startup_type + _schema.status = cls._schema_service_status_read.status + + _schema_system_data_read = None + + @classmethod + def _build_schema_system_data_read(cls, _schema): + if cls._schema_system_data_read is not None: + _schema.created_at = cls._schema_system_data_read.created_at + _schema.created_by = cls._schema_system_data_read.created_by + _schema.created_by_type = cls._schema_system_data_read.created_by_type + _schema.last_modified_at = cls._schema_system_data_read.last_modified_at + _schema.last_modified_by = cls._schema_system_data_read.last_modified_by + _schema.last_modified_by_type = cls._schema_system_data_read.last_modified_by_type + return + + cls._schema_system_data_read = _schema_system_data_read = AAZObjectType( + flags={"read_only": True} + ) + + system_data_read = _schema_system_data_read + system_data_read.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data_read.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data_read.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data_read.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data_read.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data_read.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + _schema.created_at = cls._schema_system_data_read.created_at + _schema.created_by = cls._schema_system_data_read.created_by + _schema.created_by_type = cls._schema_system_data_read.created_by_type + _schema.last_modified_at = cls._schema_system_data_read.last_modified_at + _schema.last_modified_by = cls._schema_system_data_read.last_modified_by + _schema.last_modified_by_type = cls._schema_system_data_read.last_modified_by_type + + +__all__ = ["List"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_show.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_show.py new file mode 100644 index 00000000000..b97c8fe8484 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_show.py @@ -0,0 +1,696 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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 show", +) +class Show(AAZCommand): + """Get information about the model view or the instance view of an Azure Arc-Enabled Server. + + :example: Sample command for show + az connectedmachine show --name myMachine --resource-group myResourceGroup + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}", "2022-12-27"], + ] + } + + 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=["-n", "--name", "--machine-name"], + help="The name of the hybrid machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-_\.]{1,54}$", + max_length=54, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.expand = AAZStrArg( + options=["--expand"], + help="The expand expression to apply on the operation.", + enum={"instanceView": "instanceView"}, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MachinesGet(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 MachinesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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}", + **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", "2022-12-27", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.identity = AAZObjectType() + _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.resources = AAZListType( + flags={"read_only": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _ShowHelper._build_schema_system_data_read(_schema_on_200.system_data) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + identity = cls._schema_on_200.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType() + + properties = cls._schema_on_200.properties + properties.ad_fqdn = AAZStrType( + serialized_name="adFqdn", + flags={"read_only": True}, + ) + properties.agent_configuration = AAZObjectType( + serialized_name="agentConfiguration", + flags={"read_only": True}, + ) + properties.agent_upgrade = AAZObjectType( + serialized_name="agentUpgrade", + ) + properties.agent_version = AAZStrType( + serialized_name="agentVersion", + flags={"read_only": True}, + ) + properties.client_public_key = AAZStrType( + serialized_name="clientPublicKey", + ) + properties.cloud_metadata = AAZObjectType( + serialized_name="cloudMetadata", + ) + properties.detected_properties = AAZDictType( + serialized_name="detectedProperties", + flags={"read_only": True}, + ) + properties.display_name = AAZStrType( + serialized_name="displayName", + flags={"read_only": True}, + ) + properties.dns_fqdn = AAZStrType( + serialized_name="dnsFqdn", + flags={"read_only": True}, + ) + properties.domain_name = AAZStrType( + serialized_name="domainName", + flags={"read_only": True}, + ) + properties.error_details = AAZListType( + serialized_name="errorDetails", + flags={"read_only": True}, + ) + properties.extensions = AAZListType() + properties.last_status_change = AAZStrType( + serialized_name="lastStatusChange", + flags={"read_only": True}, + ) + properties.location_data = AAZObjectType( + serialized_name="locationData", + ) + properties.machine_fqdn = AAZStrType( + serialized_name="machineFqdn", + flags={"read_only": True}, + ) + properties.mssql_discovered = AAZStrType( + serialized_name="mssqlDiscovered", + ) + properties.os_name = AAZStrType( + serialized_name="osName", + flags={"read_only": True}, + ) + properties.os_profile = AAZObjectType( + serialized_name="osProfile", + ) + properties.os_sku = AAZStrType( + serialized_name="osSku", + flags={"read_only": True}, + ) + properties.os_type = AAZStrType( + serialized_name="osType", + ) + properties.os_version = AAZStrType( + serialized_name="osVersion", + flags={"read_only": True}, + ) + properties.parent_cluster_resource_id = AAZStrType( + serialized_name="parentClusterResourceId", + ) + properties.private_link_scope_resource_id = AAZStrType( + serialized_name="privateLinkScopeResourceId", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.service_statuses = AAZObjectType( + serialized_name="serviceStatuses", + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + properties.vm_id = AAZStrType( + serialized_name="vmId", + ) + properties.vm_uuid = AAZStrType( + serialized_name="vmUuid", + flags={"read_only": True}, + ) + + agent_configuration = cls._schema_on_200.properties.agent_configuration + agent_configuration.config_mode = AAZStrType( + serialized_name="configMode", + flags={"read_only": True}, + ) + agent_configuration.extensions_allow_list = AAZListType( + serialized_name="extensionsAllowList", + flags={"read_only": True}, + ) + agent_configuration.extensions_block_list = AAZListType( + serialized_name="extensionsBlockList", + flags={"read_only": True}, + ) + agent_configuration.extensions_enabled = AAZStrType( + serialized_name="extensionsEnabled", + flags={"read_only": True}, + ) + agent_configuration.guest_configuration_enabled = AAZStrType( + serialized_name="guestConfigurationEnabled", + flags={"read_only": True}, + ) + agent_configuration.incoming_connections_ports = AAZListType( + serialized_name="incomingConnectionsPorts", + flags={"read_only": True}, + ) + agent_configuration.proxy_bypass = AAZListType( + serialized_name="proxyBypass", + flags={"read_only": True}, + ) + agent_configuration.proxy_url = AAZStrType( + serialized_name="proxyUrl", + flags={"read_only": True}, + ) + + extensions_allow_list = cls._schema_on_200.properties.agent_configuration.extensions_allow_list + extensions_allow_list.Element = AAZObjectType() + _ShowHelper._build_schema_configuration_extension_read(extensions_allow_list.Element) + + extensions_block_list = cls._schema_on_200.properties.agent_configuration.extensions_block_list + extensions_block_list.Element = AAZObjectType() + _ShowHelper._build_schema_configuration_extension_read(extensions_block_list.Element) + + incoming_connections_ports = cls._schema_on_200.properties.agent_configuration.incoming_connections_ports + incoming_connections_ports.Element = AAZStrType() + + proxy_bypass = cls._schema_on_200.properties.agent_configuration.proxy_bypass + proxy_bypass.Element = AAZStrType() + + agent_upgrade = cls._schema_on_200.properties.agent_upgrade + agent_upgrade.correlation_id = AAZStrType( + serialized_name="correlationId", + ) + agent_upgrade.desired_version = AAZStrType( + serialized_name="desiredVersion", + ) + agent_upgrade.enable_automatic_upgrade = AAZBoolType( + serialized_name="enableAutomaticUpgrade", + ) + agent_upgrade.last_attempt_message = AAZStrType( + serialized_name="lastAttemptMessage", + flags={"read_only": True}, + ) + agent_upgrade.last_attempt_status = AAZStrType( + serialized_name="lastAttemptStatus", + flags={"read_only": True}, + ) + agent_upgrade.last_attempt_timestamp = AAZStrType( + serialized_name="lastAttemptTimestamp", + flags={"read_only": True}, + ) + + cloud_metadata = cls._schema_on_200.properties.cloud_metadata + cloud_metadata.provider = AAZStrType( + flags={"read_only": True}, + ) + + detected_properties = cls._schema_on_200.properties.detected_properties + detected_properties.Element = AAZStrType() + + error_details = cls._schema_on_200.properties.error_details + error_details.Element = AAZObjectType() + _ShowHelper._build_schema_error_detail_read(error_details.Element) + + extensions = cls._schema_on_200.properties.extensions + extensions.Element = AAZObjectType() + _ShowHelper._build_schema_machine_extension_instance_view_read(extensions.Element) + + location_data = cls._schema_on_200.properties.location_data + location_data.city = AAZStrType() + location_data.country_or_region = AAZStrType( + serialized_name="countryOrRegion", + ) + location_data.district = AAZStrType() + location_data.name = AAZStrType( + flags={"required": True}, + ) + + os_profile = cls._schema_on_200.properties.os_profile + os_profile.computer_name = AAZStrType( + serialized_name="computerName", + flags={"read_only": True}, + ) + os_profile.linux_configuration = AAZObjectType( + serialized_name="linuxConfiguration", + ) + os_profile.windows_configuration = AAZObjectType( + serialized_name="windowsConfiguration", + ) + + linux_configuration = cls._schema_on_200.properties.os_profile.linux_configuration + linux_configuration.patch_settings = AAZObjectType( + serialized_name="patchSettings", + flags={"client_flatten": True}, + ) + _ShowHelper._build_schema_patch_settings_read(linux_configuration.patch_settings) + + windows_configuration = cls._schema_on_200.properties.os_profile.windows_configuration + windows_configuration.patch_settings = AAZObjectType( + serialized_name="patchSettings", + flags={"client_flatten": True}, + ) + _ShowHelper._build_schema_patch_settings_read(windows_configuration.patch_settings) + + service_statuses = cls._schema_on_200.properties.service_statuses + service_statuses.extension_service = AAZObjectType( + serialized_name="extensionService", + ) + _ShowHelper._build_schema_service_status_read(service_statuses.extension_service) + service_statuses.guest_configuration_service = AAZObjectType( + serialized_name="guestConfigurationService", + ) + _ShowHelper._build_schema_service_status_read(service_statuses.guest_configuration_service) + + resources = cls._schema_on_200.resources + resources.Element = AAZObjectType() + + _element = cls._schema_on_200.resources.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _ShowHelper._build_schema_system_data_read(_element.system_data) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.resources.Element.properties + properties.auto_upgrade_minor_version = AAZBoolType( + serialized_name="autoUpgradeMinorVersion", + ) + properties.enable_automatic_upgrade = AAZBoolType( + serialized_name="enableAutomaticUpgrade", + ) + properties.force_update_tag = AAZStrType( + serialized_name="forceUpdateTag", + ) + properties.instance_view = AAZObjectType( + serialized_name="instanceView", + ) + _ShowHelper._build_schema_machine_extension_instance_view_read(properties.instance_view) + properties.protected_settings = AAZFreeFormDictType( + serialized_name="protectedSettings", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.publisher = AAZStrType() + properties.settings = AAZFreeFormDictType() + properties.type = AAZStrType() + properties.type_handler_version = AAZStrType( + serialized_name="typeHandlerVersion", + ) + + tags = cls._schema_on_200.resources.Element.tags + tags.Element = AAZStrType() + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + _schema_configuration_extension_read = None + + @classmethod + def _build_schema_configuration_extension_read(cls, _schema): + if cls._schema_configuration_extension_read is not None: + _schema.publisher = cls._schema_configuration_extension_read.publisher + _schema.type = cls._schema_configuration_extension_read.type + return + + cls._schema_configuration_extension_read = _schema_configuration_extension_read = AAZObjectType() + + configuration_extension_read = _schema_configuration_extension_read + configuration_extension_read.publisher = AAZStrType( + flags={"read_only": True}, + ) + configuration_extension_read.type = AAZStrType( + flags={"read_only": True}, + ) + + _schema.publisher = cls._schema_configuration_extension_read.publisher + _schema.type = cls._schema_configuration_extension_read.type + + _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() + + 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.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + 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_machine_extension_instance_view_read = None + + @classmethod + def _build_schema_machine_extension_instance_view_read(cls, _schema): + if cls._schema_machine_extension_instance_view_read is not None: + _schema.name = cls._schema_machine_extension_instance_view_read.name + _schema.status = cls._schema_machine_extension_instance_view_read.status + _schema.type = cls._schema_machine_extension_instance_view_read.type + _schema.type_handler_version = cls._schema_machine_extension_instance_view_read.type_handler_version + return + + cls._schema_machine_extension_instance_view_read = _schema_machine_extension_instance_view_read = AAZObjectType() + + machine_extension_instance_view_read = _schema_machine_extension_instance_view_read + machine_extension_instance_view_read.name = AAZStrType() + machine_extension_instance_view_read.status = AAZObjectType() + machine_extension_instance_view_read.type = AAZStrType() + machine_extension_instance_view_read.type_handler_version = AAZStrType( + serialized_name="typeHandlerVersion", + ) + + status = _schema_machine_extension_instance_view_read.status + status.code = AAZStrType() + status.display_status = AAZStrType( + serialized_name="displayStatus", + ) + status.level = AAZStrType() + status.message = AAZStrType() + status.time = AAZStrType() + + _schema.name = cls._schema_machine_extension_instance_view_read.name + _schema.status = cls._schema_machine_extension_instance_view_read.status + _schema.type = cls._schema_machine_extension_instance_view_read.type + _schema.type_handler_version = cls._schema_machine_extension_instance_view_read.type_handler_version + + _schema_patch_settings_read = None + + @classmethod + def _build_schema_patch_settings_read(cls, _schema): + if cls._schema_patch_settings_read is not None: + _schema.assessment_mode = cls._schema_patch_settings_read.assessment_mode + _schema.patch_mode = cls._schema_patch_settings_read.patch_mode + return + + cls._schema_patch_settings_read = _schema_patch_settings_read = AAZObjectType() + + patch_settings_read = _schema_patch_settings_read + patch_settings_read.assessment_mode = AAZStrType( + serialized_name="assessmentMode", + ) + patch_settings_read.patch_mode = AAZStrType( + serialized_name="patchMode", + ) + + _schema.assessment_mode = cls._schema_patch_settings_read.assessment_mode + _schema.patch_mode = cls._schema_patch_settings_read.patch_mode + + _schema_service_status_read = None + + @classmethod + def _build_schema_service_status_read(cls, _schema): + if cls._schema_service_status_read is not None: + _schema.startup_type = cls._schema_service_status_read.startup_type + _schema.status = cls._schema_service_status_read.status + return + + cls._schema_service_status_read = _schema_service_status_read = AAZObjectType() + + service_status_read = _schema_service_status_read + service_status_read.startup_type = AAZStrType( + serialized_name="startupType", + ) + service_status_read.status = AAZStrType() + + _schema.startup_type = cls._schema_service_status_read.startup_type + _schema.status = cls._schema_service_status_read.status + + _schema_system_data_read = None + + @classmethod + def _build_schema_system_data_read(cls, _schema): + if cls._schema_system_data_read is not None: + _schema.created_at = cls._schema_system_data_read.created_at + _schema.created_by = cls._schema_system_data_read.created_by + _schema.created_by_type = cls._schema_system_data_read.created_by_type + _schema.last_modified_at = cls._schema_system_data_read.last_modified_at + _schema.last_modified_by = cls._schema_system_data_read.last_modified_by + _schema.last_modified_by_type = cls._schema_system_data_read.last_modified_by_type + return + + cls._schema_system_data_read = _schema_system_data_read = AAZObjectType( + flags={"read_only": True} + ) + + system_data_read = _schema_system_data_read + system_data_read.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data_read.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data_read.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data_read.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data_read.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data_read.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + _schema.created_at = cls._schema_system_data_read.created_at + _schema.created_by = cls._schema_system_data_read.created_by + _schema.created_by_type = cls._schema_system_data_read.created_by_type + _schema.last_modified_at = cls._schema_system_data_read.last_modified_at + _schema.last_modified_by = cls._schema_system_data_read.last_modified_by + _schema.last_modified_by_type = cls._schema_system_data_read.last_modified_by_type + + +__all__ = ["Show"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_update.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_update.py new file mode 100644 index 00000000000..dc61a313bfb --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_update.py @@ -0,0 +1,1233 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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 update", +) +class Update(AAZCommand): + """Update an Azure Arc-Enabled Server. Please note some properties can be set only during machine creation. + + :example: Sample command for update + az connectedmachine update --name myMachine --resource-group myResourceGroup --location eastus2euap + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}", "2022-12-27"], + ] + } + + AZ_SUPPORT_GENERIC_UPDATE = True + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.machine_name = AAZStrArg( + options=["-n", "--name", "--machine-name"], + help="The name of the hybrid machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-_\.]{1,54}$", + max_length=54, + min_length=1, + ), + ) + + _args_schema.location = AAZStrArg( + options=["--location"], + help="The location of the hybrid machine.", + required=True, + ) + + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Parameters" + + _args_schema = cls._args_schema + _args_schema.identity = AAZObjectArg( + options=["--identity"], + arg_group="Parameters", + help="Identity for the resource.", + nullable=True, + ) + + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Parameters", + help="Resource tags.", + nullable=True, + ) + + identity = cls._args_schema.identity + identity.type = AAZStrArg( + options=["type"], + help="The identity type.", + nullable=True, + enum={"SystemAssigned": "SystemAssigned"}, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg( + nullable=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.agent_upgrade = AAZObjectArg( + options=["--agent-upgrade"], + arg_group="Properties", + help="The info of the machine w.r.t Agent Upgrade", + nullable=True, + ) + _args_schema.client_public_key = AAZStrArg( + options=["--client-public-key"], + arg_group="Properties", + help="Public Key that the client provides to be used during initial resource onboarding", + nullable=True, + ) + _args_schema.extensions = AAZListArg( + options=["--extensions"], + arg_group="Properties", + help="Machine Extensions information (deprecated field)", + nullable=True, + ) + _args_schema.location_data = AAZObjectArg( + options=["--location-data"], + arg_group="Properties", + help="Metadata pertaining to the geographic location of the resource.", + nullable=True, + ) + _args_schema.mssql_discovered = AAZStrArg( + options=["--mssql-discovered"], + arg_group="Properties", + help="Specifies whether any MS SQL instance is discovered on the machine.", + nullable=True, + ) + _args_schema.os_profile = AAZObjectArg( + options=["--os-profile"], + arg_group="Properties", + help="Specifies the operating system settings for the hybrid machine.", + nullable=True, + ) + _args_schema.os_type = AAZStrArg( + options=["--os-type"], + arg_group="Properties", + help="The type of Operating System (windows/linux).", + nullable=True, + ) + _args_schema.parent_cluster_resource_id = AAZStrArg( + options=["--parent-cluster-id"], + arg_group="Properties", + help="The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any.", + nullable=True, + ) + _args_schema.private_link_scope_resource_id = AAZStrArg( + options=["--private-scope-id"], + arg_group="Properties", + help="The resource id of the private link scope this machine is assigned to, if any.", + nullable=True, + ) + _args_schema.service_statuses = AAZObjectArg( + options=["--service-statuses"], + arg_group="Properties", + help="Statuses of dependent services that are reported back to ARM.", + nullable=True, + ) + + agent_upgrade = cls._args_schema.agent_upgrade + agent_upgrade.correlation_id = AAZStrArg( + options=["correlation-id"], + help="The correlation ID passed in from RSM per upgrade.", + nullable=True, + ) + agent_upgrade.desired_version = AAZStrArg( + options=["desired-version"], + help="Specifies the version info w.r.t AgentUpgrade for the machine.", + nullable=True, + ) + agent_upgrade.enable_automatic_upgrade = AAZBoolArg( + options=["enable-automatic-upgrade"], + help="Specifies if RSM should try to upgrade this machine", + nullable=True, + ) + + extensions = cls._args_schema.extensions + extensions.Element = AAZObjectArg( + nullable=True, + ) + + _element = cls._args_schema.extensions.Element + _element.name = AAZStrArg( + options=["name"], + help="The machine extension name.", + nullable=True, + ) + _element.status = AAZObjectArg( + options=["status"], + help="Instance view status.", + nullable=True, + ) + _element.type = AAZStrArg( + options=["type"], + help="Specifies the type of the extension; an example is \"CustomScriptExtension\".", + nullable=True, + ) + _element.type_handler_version = AAZStrArg( + options=["type-handler-version"], + help="Specifies the version of the script handler.", + nullable=True, + ) + + status = cls._args_schema.extensions.Element.status + status.code = AAZStrArg( + options=["code"], + help="The status code.", + nullable=True, + ) + status.display_status = AAZStrArg( + options=["display-status"], + help="The short localizable label for the status.", + nullable=True, + ) + status.level = AAZStrArg( + options=["level"], + help="The level code.", + nullable=True, + enum={"Error": "Error", "Info": "Info", "Warning": "Warning"}, + ) + status.message = AAZStrArg( + options=["message"], + help="The detailed status message, including for alerts and error messages.", + nullable=True, + ) + status.time = AAZDateTimeArg( + options=["time"], + help="The time of the status.", + nullable=True, + ) + + location_data = cls._args_schema.location_data + location_data.city = AAZStrArg( + options=["city"], + help="The city or locality where the resource is located.", + nullable=True, + ) + location_data.country_or_region = AAZStrArg( + options=["country-or-region"], + help="The country or region where the resource is located", + nullable=True, + ) + location_data.district = AAZStrArg( + options=["district"], + help="The district, state, or province where the resource is located.", + nullable=True, + ) + location_data.name = AAZStrArg( + options=["name"], + help="A canonical name for the geographic or physical location.", + fmt=AAZStrArgFormat( + max_length=256, + ), + ) + + os_profile = cls._args_schema.os_profile + os_profile.linux_configuration = AAZObjectArg( + options=["linux-configuration"], + help="Specifies the linux configuration for update management.", + nullable=True, + ) + os_profile.windows_configuration = AAZObjectArg( + options=["windows-configuration"], + help="Specifies the windows configuration for update management.", + nullable=True, + ) + + linux_configuration = cls._args_schema.os_profile.linux_configuration + linux_configuration.patch_settings = AAZObjectArg( + options=["patch-settings"], + nullable=True, + ) + cls._build_args_patch_settings_update(linux_configuration.patch_settings) + + windows_configuration = cls._args_schema.os_profile.windows_configuration + windows_configuration.patch_settings = AAZObjectArg( + options=["patch-settings"], + help="Specifies the patch settings.", + nullable=True, + ) + cls._build_args_patch_settings_update(windows_configuration.patch_settings) + + service_statuses = cls._args_schema.service_statuses + service_statuses.extension_service = AAZObjectArg( + options=["extension-service"], + help="The state of the extension service on the Arc-enabled machine.", + nullable=True, + ) + cls._build_args_service_status_update(service_statuses.extension_service) + service_statuses.guest_configuration_service = AAZObjectArg( + options=["guest-configuration-service"], + help="The state of the guest configuration service on the Arc-enabled machine.", + nullable=True, + ) + cls._build_args_service_status_update(service_statuses.guest_configuration_service) + return cls._args_schema + + _args_patch_settings_update = None + + @classmethod + def _build_args_patch_settings_update(cls, _schema): + if cls._args_patch_settings_update is not None: + _schema.assessment_mode = cls._args_patch_settings_update.assessment_mode + _schema.patch_mode = cls._args_patch_settings_update.patch_mode + return + + cls._args_patch_settings_update = AAZObjectArg( + nullable=True, + ) + + patch_settings_update = cls._args_patch_settings_update + patch_settings_update.assessment_mode = AAZStrArg( + options=["assessment-mode"], + help="Specifies the assessment mode.", + nullable=True, + enum={"AutomaticByPlatform": "AutomaticByPlatform", "ImageDefault": "ImageDefault"}, + ) + patch_settings_update.patch_mode = AAZStrArg( + options=["patch-mode"], + help="Specifies the patch mode.", + nullable=True, + enum={"AutomaticByOS": "AutomaticByOS", "AutomaticByPlatform": "AutomaticByPlatform", "ImageDefault": "ImageDefault", "Manual": "Manual"}, + ) + + _schema.assessment_mode = cls._args_patch_settings_update.assessment_mode + _schema.patch_mode = cls._args_patch_settings_update.patch_mode + + _args_service_status_update = None + + @classmethod + def _build_args_service_status_update(cls, _schema): + if cls._args_service_status_update is not None: + _schema.startup_type = cls._args_service_status_update.startup_type + _schema.status = cls._args_service_status_update.status + return + + cls._args_service_status_update = AAZObjectArg( + nullable=True, + ) + + service_status_update = cls._args_service_status_update + service_status_update.startup_type = AAZStrArg( + options=["startup-type"], + help="The behavior of the service when the Arc-enabled machine starts up.", + nullable=True, + ) + service_status_update.status = AAZStrArg( + options=["status"], + help="The current status of the service.", + nullable=True, + ) + + _schema.startup_type = cls._args_service_status_update.startup_type + _schema.status = cls._args_service_status_update.status + + def _execute_operations(self): + self.pre_operations() + self.MachinesGet(ctx=self.ctx)() + self.pre_instance_update(self.ctx.vars.instance) + self.InstanceUpdateByJson(ctx=self.ctx)() + self.InstanceUpdateByGeneric(ctx=self.ctx)() + self.post_instance_update(self.ctx.vars.instance) + self.MachinesCreateOrUpdate(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 MachinesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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}", + **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", "2022-12-27", + 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_read(cls._schema_on_200) + + return cls._schema_on_200 + + class MachinesCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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}", + **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( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-27", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + value=self.ctx.vars.instance, + ) + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + _UpdateHelper._build_schema_machine_read(cls._schema_on_200) + + return cls._schema_on_200 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("identity", AAZObjectType, ".identity") + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + identity = _builder.get(".identity") + if identity is not None: + identity.set_prop("type", AAZStrType, ".type") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("agentUpgrade", AAZObjectType, ".agent_upgrade") + properties.set_prop("clientPublicKey", AAZStrType, ".client_public_key") + properties.set_prop("extensions", AAZListType, ".extensions") + properties.set_prop("locationData", AAZObjectType, ".location_data") + properties.set_prop("mssqlDiscovered", AAZStrType, ".mssql_discovered") + properties.set_prop("osProfile", AAZObjectType, ".os_profile") + properties.set_prop("osType", AAZStrType, ".os_type") + properties.set_prop("parentClusterResourceId", AAZStrType, ".parent_cluster_resource_id") + properties.set_prop("privateLinkScopeResourceId", AAZStrType, ".private_link_scope_resource_id") + properties.set_prop("serviceStatuses", AAZObjectType, ".service_statuses") + + agent_upgrade = _builder.get(".properties.agentUpgrade") + if agent_upgrade is not None: + agent_upgrade.set_prop("correlationId", AAZStrType, ".correlation_id") + agent_upgrade.set_prop("desiredVersion", AAZStrType, ".desired_version") + agent_upgrade.set_prop("enableAutomaticUpgrade", AAZBoolType, ".enable_automatic_upgrade") + + extensions = _builder.get(".properties.extensions") + if extensions is not None: + extensions.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.extensions[]") + if _elements is not None: + _elements.set_prop("name", AAZStrType, ".name") + _elements.set_prop("status", AAZObjectType, ".status") + _elements.set_prop("type", AAZStrType, ".type") + _elements.set_prop("typeHandlerVersion", AAZStrType, ".type_handler_version") + + status = _builder.get(".properties.extensions[].status") + if status is not None: + status.set_prop("code", AAZStrType, ".code") + status.set_prop("displayStatus", AAZStrType, ".display_status") + status.set_prop("level", AAZStrType, ".level") + status.set_prop("message", AAZStrType, ".message") + status.set_prop("time", AAZStrType, ".time") + + location_data = _builder.get(".properties.locationData") + if location_data is not None: + location_data.set_prop("city", AAZStrType, ".city") + location_data.set_prop("countryOrRegion", AAZStrType, ".country_or_region") + location_data.set_prop("district", AAZStrType, ".district") + location_data.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) + + os_profile = _builder.get(".properties.osProfile") + if os_profile is not None: + os_profile.set_prop("linuxConfiguration", AAZObjectType, ".linux_configuration") + os_profile.set_prop("windowsConfiguration", AAZObjectType, ".windows_configuration") + + linux_configuration = _builder.get(".properties.osProfile.linuxConfiguration") + if linux_configuration is not None: + _UpdateHelper._build_schema_patch_settings_update(linux_configuration.set_prop("patchSettings", AAZObjectType, ".patch_settings", typ_kwargs={"flags": {"client_flatten": True}})) + + windows_configuration = _builder.get(".properties.osProfile.windowsConfiguration") + if windows_configuration is not None: + _UpdateHelper._build_schema_patch_settings_update(windows_configuration.set_prop("patchSettings", AAZObjectType, ".patch_settings", typ_kwargs={"flags": {"client_flatten": True}})) + + service_statuses = _builder.get(".properties.serviceStatuses") + if service_statuses is not None: + _UpdateHelper._build_schema_service_status_update(service_statuses.set_prop("extensionService", AAZObjectType, ".extension_service")) + _UpdateHelper._build_schema_service_status_update(service_statuses.set_prop("guestConfigurationService", AAZObjectType, ".guest_configuration_service")) + + 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_patch_settings_update(cls, _builder): + if _builder is None: + return + _builder.set_prop("assessmentMode", AAZStrType, ".assessment_mode") + _builder.set_prop("patchMode", AAZStrType, ".patch_mode") + + @classmethod + def _build_schema_service_status_update(cls, _builder): + if _builder is None: + return + _builder.set_prop("startupType", AAZStrType, ".startup_type") + _builder.set_prop("status", AAZStrType, ".status") + + _schema_configuration_extension_read = None + + @classmethod + def _build_schema_configuration_extension_read(cls, _schema): + if cls._schema_configuration_extension_read is not None: + _schema.publisher = cls._schema_configuration_extension_read.publisher + _schema.type = cls._schema_configuration_extension_read.type + return + + cls._schema_configuration_extension_read = _schema_configuration_extension_read = AAZObjectType() + + configuration_extension_read = _schema_configuration_extension_read + configuration_extension_read.publisher = AAZStrType( + flags={"read_only": True}, + ) + configuration_extension_read.type = AAZStrType( + flags={"read_only": True}, + ) + + _schema.publisher = cls._schema_configuration_extension_read.publisher + _schema.type = cls._schema_configuration_extension_read.type + + _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() + + 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.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + 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_machine_extension_instance_view_read = None + + @classmethod + def _build_schema_machine_extension_instance_view_read(cls, _schema): + if cls._schema_machine_extension_instance_view_read is not None: + _schema.name = cls._schema_machine_extension_instance_view_read.name + _schema.status = cls._schema_machine_extension_instance_view_read.status + _schema.type = cls._schema_machine_extension_instance_view_read.type + _schema.type_handler_version = cls._schema_machine_extension_instance_view_read.type_handler_version + return + + cls._schema_machine_extension_instance_view_read = _schema_machine_extension_instance_view_read = AAZObjectType() + + machine_extension_instance_view_read = _schema_machine_extension_instance_view_read + machine_extension_instance_view_read.name = AAZStrType() + machine_extension_instance_view_read.status = AAZObjectType() + machine_extension_instance_view_read.type = AAZStrType() + machine_extension_instance_view_read.type_handler_version = AAZStrType( + serialized_name="typeHandlerVersion", + ) + + status = _schema_machine_extension_instance_view_read.status + status.code = AAZStrType() + status.display_status = AAZStrType( + serialized_name="displayStatus", + ) + status.level = AAZStrType() + status.message = AAZStrType() + status.time = AAZStrType() + + _schema.name = cls._schema_machine_extension_instance_view_read.name + _schema.status = cls._schema_machine_extension_instance_view_read.status + _schema.type = cls._schema_machine_extension_instance_view_read.type + _schema.type_handler_version = cls._schema_machine_extension_instance_view_read.type_handler_version + + _schema_machine_read = None + + @classmethod + def _build_schema_machine_read(cls, _schema): + if cls._schema_machine_read is not None: + _schema.id = cls._schema_machine_read.id + _schema.identity = cls._schema_machine_read.identity + _schema.location = cls._schema_machine_read.location + _schema.name = cls._schema_machine_read.name + _schema.properties = cls._schema_machine_read.properties + _schema.resources = cls._schema_machine_read.resources + _schema.system_data = cls._schema_machine_read.system_data + _schema.tags = cls._schema_machine_read.tags + _schema.type = cls._schema_machine_read.type + return + + cls._schema_machine_read = _schema_machine_read = AAZObjectType() + + machine_read = _schema_machine_read + machine_read.id = AAZStrType( + flags={"read_only": True}, + ) + machine_read.identity = AAZObjectType() + machine_read.location = AAZStrType( + flags={"required": True}, + ) + machine_read.name = AAZStrType( + flags={"read_only": True}, + ) + machine_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + machine_read.resources = AAZListType( + flags={"read_only": True}, + ) + machine_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + cls._build_schema_system_data_read(machine_read.system_data) + machine_read.tags = AAZDictType() + machine_read.type = AAZStrType( + flags={"read_only": True}, + ) + + identity = _schema_machine_read.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType() + + properties = _schema_machine_read.properties + properties.ad_fqdn = AAZStrType( + serialized_name="adFqdn", + flags={"read_only": True}, + ) + properties.agent_configuration = AAZObjectType( + serialized_name="agentConfiguration", + flags={"read_only": True}, + ) + properties.agent_upgrade = AAZObjectType( + serialized_name="agentUpgrade", + ) + properties.agent_version = AAZStrType( + serialized_name="agentVersion", + flags={"read_only": True}, + ) + properties.client_public_key = AAZStrType( + serialized_name="clientPublicKey", + ) + properties.cloud_metadata = AAZObjectType( + serialized_name="cloudMetadata", + ) + properties.detected_properties = AAZDictType( + serialized_name="detectedProperties", + flags={"read_only": True}, + ) + properties.display_name = AAZStrType( + serialized_name="displayName", + flags={"read_only": True}, + ) + properties.dns_fqdn = AAZStrType( + serialized_name="dnsFqdn", + flags={"read_only": True}, + ) + properties.domain_name = AAZStrType( + serialized_name="domainName", + flags={"read_only": True}, + ) + properties.error_details = AAZListType( + serialized_name="errorDetails", + flags={"read_only": True}, + ) + properties.extensions = AAZListType() + properties.last_status_change = AAZStrType( + serialized_name="lastStatusChange", + flags={"read_only": True}, + ) + properties.location_data = AAZObjectType( + serialized_name="locationData", + ) + properties.machine_fqdn = AAZStrType( + serialized_name="machineFqdn", + flags={"read_only": True}, + ) + properties.mssql_discovered = AAZStrType( + serialized_name="mssqlDiscovered", + ) + properties.os_name = AAZStrType( + serialized_name="osName", + flags={"read_only": True}, + ) + properties.os_profile = AAZObjectType( + serialized_name="osProfile", + ) + properties.os_sku = AAZStrType( + serialized_name="osSku", + flags={"read_only": True}, + ) + properties.os_type = AAZStrType( + serialized_name="osType", + ) + properties.os_version = AAZStrType( + serialized_name="osVersion", + flags={"read_only": True}, + ) + properties.parent_cluster_resource_id = AAZStrType( + serialized_name="parentClusterResourceId", + ) + properties.private_link_scope_resource_id = AAZStrType( + serialized_name="privateLinkScopeResourceId", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.service_statuses = AAZObjectType( + serialized_name="serviceStatuses", + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + properties.vm_id = AAZStrType( + serialized_name="vmId", + ) + properties.vm_uuid = AAZStrType( + serialized_name="vmUuid", + flags={"read_only": True}, + ) + + agent_configuration = _schema_machine_read.properties.agent_configuration + agent_configuration.config_mode = AAZStrType( + serialized_name="configMode", + flags={"read_only": True}, + ) + agent_configuration.extensions_allow_list = AAZListType( + serialized_name="extensionsAllowList", + flags={"read_only": True}, + ) + agent_configuration.extensions_block_list = AAZListType( + serialized_name="extensionsBlockList", + flags={"read_only": True}, + ) + agent_configuration.extensions_enabled = AAZStrType( + serialized_name="extensionsEnabled", + flags={"read_only": True}, + ) + agent_configuration.guest_configuration_enabled = AAZStrType( + serialized_name="guestConfigurationEnabled", + flags={"read_only": True}, + ) + agent_configuration.incoming_connections_ports = AAZListType( + serialized_name="incomingConnectionsPorts", + flags={"read_only": True}, + ) + agent_configuration.proxy_bypass = AAZListType( + serialized_name="proxyBypass", + flags={"read_only": True}, + ) + agent_configuration.proxy_url = AAZStrType( + serialized_name="proxyUrl", + flags={"read_only": True}, + ) + + extensions_allow_list = _schema_machine_read.properties.agent_configuration.extensions_allow_list + extensions_allow_list.Element = AAZObjectType() + cls._build_schema_configuration_extension_read(extensions_allow_list.Element) + + extensions_block_list = _schema_machine_read.properties.agent_configuration.extensions_block_list + extensions_block_list.Element = AAZObjectType() + cls._build_schema_configuration_extension_read(extensions_block_list.Element) + + incoming_connections_ports = _schema_machine_read.properties.agent_configuration.incoming_connections_ports + incoming_connections_ports.Element = AAZStrType() + + proxy_bypass = _schema_machine_read.properties.agent_configuration.proxy_bypass + proxy_bypass.Element = AAZStrType() + + agent_upgrade = _schema_machine_read.properties.agent_upgrade + agent_upgrade.correlation_id = AAZStrType( + serialized_name="correlationId", + ) + agent_upgrade.desired_version = AAZStrType( + serialized_name="desiredVersion", + ) + agent_upgrade.enable_automatic_upgrade = AAZBoolType( + serialized_name="enableAutomaticUpgrade", + ) + agent_upgrade.last_attempt_message = AAZStrType( + serialized_name="lastAttemptMessage", + flags={"read_only": True}, + ) + agent_upgrade.last_attempt_status = AAZStrType( + serialized_name="lastAttemptStatus", + flags={"read_only": True}, + ) + agent_upgrade.last_attempt_timestamp = AAZStrType( + serialized_name="lastAttemptTimestamp", + flags={"read_only": True}, + ) + + cloud_metadata = _schema_machine_read.properties.cloud_metadata + cloud_metadata.provider = AAZStrType( + flags={"read_only": True}, + ) + + detected_properties = _schema_machine_read.properties.detected_properties + detected_properties.Element = AAZStrType() + + error_details = _schema_machine_read.properties.error_details + error_details.Element = AAZObjectType() + cls._build_schema_error_detail_read(error_details.Element) + + extensions = _schema_machine_read.properties.extensions + extensions.Element = AAZObjectType() + cls._build_schema_machine_extension_instance_view_read(extensions.Element) + + location_data = _schema_machine_read.properties.location_data + location_data.city = AAZStrType() + location_data.country_or_region = AAZStrType( + serialized_name="countryOrRegion", + ) + location_data.district = AAZStrType() + location_data.name = AAZStrType( + flags={"required": True}, + ) + + os_profile = _schema_machine_read.properties.os_profile + os_profile.computer_name = AAZStrType( + serialized_name="computerName", + flags={"read_only": True}, + ) + os_profile.linux_configuration = AAZObjectType( + serialized_name="linuxConfiguration", + ) + os_profile.windows_configuration = AAZObjectType( + serialized_name="windowsConfiguration", + ) + + linux_configuration = _schema_machine_read.properties.os_profile.linux_configuration + linux_configuration.patch_settings = AAZObjectType( + serialized_name="patchSettings", + flags={"client_flatten": True}, + ) + cls._build_schema_patch_settings_read(linux_configuration.patch_settings) + + windows_configuration = _schema_machine_read.properties.os_profile.windows_configuration + windows_configuration.patch_settings = AAZObjectType( + serialized_name="patchSettings", + flags={"client_flatten": True}, + ) + cls._build_schema_patch_settings_read(windows_configuration.patch_settings) + + service_statuses = _schema_machine_read.properties.service_statuses + service_statuses.extension_service = AAZObjectType( + serialized_name="extensionService", + ) + cls._build_schema_service_status_read(service_statuses.extension_service) + service_statuses.guest_configuration_service = AAZObjectType( + serialized_name="guestConfigurationService", + ) + cls._build_schema_service_status_read(service_statuses.guest_configuration_service) + + resources = _schema_machine_read.resources + resources.Element = AAZObjectType() + + _element = _schema_machine_read.resources.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + cls._build_schema_system_data_read(_element.system_data) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_machine_read.resources.Element.properties + properties.auto_upgrade_minor_version = AAZBoolType( + serialized_name="autoUpgradeMinorVersion", + ) + properties.enable_automatic_upgrade = AAZBoolType( + serialized_name="enableAutomaticUpgrade", + ) + properties.force_update_tag = AAZStrType( + serialized_name="forceUpdateTag", + ) + properties.instance_view = AAZObjectType( + serialized_name="instanceView", + ) + cls._build_schema_machine_extension_instance_view_read(properties.instance_view) + properties.protected_settings = AAZFreeFormDictType( + serialized_name="protectedSettings", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.publisher = AAZStrType() + properties.settings = AAZFreeFormDictType() + properties.type = AAZStrType() + properties.type_handler_version = AAZStrType( + serialized_name="typeHandlerVersion", + ) + + tags = _schema_machine_read.resources.Element.tags + tags.Element = AAZStrType() + + tags = _schema_machine_read.tags + tags.Element = AAZStrType() + + _schema.id = cls._schema_machine_read.id + _schema.identity = cls._schema_machine_read.identity + _schema.location = cls._schema_machine_read.location + _schema.name = cls._schema_machine_read.name + _schema.properties = cls._schema_machine_read.properties + _schema.resources = cls._schema_machine_read.resources + _schema.system_data = cls._schema_machine_read.system_data + _schema.tags = cls._schema_machine_read.tags + _schema.type = cls._schema_machine_read.type + + _schema_patch_settings_read = None + + @classmethod + def _build_schema_patch_settings_read(cls, _schema): + if cls._schema_patch_settings_read is not None: + _schema.assessment_mode = cls._schema_patch_settings_read.assessment_mode + _schema.patch_mode = cls._schema_patch_settings_read.patch_mode + return + + cls._schema_patch_settings_read = _schema_patch_settings_read = AAZObjectType() + + patch_settings_read = _schema_patch_settings_read + patch_settings_read.assessment_mode = AAZStrType( + serialized_name="assessmentMode", + ) + patch_settings_read.patch_mode = AAZStrType( + serialized_name="patchMode", + ) + + _schema.assessment_mode = cls._schema_patch_settings_read.assessment_mode + _schema.patch_mode = cls._schema_patch_settings_read.patch_mode + + _schema_service_status_read = None + + @classmethod + def _build_schema_service_status_read(cls, _schema): + if cls._schema_service_status_read is not None: + _schema.startup_type = cls._schema_service_status_read.startup_type + _schema.status = cls._schema_service_status_read.status + return + + cls._schema_service_status_read = _schema_service_status_read = AAZObjectType() + + service_status_read = _schema_service_status_read + service_status_read.startup_type = AAZStrType( + serialized_name="startupType", + ) + service_status_read.status = AAZStrType() + + _schema.startup_type = cls._schema_service_status_read.startup_type + _schema.status = cls._schema_service_status_read.status + + _schema_system_data_read = None + + @classmethod + def _build_schema_system_data_read(cls, _schema): + if cls._schema_system_data_read is not None: + _schema.created_at = cls._schema_system_data_read.created_at + _schema.created_by = cls._schema_system_data_read.created_by + _schema.created_by_type = cls._schema_system_data_read.created_by_type + _schema.last_modified_at = cls._schema_system_data_read.last_modified_at + _schema.last_modified_by = cls._schema_system_data_read.last_modified_by + _schema.last_modified_by_type = cls._schema_system_data_read.last_modified_by_type + return + + cls._schema_system_data_read = _schema_system_data_read = AAZObjectType( + flags={"read_only": True} + ) + + system_data_read = _schema_system_data_read + system_data_read.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data_read.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data_read.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data_read.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data_read.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data_read.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + _schema.created_at = cls._schema_system_data_read.created_at + _schema.created_by = cls._schema_system_data_read.created_by + _schema.created_by_type = cls._schema_system_data_read.created_by_type + _schema.last_modified_at = cls._schema_system_data_read.last_modified_at + _schema.last_modified_by = cls._schema_system_data_read.last_modified_by + _schema.last_modified_by_type = cls._schema_system_data_read.last_modified_by_type + + +__all__ = ["Update"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_upgrade_extension.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_upgrade_extension.py new file mode 100644 index 00000000000..b218db23473 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_upgrade_extension.py @@ -0,0 +1,201 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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 upgrade-extension", +) +class UpgradeExtension(AAZCommand): + """Upgrade Extensions of an Azure Arc-Enabled Server. + + :example: Sample command for upgrade-extension + az connectedmachine upgrade-extension --extension-targets "{"Microsoft.Azure.Monitoring": {"targetVersion":"2.0"}, "Microsoft.Compute.CustomScriptExtension":{"targetVersion":"1.10"}}" --machine-name myMachine --resource-group myResourceGroup + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/upgradeextensions", "2022-12-27"], + ] + } + + 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-_\.]{1,54}$", + max_length=54, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "ExtensionUpgradeParameters" + + _args_schema = cls._args_schema + _args_schema.extension_targets = AAZDictArg( + options=["--extension-targets"], + arg_group="ExtensionUpgradeParameters", + help="Describes the Extension Target Properties.", + ) + + extension_targets = cls._args_schema.extension_targets + extension_targets.Element = AAZObjectArg() + + _element = cls._args_schema.extension_targets.Element + _element.target_version = AAZStrArg( + options=["target-version"], + help="Properties for the specified Extension to Upgrade.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.UpgradeExtensions(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class UpgradeExtensions(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/upgradeExtensions", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "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", "2022-12-27", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("extensionTargets", AAZDictType, ".extension_targets") + + extension_targets = _builder.get(".extensionTargets") + if extension_targets is not None: + extension_targets.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".extensionTargets{}") + if _elements is not None: + _elements.set_prop("targetVersion", AAZStrType, ".target_version") + + return self.serialize_content(_content_value) + + def on_200(self, session): + pass + + +class _UpgradeExtensionHelper: + """Helper class for UpgradeExtension""" + + +__all__ = ["UpgradeExtension"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/__cmd_group.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/__cmd_group.py new file mode 100644 index 00000000000..5fac1ede07a --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/__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 extension", +) +class __CMDGroup(AAZCommandGroup): + """Manage a VM extension on an Azure Arc-Enabled Server. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/__init__.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/__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/extension/_create.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_create.py new file mode 100644 index 00000000000..e237e3b20cc --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_create.py @@ -0,0 +1,442 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "connectedmachine extension create", +) +class Create(AAZCommand): + """Create the extension. + + :example: Sample command for extension create + az connectedmachine extension create --name CustomScriptExtension --location eastus2euap --type CustomScriptExtension --publisher Microsoft.Compute --type-handler-version 1.10 --machine-name myMachine --resource-group myResourceGroup + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/extensions/{}", "2022-12-27"], + ] + } + + 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.extension_name = AAZStrArg( + options=["-n", "--name", "--extension-name"], + help="The name of the machine extension.", + required=True, + ) + _args_schema.machine_name = AAZStrArg( + options=["--machine-name"], + help="The name of the machine where the extension should be created or updated.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-_\.]{1,54}$", + max_length=54, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.location = AAZResourceLocationArg( + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.type = AAZStrArg( + options=["--type"], + help="Specifies the type of the extension; an example is \"CustomScriptExtension\".", + ) + + # define Arg Group "ExtensionParameters" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="ExtensionParameters", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.auto_upgrade_minor_version = AAZBoolArg( + options=["--upgrade-minor-ver"], + arg_group="Properties", + help="Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true.", + ) + _args_schema.enable_automatic_upgrade = AAZBoolArg( + options=["--enable-auto-upgrade"], + arg_group="Properties", + help="Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available.", + ) + _args_schema.force_update_tag = AAZStrArg( + options=["--force-update-tag"], + arg_group="Properties", + help="How the extension handler should be forced to update even if the extension configuration has not changed.", + ) + _args_schema.instance_view = AAZObjectArg( + options=["--instance-view"], + arg_group="Properties", + help="The machine extension instance view.", + ) + _args_schema.protected_settings = AAZFreeFormDictArg( + options=["--protected-settings"], + arg_group="Properties", + help="The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.", + ) + _args_schema.publisher = AAZStrArg( + options=["--publisher"], + arg_group="Properties", + help="The name of the extension handler publisher.", + ) + _args_schema.settings = AAZFreeFormDictArg( + options=["--settings"], + arg_group="Properties", + help="Json formatted public settings for the extension.", + ) + _args_schema.type_handler_version = AAZStrArg( + options=["--type-handler-version"], + arg_group="Properties", + help="Specifies the version of the script handler.", + ) + + instance_view = cls._args_schema.instance_view + instance_view.name = AAZStrArg( + options=["name"], + help="The machine extension name.", + ) + instance_view.status = AAZObjectArg( + options=["status"], + help="Instance view status.", + ) + instance_view.type = AAZStrArg( + options=["type"], + help="Specifies the type of the extension; an example is \"CustomScriptExtension\".", + ) + instance_view.type_handler_version = AAZStrArg( + options=["type-handler-version"], + help="Specifies the version of the script handler.", + ) + + status = cls._args_schema.instance_view.status + status.code = AAZStrArg( + options=["code"], + help="The status code.", + ) + status.display_status = AAZStrArg( + options=["display-status"], + help="The short localizable label for the status.", + ) + status.level = AAZStrArg( + options=["level"], + help="The level code.", + enum={"Error": "Error", "Info": "Info", "Warning": "Warning"}, + ) + status.message = AAZStrArg( + options=["message"], + help="The detailed status message, including for alerts and error messages.", + ) + status.time = AAZDateTimeArg( + options=["time"], + help="The time of the status.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.MachineExtensionsCreateOrUpdate(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 MachineExtensionsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}", + **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( + "extensionName", self.ctx.args.extension_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", "2022-12-27", + 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) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("autoUpgradeMinorVersion", AAZBoolType, ".auto_upgrade_minor_version") + properties.set_prop("enableAutomaticUpgrade", AAZBoolType, ".enable_automatic_upgrade") + properties.set_prop("forceUpdateTag", AAZStrType, ".force_update_tag") + properties.set_prop("instanceView", AAZObjectType, ".instance_view") + properties.set_prop("protectedSettings", AAZFreeFormDictType, ".protected_settings") + properties.set_prop("publisher", AAZStrType, ".publisher") + properties.set_prop("settings", AAZFreeFormDictType, ".settings") + properties.set_prop("type", AAZStrType, ".type") + properties.set_prop("typeHandlerVersion", AAZStrType, ".type_handler_version") + + instance_view = _builder.get(".properties.instanceView") + if instance_view is not None: + instance_view.set_prop("name", AAZStrType, ".name") + instance_view.set_prop("status", AAZObjectType, ".status") + instance_view.set_prop("type", AAZStrType, ".type") + instance_view.set_prop("typeHandlerVersion", AAZStrType, ".type_handler_version") + + status = _builder.get(".properties.instanceView.status") + if status is not None: + status.set_prop("code", AAZStrType, ".code") + status.set_prop("displayStatus", AAZStrType, ".display_status") + status.set_prop("level", AAZStrType, ".level") + status.set_prop("message", AAZStrType, ".message") + status.set_prop("time", AAZStrType, ".time") + + protected_settings = _builder.get(".properties.protectedSettings") + if protected_settings is not None: + protected_settings.set_anytype_elements(".") + + settings = _builder.get(".properties.settings") + if settings is not None: + settings.set_anytype_elements(".") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.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() + _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.auto_upgrade_minor_version = AAZBoolType( + serialized_name="autoUpgradeMinorVersion", + ) + properties.enable_automatic_upgrade = AAZBoolType( + serialized_name="enableAutomaticUpgrade", + ) + properties.force_update_tag = AAZStrType( + serialized_name="forceUpdateTag", + ) + properties.instance_view = AAZObjectType( + serialized_name="instanceView", + ) + properties.protected_settings = AAZFreeFormDictType( + serialized_name="protectedSettings", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.publisher = AAZStrType() + properties.settings = AAZFreeFormDictType() + properties.type = AAZStrType() + properties.type_handler_version = AAZStrType( + serialized_name="typeHandlerVersion", + ) + + instance_view = cls._schema_on_200.properties.instance_view + instance_view.name = AAZStrType() + instance_view.status = AAZObjectType() + instance_view.type = AAZStrType() + instance_view.type_handler_version = AAZStrType( + serialized_name="typeHandlerVersion", + ) + + status = cls._schema_on_200.properties.instance_view.status + status.code = AAZStrType() + status.display_status = AAZStrType( + serialized_name="displayStatus", + ) + status.level = AAZStrType() + status.message = AAZStrType() + status.time = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_delete.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_delete.py new file mode 100644 index 00000000000..e306580c553 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_delete.py @@ -0,0 +1,178 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "connectedmachine extension delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the extension. + + :example: Sample command for extension delete + az connectedmachine extension delete --name myName --machine-name myMachine --resource-group myResourceGroup + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/extensions/{}", "2022-12-27"], + ] + } + + 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.extension_name = AAZStrArg( + options=["-n", "--name", "--extension-name"], + help="The name of the machine extension.", + required=True, + id_part="child_name_1", + ) + _args_schema.machine_name = AAZStrArg( + options=["--machine-name"], + help="The name of the machine where the extension should be deleted.", + required=True, + id_part="name", + 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() + yield self.MachineExtensionsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class MachineExtensionsDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}", + **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( + "extensionName", self.ctx.args.extension_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", "2022-12-27", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_list.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_list.py new file mode 100644 index 00000000000..e94c54c28f6 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_list.py @@ -0,0 +1,269 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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 extension list", +) +class List(AAZCommand): + """Get all extensions of a Non-Azure machine. + + :example: Sample command for extension list + az connectedmachine extension list --machine-name myMachine --resource-group myResourceGroup + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/extensions", "2022-12-27"], + ] + } + + 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 containing the extension.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-_\.]{1,54}$", + max_length=54, + min_length=1, + ), + ) + _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.MachineExtensionsList(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 MachineExtensionsList(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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}/extensions", + **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", "2022-12-27", + 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() + _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.auto_upgrade_minor_version = AAZBoolType( + serialized_name="autoUpgradeMinorVersion", + ) + properties.enable_automatic_upgrade = AAZBoolType( + serialized_name="enableAutomaticUpgrade", + ) + properties.force_update_tag = AAZStrType( + serialized_name="forceUpdateTag", + ) + properties.instance_view = AAZObjectType( + serialized_name="instanceView", + ) + properties.protected_settings = AAZFreeFormDictType( + serialized_name="protectedSettings", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.publisher = AAZStrType() + properties.settings = AAZFreeFormDictType() + properties.type = AAZStrType() + properties.type_handler_version = AAZStrType( + serialized_name="typeHandlerVersion", + ) + + instance_view = cls._schema_on_200.value.Element.properties.instance_view + instance_view.name = AAZStrType() + instance_view.status = AAZObjectType() + instance_view.type = AAZStrType() + instance_view.type_handler_version = AAZStrType( + serialized_name="typeHandlerVersion", + ) + + status = cls._schema_on_200.value.Element.properties.instance_view.status + status.code = AAZStrType() + status.display_status = AAZStrType( + serialized_name="displayStatus", + ) + status.level = AAZStrType() + status.message = AAZStrType() + status.time = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_show.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_show.py new file mode 100644 index 00000000000..066ff1b5847 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_show.py @@ -0,0 +1,264 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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 extension show", +) +class Show(AAZCommand): + """Create or update the extension. + + :example: Sample command for extension show + az connectedmachine extension show --name CustomScriptExtension --machine-name myMachine --resource-group myResourceGroup + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/extensions/{}", "2022-12-27"], + ] + } + + 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.extension_name = AAZStrArg( + options=["-n", "--name", "--extension-name"], + help="The name of the machine extension.", + required=True, + id_part="child_name_1", + ) + _args_schema.machine_name = AAZStrArg( + options=["--machine-name"], + help="The name of the machine containing the extension.", + required=True, + id_part="name", + 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.MachineExtensionsGet(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 MachineExtensionsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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}/extensions/{extensionName}", + **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( + "extensionName", self.ctx.args.extension_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", "2022-12-27", + 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() + _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.auto_upgrade_minor_version = AAZBoolType( + serialized_name="autoUpgradeMinorVersion", + ) + properties.enable_automatic_upgrade = AAZBoolType( + serialized_name="enableAutomaticUpgrade", + ) + properties.force_update_tag = AAZStrType( + serialized_name="forceUpdateTag", + ) + properties.instance_view = AAZObjectType( + serialized_name="instanceView", + ) + properties.protected_settings = AAZFreeFormDictType( + serialized_name="protectedSettings", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.publisher = AAZStrType() + properties.settings = AAZFreeFormDictType() + properties.type = AAZStrType() + properties.type_handler_version = AAZStrType( + serialized_name="typeHandlerVersion", + ) + + instance_view = cls._schema_on_200.properties.instance_view + instance_view.name = AAZStrType() + instance_view.status = AAZObjectType() + instance_view.type = AAZStrType() + instance_view.type_handler_version = AAZStrType( + serialized_name="typeHandlerVersion", + ) + + status = cls._schema_on_200.properties.instance_view.status + status.code = AAZStrType() + status.display_status = AAZStrType( + serialized_name="displayStatus", + ) + status.level = AAZStrType() + status.message = AAZStrType() + status.time = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_update.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_update.py new file mode 100644 index 00000000000..a17981b9236 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_update.py @@ -0,0 +1,606 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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 extension update", +) +class Update(AAZCommand): + """Update operation to update the extension. + + :example: Sample command for extension update + az connectedmachine extension update --name CustomScriptExtension --type CustomScriptExtension --publisher Microsoft.Compute --type-handler-version 1.10 --machine-name myMachine --resource-group myResourceGroup + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/extensions/{}", "2022-12-27"], + ] + } + + 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.extension_name = AAZStrArg( + options=["-n", "--name", "--extension-name"], + help="The name of the machine extension.", + required=True, + id_part="child_name_1", + ) + _args_schema.machine_name = AAZStrArg( + options=["--machine-name"], + help="The name of the machine containing the extension.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-_\.]{1,54}$", + max_length=54, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "ExtensionParameters" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="ExtensionParameters", + help="Resource tags.", + nullable=True, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg( + nullable=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.auto_upgrade_minor_version = AAZBoolArg( + options=["--upgrade-minor-ver"], + arg_group="Properties", + help="Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true.", + nullable=True, + ) + _args_schema.enable_automatic_upgrade = AAZBoolArg( + options=["--enable-auto-upgrade"], + arg_group="Properties", + help="Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available.", + nullable=True, + ) + _args_schema.force_update_tag = AAZStrArg( + options=["--force-update-tag"], + arg_group="Properties", + help="How the extension handler should be forced to update even if the extension configuration has not changed.", + nullable=True, + ) + _args_schema.instance_view = AAZObjectArg( + options=["--instance-view"], + arg_group="Properties", + help="The machine extension instance view.", + nullable=True, + ) + _args_schema.protected_settings = AAZFreeFormDictArg( + options=["--protected-settings"], + arg_group="Properties", + help="The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.", + nullable=True, + ) + _args_schema.publisher = AAZStrArg( + options=["--publisher"], + arg_group="Properties", + help="The name of the extension handler publisher.", + nullable=True, + ) + _args_schema.settings = AAZFreeFormDictArg( + options=["--settings"], + arg_group="Properties", + help="Json formatted public settings for the extension.", + nullable=True, + ) + _args_schema.type = AAZStrArg( + options=["--type"], + arg_group="Properties", + help="Specifies the type of the extension; an example is \"CustomScriptExtension\".", + nullable=True, + ) + _args_schema.type_handler_version = AAZStrArg( + options=["--type-handler-version"], + arg_group="Properties", + help="Specifies the version of the script handler.", + nullable=True, + ) + + instance_view = cls._args_schema.instance_view + instance_view.name = AAZStrArg( + options=["name"], + help="The machine extension name.", + nullable=True, + ) + instance_view.status = AAZObjectArg( + options=["status"], + help="Instance view status.", + nullable=True, + ) + instance_view.type = AAZStrArg( + options=["type"], + help="Specifies the type of the extension; an example is \"CustomScriptExtension\".", + nullable=True, + ) + instance_view.type_handler_version = AAZStrArg( + options=["type-handler-version"], + help="Specifies the version of the script handler.", + nullable=True, + ) + + status = cls._args_schema.instance_view.status + status.code = AAZStrArg( + options=["code"], + help="The status code.", + nullable=True, + ) + status.display_status = AAZStrArg( + options=["display-status"], + help="The short localizable label for the status.", + nullable=True, + ) + status.level = AAZStrArg( + options=["level"], + help="The level code.", + nullable=True, + enum={"Error": "Error", "Info": "Info", "Warning": "Warning"}, + ) + status.message = AAZStrArg( + options=["message"], + help="The detailed status message, including for alerts and error messages.", + nullable=True, + ) + status.time = AAZDateTimeArg( + options=["time"], + help="The time of the status.", + nullable=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MachineExtensionsGet(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.MachineExtensionsCreateOrUpdate(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 MachineExtensionsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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}/extensions/{extensionName}", + **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( + "extensionName", self.ctx.args.extension_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", "2022-12-27", + 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_extension_read(cls._schema_on_200) + + return cls._schema_on_200 + + class MachineExtensionsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}", + **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( + "extensionName", self.ctx.args.extension_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", "2022-12-27", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + value=self.ctx.vars.instance, + ) + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + _UpdateHelper._build_schema_machine_extension_read(cls._schema_on_200) + + return cls._schema_on_200 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("properties", AAZObjectType) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("autoUpgradeMinorVersion", AAZBoolType, ".auto_upgrade_minor_version") + properties.set_prop("enableAutomaticUpgrade", AAZBoolType, ".enable_automatic_upgrade") + properties.set_prop("forceUpdateTag", AAZStrType, ".force_update_tag") + properties.set_prop("instanceView", AAZObjectType, ".instance_view") + properties.set_prop("protectedSettings", AAZFreeFormDictType, ".protected_settings") + properties.set_prop("publisher", AAZStrType, ".publisher") + properties.set_prop("settings", AAZFreeFormDictType, ".settings") + properties.set_prop("type", AAZStrType, ".type") + properties.set_prop("typeHandlerVersion", AAZStrType, ".type_handler_version") + + instance_view = _builder.get(".properties.instanceView") + if instance_view is not None: + instance_view.set_prop("name", AAZStrType, ".name") + instance_view.set_prop("status", AAZObjectType, ".status") + instance_view.set_prop("type", AAZStrType, ".type") + instance_view.set_prop("typeHandlerVersion", AAZStrType, ".type_handler_version") + + status = _builder.get(".properties.instanceView.status") + if status is not None: + status.set_prop("code", AAZStrType, ".code") + status.set_prop("displayStatus", AAZStrType, ".display_status") + status.set_prop("level", AAZStrType, ".level") + status.set_prop("message", AAZStrType, ".message") + status.set_prop("time", AAZStrType, ".time") + + protected_settings = _builder.get(".properties.protectedSettings") + if protected_settings is not None: + protected_settings.set_anytype_elements(".") + + settings = _builder.get(".properties.settings") + if settings is not None: + settings.set_anytype_elements(".") + + 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_machine_extension_read = None + + @classmethod + def _build_schema_machine_extension_read(cls, _schema): + if cls._schema_machine_extension_read is not None: + _schema.id = cls._schema_machine_extension_read.id + _schema.location = cls._schema_machine_extension_read.location + _schema.name = cls._schema_machine_extension_read.name + _schema.properties = cls._schema_machine_extension_read.properties + _schema.system_data = cls._schema_machine_extension_read.system_data + _schema.tags = cls._schema_machine_extension_read.tags + _schema.type = cls._schema_machine_extension_read.type + return + + cls._schema_machine_extension_read = _schema_machine_extension_read = AAZObjectType() + + machine_extension_read = _schema_machine_extension_read + machine_extension_read.id = AAZStrType( + flags={"read_only": True}, + ) + machine_extension_read.location = AAZStrType( + flags={"required": True}, + ) + machine_extension_read.name = AAZStrType( + flags={"read_only": True}, + ) + machine_extension_read.properties = AAZObjectType() + machine_extension_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + machine_extension_read.tags = AAZDictType() + machine_extension_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_machine_extension_read.properties + properties.auto_upgrade_minor_version = AAZBoolType( + serialized_name="autoUpgradeMinorVersion", + ) + properties.enable_automatic_upgrade = AAZBoolType( + serialized_name="enableAutomaticUpgrade", + ) + properties.force_update_tag = AAZStrType( + serialized_name="forceUpdateTag", + ) + properties.instance_view = AAZObjectType( + serialized_name="instanceView", + ) + properties.protected_settings = AAZFreeFormDictType( + serialized_name="protectedSettings", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.publisher = AAZStrType() + properties.settings = AAZFreeFormDictType() + properties.type = AAZStrType() + properties.type_handler_version = AAZStrType( + serialized_name="typeHandlerVersion", + ) + + instance_view = _schema_machine_extension_read.properties.instance_view + instance_view.name = AAZStrType() + instance_view.status = AAZObjectType() + instance_view.type = AAZStrType() + instance_view.type_handler_version = AAZStrType( + serialized_name="typeHandlerVersion", + ) + + status = _schema_machine_extension_read.properties.instance_view.status + status.code = AAZStrType() + status.display_status = AAZStrType( + serialized_name="displayStatus", + ) + status.level = AAZStrType() + status.message = AAZStrType() + status.time = AAZStrType() + + system_data = _schema_machine_extension_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_extension_read.tags + tags.Element = AAZStrType() + + _schema.id = cls._schema_machine_extension_read.id + _schema.location = cls._schema_machine_extension_read.location + _schema.name = cls._schema_machine_extension_read.name + _schema.properties = cls._schema_machine_extension_read.properties + _schema.system_data = cls._schema_machine_extension_read.system_data + _schema.tags = cls._schema_machine_extension_read.tags + _schema.type = cls._schema_machine_extension_read.type + + +__all__ = ["Update"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_wait.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_wait.py new file mode 100644 index 00000000000..bf1201fbab2 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/_wait.py @@ -0,0 +1,260 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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 extension 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/{}/extensions/{}", "2022-12-27"], + ] + } + + 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.extension_name = AAZStrArg( + options=["-n", "--name", "--extension-name"], + help="The name of the machine extension.", + required=True, + id_part="child_name_1", + ) + _args_schema.machine_name = AAZStrArg( + options=["--machine-name"], + help="The name of the machine containing the extension.", + required=True, + id_part="name", + 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.MachineExtensionsGet(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 MachineExtensionsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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}/extensions/{extensionName}", + **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( + "extensionName", self.ctx.args.extension_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", "2022-12-27", + 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() + _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.auto_upgrade_minor_version = AAZBoolType( + serialized_name="autoUpgradeMinorVersion", + ) + properties.enable_automatic_upgrade = AAZBoolType( + serialized_name="enableAutomaticUpgrade", + ) + properties.force_update_tag = AAZStrType( + serialized_name="forceUpdateTag", + ) + properties.instance_view = AAZObjectType( + serialized_name="instanceView", + ) + properties.protected_settings = AAZFreeFormDictType( + serialized_name="protectedSettings", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.publisher = AAZStrType() + properties.settings = AAZFreeFormDictType() + properties.type = AAZStrType() + properties.type_handler_version = AAZStrType( + serialized_name="typeHandlerVersion", + ) + + instance_view = cls._schema_on_200.properties.instance_view + instance_view.name = AAZStrType() + instance_view.status = AAZObjectType() + instance_view.type = AAZStrType() + instance_view.type_handler_version = AAZStrType( + serialized_name="typeHandlerVersion", + ) + + status = cls._schema_on_200.properties.instance_view.status + status.code = AAZStrType() + status.display_status = AAZStrType( + serialized_name="displayStatus", + ) + status.level = AAZStrType() + status.message = AAZStrType() + status.time = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/image/__cmd_group.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/image/__cmd_group.py new file mode 100644 index 00000000000..6c5639cc659 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/image/__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 extension image", +) +class __CMDGroup(AAZCommandGroup): + """Manage VM extension metadata available for Azure Arc-Enabled Servers. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/image/__init__.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/image/__init__.py new file mode 100644 index 00000000000..2df85698253 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/image/__init__.py @@ -0,0 +1,13 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._list import * +from ._show import * 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 new file mode 100644 index 00000000000..77c8950f3dd --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/image/_list.py @@ -0,0 +1,228 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "connectedmachine extension image list", +) +class List(AAZCommand): + """List all Extension versions based on location, publisher, extensionType. + + :example: Sample command for extension image list + az connectedmachine extension image list --publisher microsoft.azure.monitor --extension-type azuremonitorlinuxagent --location eastus + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.hybridcompute/locations/{}/publishers/{}/extensiontypes/{}/versions", "2022-12-27"], + ] + } + + 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.extension_type = AAZStrArg( + options=["--type", "--extension-type"], + help="The extensionType of the Extension being received.", + required=True, + ) + _args_schema.location = AAZResourceLocationArg( + required=True, + ) + _args_schema.publisher = AAZStrArg( + options=["-p", "--publisher"], + help="The publisher of the Extension being received.", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ExtensionMetadataList(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + return result + + class ExtensionMetadataList(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "extensionType", self.ctx.args.extension_type, + required=True, + ), + **self.serialize_url_param( + "location", self.ctx.args.location, + required=True, + ), + **self.serialize_url_param( + "publisher", self.ctx.args.publisher, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-27", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.value = AAZListType( + flags={"read_only": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.extension_type = AAZStrType( + serialized_name="extensionType", + flags={"read_only": True}, + ) + properties.publisher = AAZStrType( + flags={"read_only": True}, + ) + properties.version = AAZStrType( + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/image/_show.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/image/_show.py new file mode 100644 index 00000000000..7f3f84107e1 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/image/_show.py @@ -0,0 +1,233 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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 extension image show", +) +class Show(AAZCommand): + """Get an Extension Metadata based on location, publisher, extensionType and version. + + :example: Sample command for extension image show + az connectedmachine extension image show --publisher microsoft.azure.monitor --extension-type azuremonitorlinuxagent --location eastus --version 1.9.1 + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.hybridcompute/locations/{}/publishers/{}/extensiontypes/{}/versions/{}", "2022-12-27"], + ] + } + + 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.extension_type = AAZStrArg( + options=["--type", "--extension-type"], + help="The extensionType of the Extension being received.", + required=True, + id_part="child_name_2", + ) + _args_schema.location = AAZResourceLocationArg( + required=True, + id_part="name", + ) + _args_schema.publisher = AAZStrArg( + options=["-p", "--publisher"], + help="The publisher of the Extension being received.", + required=True, + id_part="child_name_1", + ) + _args_schema.version = AAZStrArg( + options=["-n", "--name", "--version"], + help="The version of the Extension being received.", + required=True, + id_part="child_name_3", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ExtensionMetadataGet(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 ExtensionMetadataGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions/{version}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "extensionType", self.ctx.args.extension_type, + required=True, + ), + **self.serialize_url_param( + "location", self.ctx.args.location, + required=True, + ), + **self.serialize_url_param( + "publisher", self.ctx.args.publisher, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "version", self.ctx.args.version, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-27", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.extension_type = AAZStrType( + serialized_name="extensionType", + flags={"read_only": True}, + ) + properties.publisher = AAZStrType( + flags={"read_only": True}, + ) + properties.version = AAZStrType( + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/__cmd_group.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/__cmd_group.py new file mode 100644 index 00000000000..a856b139bc9 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/__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 private-endpoint-connection", +) +class __CMDGroup(AAZCommandGroup): + """Manage private endpoint connection with an Azure Arc-Enabled Server. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/__init__.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/__init__.py new file mode 100644 index 00000000000..f32b66e3eeb --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/__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 ._delete import * +from ._list import * +from ._show import * +from ._update import * +from ._wait import * 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 new file mode 100644 index 00000000000..ba7dbf46d08 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_delete.py @@ -0,0 +1,173 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "connectedmachine private-endpoint-connection delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete a private endpoint connection with a given name. + + :example: Sample command for private-endpoint-connection delete + az connectedmachine private-endpoint-connection delete --name private-endpoint-connection-name --resource-group myResourceGroup --scope-name myPrivateLinkScope + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/privateendpointconnections/{}", "2022-12-27"], + ] + } + + 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.private_endpoint_connection_name = AAZStrArg( + options=["-n", "--name", "--private-endpoint-connection-name"], + help="The name of the private endpoint connection.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.scope_name = AAZStrArg( + options=["--scope-name"], + help="The name of the Azure Arc PrivateLinkScope resource.", + required=True, + id_part="name", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.PrivateEndpointConnectionsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class PrivateEndpointConnectionsDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}", + **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( + "privateEndpointConnectionName", self.ctx.args.private_endpoint_connection_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "scopeName", self.ctx.args.scope_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-27", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_list.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_list.py new file mode 100644 index 00000000000..84bd4d13939 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_list.py @@ -0,0 +1,243 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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 private-endpoint-connection list", +) +class List(AAZCommand): + """List all private endpoint connections on a private link scope. + + :example: Sample command for private-endpoint-connection list + az connectedmachine private-endpoint-connection list --resource-group myResourceGroup --scope-name myPrivateLinkScope + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/privateendpointconnections", "2022-12-27"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.scope_name = AAZStrArg( + options=["--scope-name"], + help="The name of the Azure Arc PrivateLinkScope resource.", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.PrivateEndpointConnectionsListByPrivateLinkScope(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 PrivateEndpointConnectionsListByPrivateLinkScope(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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/privateLinkScopes/{scopeName}/privateEndpointConnections", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "scopeName", self.ctx.args.scope_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-27", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + flags={"read_only": True}, + ) + _schema_on_200.value = AAZListType( + flags={"read_only": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.group_ids = AAZListType( + serialized_name="groupIds", + flags={"read_only": True}, + ) + properties.private_endpoint = AAZObjectType( + serialized_name="privateEndpoint", + ) + properties.private_link_service_connection_state = AAZObjectType( + serialized_name="privateLinkServiceConnectionState", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + group_ids = cls._schema_on_200.value.Element.properties.group_ids + group_ids.Element = AAZStrType() + + private_endpoint = cls._schema_on_200.value.Element.properties.private_endpoint + private_endpoint.id = AAZStrType() + + private_link_service_connection_state = cls._schema_on_200.value.Element.properties.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrType( + serialized_name="actionsRequired", + flags={"read_only": True}, + ) + private_link_service_connection_state.description = AAZStrType( + flags={"required": True}, + ) + private_link_service_connection_state.status = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_show.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_show.py new file mode 100644 index 00000000000..f3cc8f0cda3 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_show.py @@ -0,0 +1,242 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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 private-endpoint-connection show", +) +class Show(AAZCommand): + """Get a private endpoint connection. + + :example: Sample command for private-endpoint-connection show + az connectedmachine private-endpoint-connection show --name private-endpoint-connection-name --resource-group myResourceGroup --scope-name myPrivateLinkScope + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/privateendpointconnections/{}", "2022-12-27"], + ] + } + + 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.private_endpoint_connection_name = AAZStrArg( + options=["-n", "--name", "--private-endpoint-connection-name"], + help="The name of the private endpoint connection.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.scope_name = AAZStrArg( + options=["--scope-name"], + help="The name of the Azure Arc PrivateLinkScope resource.", + required=True, + id_part="name", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.PrivateEndpointConnectionsGet(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 PrivateEndpointConnectionsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}", + **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( + "privateEndpointConnectionName", self.ctx.args.private_endpoint_connection_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "scopeName", self.ctx.args.scope_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-27", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.group_ids = AAZListType( + serialized_name="groupIds", + flags={"read_only": True}, + ) + properties.private_endpoint = AAZObjectType( + serialized_name="privateEndpoint", + ) + properties.private_link_service_connection_state = AAZObjectType( + serialized_name="privateLinkServiceConnectionState", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + group_ids = cls._schema_on_200.properties.group_ids + group_ids.Element = AAZStrType() + + private_endpoint = cls._schema_on_200.properties.private_endpoint + private_endpoint.id = AAZStrType() + + private_link_service_connection_state = cls._schema_on_200.properties.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrType( + serialized_name="actionsRequired", + flags={"read_only": True}, + ) + private_link_service_connection_state.description = AAZStrType( + flags={"required": True}, + ) + private_link_service_connection_state.status = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_update.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_update.py new file mode 100644 index 00000000000..9b936253ec4 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_update.py @@ -0,0 +1,464 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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 private-endpoint-connection update", +) +class Update(AAZCommand): + """Update a private endpoint connection with a given name. + + :example: Sample command for private-endpoint-connection update + az connectedmachine private-endpoint-connection update --connection-state "{{"description":"Rejected by AZ CLI", "status":"Rejected"}}" --name private-endpoint-connection-name --resource-group myResourceGroup --scope-name myPrivateLinkScope + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/privateendpointconnections/{}", "2022-12-27"], + ] + } + + 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.private_endpoint_connection_name = AAZStrArg( + options=["-n", "--name", "--private-endpoint-connection-name"], + help="The name of the private endpoint connection.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.scope_name = AAZStrArg( + options=["--scope-name"], + help="The name of the Azure Arc PrivateLinkScope resource.", + required=True, + id_part="name", + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.private_endpoint = AAZObjectArg( + options=["--private-endpoint"], + arg_group="Properties", + help="Private endpoint which the connection belongs to.", + nullable=True, + ) + _args_schema.private_link_service_connection_state = AAZObjectArg( + options=["--connection-state", "--private-link-service-connection-state"], + arg_group="Properties", + help="Connection state of the private endpoint connection.", + nullable=True, + ) + + private_endpoint = cls._args_schema.private_endpoint + private_endpoint.id = AAZStrArg( + options=["id"], + help="Resource id of the private endpoint.", + nullable=True, + ) + + private_link_service_connection_state = cls._args_schema.private_link_service_connection_state + private_link_service_connection_state.description = AAZStrArg( + options=["description"], + help="The private link service connection description.", + ) + private_link_service_connection_state.status = AAZStrArg( + options=["status"], + help="The private link service connection status.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.PrivateEndpointConnectionsGet(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.PrivateEndpointConnectionsCreateOrUpdate(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 PrivateEndpointConnectionsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}", + **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( + "privateEndpointConnectionName", self.ctx.args.private_endpoint_connection_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "scopeName", self.ctx.args.scope_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-27", + 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_private_endpoint_connection_read(cls._schema_on_200) + + return cls._schema_on_200 + + class PrivateEndpointConnectionsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}", + **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( + "privateEndpointConnectionName", self.ctx.args.private_endpoint_connection_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "scopeName", self.ctx.args.scope_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-27", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + value=self.ctx.vars.instance, + ) + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + _UpdateHelper._build_schema_private_endpoint_connection_read(cls._schema_on_200) + + return cls._schema_on_200 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("properties", AAZObjectType) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("privateEndpoint", AAZObjectType, ".private_endpoint") + properties.set_prop("privateLinkServiceConnectionState", AAZObjectType, ".private_link_service_connection_state") + + private_endpoint = _builder.get(".properties.privateEndpoint") + if private_endpoint is not None: + private_endpoint.set_prop("id", AAZStrType, ".id") + + private_link_service_connection_state = _builder.get(".properties.privateLinkServiceConnectionState") + if private_link_service_connection_state is not None: + private_link_service_connection_state.set_prop("description", AAZStrType, ".description", typ_kwargs={"flags": {"required": True}}) + private_link_service_connection_state.set_prop("status", AAZStrType, ".status", typ_kwargs={"flags": {"required": True}}) + + 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_private_endpoint_connection_read = None + + @classmethod + def _build_schema_private_endpoint_connection_read(cls, _schema): + if cls._schema_private_endpoint_connection_read is not None: + _schema.id = cls._schema_private_endpoint_connection_read.id + _schema.name = cls._schema_private_endpoint_connection_read.name + _schema.properties = cls._schema_private_endpoint_connection_read.properties + _schema.system_data = cls._schema_private_endpoint_connection_read.system_data + _schema.type = cls._schema_private_endpoint_connection_read.type + return + + cls._schema_private_endpoint_connection_read = _schema_private_endpoint_connection_read = AAZObjectType() + + private_endpoint_connection_read = _schema_private_endpoint_connection_read + private_endpoint_connection_read.id = AAZStrType( + flags={"read_only": True}, + ) + private_endpoint_connection_read.name = AAZStrType( + flags={"read_only": True}, + ) + private_endpoint_connection_read.properties = AAZObjectType() + private_endpoint_connection_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + private_endpoint_connection_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_private_endpoint_connection_read.properties + properties.group_ids = AAZListType( + serialized_name="groupIds", + flags={"read_only": True}, + ) + properties.private_endpoint = AAZObjectType( + serialized_name="privateEndpoint", + ) + properties.private_link_service_connection_state = AAZObjectType( + serialized_name="privateLinkServiceConnectionState", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + group_ids = _schema_private_endpoint_connection_read.properties.group_ids + group_ids.Element = AAZStrType() + + private_endpoint = _schema_private_endpoint_connection_read.properties.private_endpoint + private_endpoint.id = AAZStrType() + + private_link_service_connection_state = _schema_private_endpoint_connection_read.properties.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrType( + serialized_name="actionsRequired", + flags={"read_only": True}, + ) + private_link_service_connection_state.description = AAZStrType( + flags={"required": True}, + ) + private_link_service_connection_state.status = AAZStrType( + flags={"required": True}, + ) + + system_data = _schema_private_endpoint_connection_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + _schema.id = cls._schema_private_endpoint_connection_read.id + _schema.name = cls._schema_private_endpoint_connection_read.name + _schema.properties = cls._schema_private_endpoint_connection_read.properties + _schema.system_data = cls._schema_private_endpoint_connection_read.system_data + _schema.type = cls._schema_private_endpoint_connection_read.type + + +__all__ = ["Update"] 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 new file mode 100644 index 00000000000..270b476281b --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_endpoint_connection/_wait.py @@ -0,0 +1,238 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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 private-endpoint-connection 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/privatelinkscopes/{}/privateendpointconnections/{}", "2022-12-27"], + ] + } + + 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.private_endpoint_connection_name = AAZStrArg( + options=["-n", "--name", "--private-endpoint-connection-name"], + help="The name of the private endpoint connection.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.scope_name = AAZStrArg( + options=["--scope-name"], + help="The name of the Azure Arc PrivateLinkScope resource.", + required=True, + id_part="name", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.PrivateEndpointConnectionsGet(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 PrivateEndpointConnectionsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}", + **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( + "privateEndpointConnectionName", self.ctx.args.private_endpoint_connection_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "scopeName", self.ctx.args.scope_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-27", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.group_ids = AAZListType( + serialized_name="groupIds", + flags={"read_only": True}, + ) + properties.private_endpoint = AAZObjectType( + serialized_name="privateEndpoint", + ) + properties.private_link_service_connection_state = AAZObjectType( + serialized_name="privateLinkServiceConnectionState", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + group_ids = cls._schema_on_200.properties.group_ids + group_ids.Element = AAZStrType() + + private_endpoint = cls._schema_on_200.properties.private_endpoint + private_endpoint.id = AAZStrType() + + private_link_service_connection_state = cls._schema_on_200.properties.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrType( + serialized_name="actionsRequired", + flags={"read_only": True}, + ) + private_link_service_connection_state.description = AAZStrType( + flags={"required": True}, + ) + private_link_service_connection_state.status = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_resource/__cmd_group.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_resource/__cmd_group.py new file mode 100644 index 00000000000..1ac6f8a940c --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_resource/__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 private-link-resource", +) +class __CMDGroup(AAZCommandGroup): + """Manage private link resource of an Azure Arc-Enabled Server. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_resource/__init__.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_resource/__init__.py new file mode 100644 index 00000000000..2df85698253 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_resource/__init__.py @@ -0,0 +1,13 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._list import * +from ._show import * 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 new file mode 100644 index 00000000000..a17bfe9aee1 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_resource/_list.py @@ -0,0 +1,229 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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 private-link-resource list", +) +class List(AAZCommand): + """List the private link resources that need to be created for an Azure Monitor PrivateLinkScope. + + :example: Sample command for private-link-resource list + az connectedmachine private-link-resource list --resource-group myResourceGroup --scope-name myPrivateLinkScope + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/privatelinkresources", "2022-12-27"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.scope_name = AAZStrArg( + options=["-n", "--scope-name"], + help="The name of the Azure Arc PrivateLinkScope resource.", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.PrivateLinkResourcesListByPrivateLinkScope(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 PrivateLinkResourcesListByPrivateLinkScope(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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/privateLinkScopes/{scopeName}/privateLinkResources", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "scopeName", self.ctx.args.scope_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-27", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + flags={"read_only": True}, + ) + _schema_on_200.value = AAZListType( + flags={"read_only": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.group_id = AAZStrType( + serialized_name="groupId", + flags={"read_only": True}, + ) + properties.required_members = AAZListType( + serialized_name="requiredMembers", + flags={"read_only": True}, + ) + properties.required_zone_names = AAZListType( + serialized_name="requiredZoneNames", + flags={"read_only": True}, + ) + + required_members = cls._schema_on_200.value.Element.properties.required_members + required_members.Element = AAZStrType() + + required_zone_names = cls._schema_on_200.value.Element.properties.required_zone_names + required_zone_names.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_resource/_show.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_resource/_show.py new file mode 100644 index 00000000000..05dac137134 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_resource/_show.py @@ -0,0 +1,228 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "connectedmachine private-link-resource show", +) +class Show(AAZCommand): + """Get the private link resources that need to be created for an Azure Monitor PrivateLinkScope. + + :example: Sample command for private-link-resource show + az connectedmachine private-link-resource show --group-name hybridcompute --resource-group myResourceGroup --scope-name myPrivateLinkScope + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}/privatelinkresources/{}", "2022-12-27"], + ] + } + + 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.group_name = AAZStrArg( + options=["-n", "--name", "--group-name"], + help="The name of the private link resource.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.scope_name = AAZStrArg( + options=["--scope-name"], + help="The name of the Azure Arc PrivateLinkScope resource.", + required=True, + id_part="name", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.PrivateLinkResourcesGet(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 PrivateLinkResourcesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}", + **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( + "groupName", self.ctx.args.group_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "scopeName", self.ctx.args.scope_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-27", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.group_id = AAZStrType( + serialized_name="groupId", + flags={"read_only": True}, + ) + properties.required_members = AAZListType( + serialized_name="requiredMembers", + flags={"read_only": True}, + ) + properties.required_zone_names = AAZListType( + serialized_name="requiredZoneNames", + flags={"read_only": True}, + ) + + required_members = cls._schema_on_200.properties.required_members + required_members.Element = AAZStrType() + + required_zone_names = cls._schema_on_200.properties.required_zone_names + required_zone_names.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/__cmd_group.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/__cmd_group.py new file mode 100644 index 00000000000..905688a7d98 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/__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 private-link-scope", +) +class __CMDGroup(AAZCommandGroup): + """Manage private link scope of an Azure Arc-Enabled Server. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/__init__.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/__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/private_link_scope/_create.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_create.py new file mode 100644 index 00000000000..10c32cfed9f --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_create.py @@ -0,0 +1,325 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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 private-link-scope create", +) +class Create(AAZCommand): + """Create (or updates) a Azure Arc PrivateLinkScope. Note: You cannot specify a different value for InstrumentationKey nor AppId in the Put operation. + + :example: Sample command for private-link-scope create + az connectedmachine private-link-scope create --location westus --resource-group my-resource-group --scope-name my-privatelinkscope + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}", "2022-12-27"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.scope_name = AAZStrArg( + options=["-n", "--name", "--scope-name"], + help="The name of the Azure Arc PrivateLinkScope resource.", + required=True, + ) + + # define Arg Group "Parameters" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Parameters", + help="Resource location", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Parameters", + help="Resource tags", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.public_network_access = AAZStrArg( + options=["--public-network-access"], + arg_group="Properties", + help="Indicates whether machines associated with the private link scope can also use public Azure Arc service endpoints.", + default="Disabled", + enum={"Disabled": "Disabled", "Enabled": "Enabled"}, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.PrivateLinkScopesCreateOrUpdate(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 PrivateLinkScopesCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "scopeName", self.ctx.args.scope_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-27", + 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) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("publicNetworkAccess", AAZStrType, ".public_network_access") + + 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() + _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.private_endpoint_connections = AAZListType( + serialized_name="privateEndpointConnections", + flags={"read_only": True}, + ) + properties.private_link_scope_id = AAZStrType( + serialized_name="privateLinkScopeId", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.public_network_access = AAZStrType( + serialized_name="publicNetworkAccess", + ) + + private_endpoint_connections = cls._schema_on_200_201.properties.private_endpoint_connections + private_endpoint_connections.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.private_endpoint_connections.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties.private_endpoint_connections.Element.properties + properties.group_ids = AAZListType( + serialized_name="groupIds", + flags={"read_only": True}, + ) + properties.private_endpoint = AAZObjectType( + serialized_name="privateEndpoint", + ) + properties.private_link_service_connection_state = AAZObjectType( + serialized_name="privateLinkServiceConnectionState", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + group_ids = cls._schema_on_200_201.properties.private_endpoint_connections.Element.properties.group_ids + group_ids.Element = AAZStrType() + + private_endpoint = cls._schema_on_200_201.properties.private_endpoint_connections.Element.properties.private_endpoint + private_endpoint.id = AAZStrType() + + private_link_service_connection_state = cls._schema_on_200_201.properties.private_endpoint_connections.Element.properties.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrType( + serialized_name="actionsRequired", + flags={"read_only": True}, + ) + private_link_service_connection_state.description = AAZStrType( + flags={"required": True}, + ) + private_link_service_connection_state.status = AAZStrType( + flags={"required": True}, + ) + + 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""" + + +__all__ = ["Create"] 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 new file mode 100644 index 00000000000..3d9d51b2c4d --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_delete.py @@ -0,0 +1,163 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "connectedmachine private-link-scope delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete an Azure Arc PrivateLinkScope. + + :example: Sample command for private-link-scope delete + az connectedmachine private-link-scope delete --resource-group my-resource-group --scope-name my-privatelinkscope + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}", "2022-12-27"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.scope_name = AAZStrArg( + options=["-n", "--name", "--scope-name"], + help="The name of the Azure Arc PrivateLinkScope resource.", + required=True, + id_part="name", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.PrivateLinkScopesDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class PrivateLinkScopesDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "scopeName", self.ctx.args.scope_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-27", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_list.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_list.py new file mode 100644 index 00000000000..4adb4a55a08 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_list.py @@ -0,0 +1,471 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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 private-link-scope list", +) +class List(AAZCommand): + """Get a list of Azure Arc PrivateLinkScopes within a resource group. And Gets a list of all Azure Arc PrivateLinkScopes within a subscription. + + :example: Sample command for private-link-scope list + az connectedmachine private-link-scope list --resource-group my-resource-group + az connectedmachine private-link-scope list + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.hybridcompute/privatelinkscopes", "2022-12-27"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes", "2022-12-27"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + if condition_0: + self.PrivateLinkScopesListByResourceGroup(ctx=self.ctx)() + if condition_1: + self.PrivateLinkScopesList(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 PrivateLinkScopesListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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/privateLinkScopes", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-27", + 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() + _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.private_endpoint_connections = AAZListType( + serialized_name="privateEndpointConnections", + flags={"read_only": True}, + ) + properties.private_link_scope_id = AAZStrType( + serialized_name="privateLinkScopeId", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.public_network_access = AAZStrType( + serialized_name="publicNetworkAccess", + ) + + private_endpoint_connections = cls._schema_on_200.value.Element.properties.private_endpoint_connections + private_endpoint_connections.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element.properties + properties.group_ids = AAZListType( + serialized_name="groupIds", + flags={"read_only": True}, + ) + properties.private_endpoint = AAZObjectType( + serialized_name="privateEndpoint", + ) + properties.private_link_service_connection_state = AAZObjectType( + serialized_name="privateLinkServiceConnectionState", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + group_ids = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element.properties.group_ids + group_ids.Element = AAZStrType() + + private_endpoint = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element.properties.private_endpoint + private_endpoint.id = AAZStrType() + + private_link_service_connection_state = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element.properties.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrType( + serialized_name="actionsRequired", + flags={"read_only": True}, + ) + private_link_service_connection_state.description = AAZStrType( + flags={"required": True}, + ) + private_link_service_connection_state.status = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class PrivateLinkScopesList(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/privateLinkScopes", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-27", + 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() + _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.private_endpoint_connections = AAZListType( + serialized_name="privateEndpointConnections", + flags={"read_only": True}, + ) + properties.private_link_scope_id = AAZStrType( + serialized_name="privateLinkScopeId", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.public_network_access = AAZStrType( + serialized_name="publicNetworkAccess", + ) + + private_endpoint_connections = cls._schema_on_200.value.Element.properties.private_endpoint_connections + private_endpoint_connections.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element.properties + properties.group_ids = AAZListType( + serialized_name="groupIds", + flags={"read_only": True}, + ) + properties.private_endpoint = AAZObjectType( + serialized_name="privateEndpoint", + ) + properties.private_link_service_connection_state = AAZObjectType( + serialized_name="privateLinkServiceConnectionState", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + group_ids = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element.properties.group_ids + group_ids.Element = AAZStrType() + + private_endpoint = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element.properties.private_endpoint + private_endpoint.id = AAZStrType() + + private_link_service_connection_state = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element.properties.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrType( + serialized_name="actionsRequired", + flags={"read_only": True}, + ) + private_link_service_connection_state.description = AAZStrType( + flags={"required": True}, + ) + private_link_service_connection_state.status = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_show.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_show.py new file mode 100644 index 00000000000..871ffe438db --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_show.py @@ -0,0 +1,271 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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 private-link-scope show", +) +class Show(AAZCommand): + """Return an Azure Arc PrivateLinkScope. + + :example: Sample command for private-link-scope show + az connectedmachine private-link-scope show --resource-group my-resource-group --scope-name my-privatelinkscope + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}", "2022-12-27"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.scope_name = AAZStrArg( + options=["-n", "--name", "--scope-name"], + help="The name of the Azure Arc PrivateLinkScope resource.", + required=True, + id_part="name", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.PrivateLinkScopesGet(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 PrivateLinkScopesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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/privateLinkScopes/{scopeName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "scopeName", self.ctx.args.scope_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-27", + 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() + _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.private_endpoint_connections = AAZListType( + serialized_name="privateEndpointConnections", + flags={"read_only": True}, + ) + properties.private_link_scope_id = AAZStrType( + serialized_name="privateLinkScopeId", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.public_network_access = AAZStrType( + serialized_name="publicNetworkAccess", + ) + + private_endpoint_connections = cls._schema_on_200.properties.private_endpoint_connections + private_endpoint_connections.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.private_endpoint_connections.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties.private_endpoint_connections.Element.properties + properties.group_ids = AAZListType( + serialized_name="groupIds", + flags={"read_only": True}, + ) + properties.private_endpoint = AAZObjectType( + serialized_name="privateEndpoint", + ) + properties.private_link_service_connection_state = AAZObjectType( + serialized_name="privateLinkServiceConnectionState", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + group_ids = cls._schema_on_200.properties.private_endpoint_connections.Element.properties.group_ids + group_ids.Element = AAZStrType() + + private_endpoint = cls._schema_on_200.properties.private_endpoint_connections.Element.properties.private_endpoint + private_endpoint.id = AAZStrType() + + private_link_service_connection_state = cls._schema_on_200.properties.private_endpoint_connections.Element.properties.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrType( + serialized_name="actionsRequired", + flags={"read_only": True}, + ) + private_link_service_connection_state.description = AAZStrType( + flags={"required": True}, + ) + private_link_service_connection_state.status = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_update.py b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_update.py new file mode 100644 index 00000000000..e5beec46311 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_update.py @@ -0,0 +1,470 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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 private-link-scope update", +) +class Update(AAZCommand): + """Update an Azure Arc PrivateLinkScope. Note: You cannot specify a different value for InstrumentationKey nor AppId in the Put operation. + + :example: Sample command for private-link-scope update + az connectedmachine private-link-scope update --tags Tag1=Value1 --resource-group my-resource-group --scope-name my-privatelinkscope --location eastus2euap + """ + + _aaz_info = { + "version": "2022-12-27", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/privatelinkscopes/{}", "2022-12-27"], + ] + } + + AZ_SUPPORT_GENERIC_UPDATE = True + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.scope_name = AAZStrArg( + options=["-n", "--name", "--scope-name"], + help="The name of the Azure Arc PrivateLinkScope resource.", + required=True, + id_part="name", + ) + + # define Arg Group "Parameters" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Parameters", + help="Resource tags", + nullable=True, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg( + nullable=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.location = AAZStrArg( + options=["--location"], + help="The location of the Azure Arc PrivateLinkScope resource.", + id_part="location", + ) + + _args_schema.public_network_access = AAZStrArg( + options=["--public-network-access"], + arg_group="Properties", + help="Indicates whether machines associated with the private link scope can also use public Azure Arc service endpoints.", + nullable=True, + enum={"Disabled": "Disabled", "Enabled": "Enabled"}, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.PrivateLinkScopesGet(ctx=self.ctx)() + self.pre_instance_update(self.ctx.vars.instance) + self.InstanceUpdateByJson(ctx=self.ctx)() + self.InstanceUpdateByGeneric(ctx=self.ctx)() + self.post_instance_update(self.ctx.vars.instance) + self.PrivateLinkScopesCreateOrUpdate(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 PrivateLinkScopesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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/privateLinkScopes/{scopeName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "scopeName", self.ctx.args.scope_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-27", + 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_hybrid_compute_private_link_scope_read(cls._schema_on_200) + + return cls._schema_on_200 + + class PrivateLinkScopesCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "scopeName", self.ctx.args.scope_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-27", + 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_hybrid_compute_private_link_scope_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) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("publicNetworkAccess", AAZStrType, ".public_network_access") + + 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_hybrid_compute_private_link_scope_read = None + + @classmethod + def _build_schema_hybrid_compute_private_link_scope_read(cls, _schema): + if cls._schema_hybrid_compute_private_link_scope_read is not None: + _schema.id = cls._schema_hybrid_compute_private_link_scope_read.id + _schema.location = cls._schema_hybrid_compute_private_link_scope_read.location + _schema.name = cls._schema_hybrid_compute_private_link_scope_read.name + _schema.properties = cls._schema_hybrid_compute_private_link_scope_read.properties + _schema.system_data = cls._schema_hybrid_compute_private_link_scope_read.system_data + _schema.tags = cls._schema_hybrid_compute_private_link_scope_read.tags + _schema.type = cls._schema_hybrid_compute_private_link_scope_read.type + return + + cls._schema_hybrid_compute_private_link_scope_read = _schema_hybrid_compute_private_link_scope_read = AAZObjectType() + + hybrid_compute_private_link_scope_read = _schema_hybrid_compute_private_link_scope_read + hybrid_compute_private_link_scope_read.id = AAZStrType( + flags={"read_only": True}, + ) + hybrid_compute_private_link_scope_read.location = AAZStrType( + flags={"required": True}, + ) + hybrid_compute_private_link_scope_read.name = AAZStrType( + flags={"read_only": True}, + ) + hybrid_compute_private_link_scope_read.properties = AAZObjectType() + hybrid_compute_private_link_scope_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + hybrid_compute_private_link_scope_read.tags = AAZDictType() + hybrid_compute_private_link_scope_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_hybrid_compute_private_link_scope_read.properties + properties.private_endpoint_connections = AAZListType( + serialized_name="privateEndpointConnections", + flags={"read_only": True}, + ) + properties.private_link_scope_id = AAZStrType( + serialized_name="privateLinkScopeId", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.public_network_access = AAZStrType( + serialized_name="publicNetworkAccess", + ) + + private_endpoint_connections = _schema_hybrid_compute_private_link_scope_read.properties.private_endpoint_connections + private_endpoint_connections.Element = AAZObjectType() + + _element = _schema_hybrid_compute_private_link_scope_read.properties.private_endpoint_connections.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_hybrid_compute_private_link_scope_read.properties.private_endpoint_connections.Element.properties + properties.group_ids = AAZListType( + serialized_name="groupIds", + flags={"read_only": True}, + ) + properties.private_endpoint = AAZObjectType( + serialized_name="privateEndpoint", + ) + properties.private_link_service_connection_state = AAZObjectType( + serialized_name="privateLinkServiceConnectionState", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + group_ids = _schema_hybrid_compute_private_link_scope_read.properties.private_endpoint_connections.Element.properties.group_ids + group_ids.Element = AAZStrType() + + private_endpoint = _schema_hybrid_compute_private_link_scope_read.properties.private_endpoint_connections.Element.properties.private_endpoint + private_endpoint.id = AAZStrType() + + private_link_service_connection_state = _schema_hybrid_compute_private_link_scope_read.properties.private_endpoint_connections.Element.properties.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrType( + serialized_name="actionsRequired", + flags={"read_only": True}, + ) + private_link_service_connection_state.description = AAZStrType( + flags={"required": True}, + ) + private_link_service_connection_state.status = AAZStrType( + flags={"required": True}, + ) + + system_data = _schema_hybrid_compute_private_link_scope_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_hybrid_compute_private_link_scope_read.tags + tags.Element = AAZStrType() + + _schema.id = cls._schema_hybrid_compute_private_link_scope_read.id + _schema.location = cls._schema_hybrid_compute_private_link_scope_read.location + _schema.name = cls._schema_hybrid_compute_private_link_scope_read.name + _schema.properties = cls._schema_hybrid_compute_private_link_scope_read.properties + _schema.system_data = cls._schema_hybrid_compute_private_link_scope_read.system_data + _schema.tags = cls._schema_hybrid_compute_private_link_scope_read.tags + _schema.type = cls._schema_hybrid_compute_private_link_scope_read.type + + +__all__ = ["Update"] 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 new file mode 100644 index 00000000000..5e1862356b5 --- /dev/null +++ b/src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/private_link_scope/_wait.py @@ -0,0 +1,267 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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 private-link-scope 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/privatelinkscopes/{}", "2022-12-27"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.scope_name = AAZStrArg( + options=["-n", "--name", "--scope-name"], + help="The name of the Azure Arc PrivateLinkScope resource.", + required=True, + id_part="name", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.PrivateLinkScopesGet(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 PrivateLinkScopesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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/privateLinkScopes/{scopeName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "scopeName", self.ctx.args.scope_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-27", + 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() + _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.private_endpoint_connections = AAZListType( + serialized_name="privateEndpointConnections", + flags={"read_only": True}, + ) + properties.private_link_scope_id = AAZStrType( + serialized_name="privateLinkScopeId", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.public_network_access = AAZStrType( + serialized_name="publicNetworkAccess", + ) + + private_endpoint_connections = cls._schema_on_200.properties.private_endpoint_connections + private_endpoint_connections.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.private_endpoint_connections.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties.private_endpoint_connections.Element.properties + properties.group_ids = AAZListType( + serialized_name="groupIds", + flags={"read_only": True}, + ) + properties.private_endpoint = AAZObjectType( + serialized_name="privateEndpoint", + ) + properties.private_link_service_connection_state = AAZObjectType( + serialized_name="privateLinkServiceConnectionState", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + group_ids = cls._schema_on_200.properties.private_endpoint_connections.Element.properties.group_ids + group_ids.Element = AAZStrType() + + private_endpoint = cls._schema_on_200.properties.private_endpoint_connections.Element.properties.private_endpoint + private_endpoint.id = AAZStrType() + + private_link_service_connection_state = cls._schema_on_200.properties.private_endpoint_connections.Element.properties.private_link_service_connection_state + private_link_service_connection_state.actions_required = AAZStrType( + serialized_name="actionsRequired", + flags={"read_only": True}, + ) + private_link_service_connection_state.description = AAZStrType( + flags={"required": True}, + ) + private_link_service_connection_state.status = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/connectedmachine/azext_connectedmachine/azext_metadata.json b/src/connectedmachine/azext_connectedmachine/azext_metadata.json index 3695b0d7077..7923ce3c67b 100644 --- a/src/connectedmachine/azext_connectedmachine/azext_metadata.json +++ b/src/connectedmachine/azext_connectedmachine/azext_metadata.json @@ -1,3 +1,4 @@ { - "azext.minCliCoreVersion": "2.15.0" + "azext.isPreview": true, + "azext.minCliCoreVersion": "2.49.0" } \ No newline at end of file diff --git a/src/connectedmachine/azext_connectedmachine/generated/_help.py b/src/connectedmachine/azext_connectedmachine/generated/_help.py index 2dbad11bbd2..acdf7c4b939 100644 --- a/src/connectedmachine/azext_connectedmachine/generated/_help.py +++ b/src/connectedmachine/azext_connectedmachine/generated/_help.py @@ -12,218 +12,6 @@ from knack.help_files import helps -helps['connectedmachine'] = ''' - type: group - short-summary: Manage Connected Machine -''' - -helps['connectedmachine list'] = """ - type: command - short-summary: "List all the hybrid machines in the specified resource group. Use the nextLink property in the \ -response to get the next page of hybrid machines. And Lists all the hybrid machines in the specified subscription. Use \ -the nextLink property in the response to get the next page of hybrid machines." - examples: - - name: List Machines by resource group - text: |- - az connectedmachine list --resource-group "myResourceGroup" - - name: List Machines by resource group - text: |- - az connectedmachine list -""" - -helps['connectedmachine show'] = """ - type: command - short-summary: "Retrieve information about the model view or the instance view of a hybrid machine." - examples: - - name: Get Machine - text: |- - az connectedmachine show --name "myMachine" --resource-group "myResourceGroup" -""" - -helps['connectedmachine delete'] = """ - type: command - short-summary: "The operation to remove a hybrid machine identity in Azure." - examples: - - name: Delete a Machine - text: |- - az connectedmachine delete --name "myMachine" --resource-group "myResourceGroup" -""" - -helps['connectedmachine extension'] = """ - type: group - short-summary: Manage machine extension with connectedmachine -""" - -helps['connectedmachine extension list'] = """ - type: command - short-summary: "The operation to get all extensions of a non-Azure machine." - examples: - - name: Get all Machine Extensions - text: |- - az connectedmachine extension list --machine-name "myMachine" --resource-group "myResourceGroup" -""" - -helps['connectedmachine extension show'] = """ - type: command - short-summary: "The operation to get the extension." - examples: - - name: Get Machine Extension - text: |- - az connectedmachine extension show --name "CustomScriptExtension" --machine-name "myMachine" \ ---resource-group "myResourceGroup" -""" - -helps['connectedmachine extension create'] = """ - type: command - short-summary: "The operation to Create the extension." - parameters: - - name: --status - short-summary: "Instance view status." - long-summary: | - Usage: --status code=XX level=XX display-status=XX message=XX time=XX - code: The status code. - level: The level code. - display-status: The short localizable label for the status. - message: The detailed status message, including for alerts and error messages. - time: The time of the status. - examples: - - name: Create or Update a Machine Extension - text: |- - az connectedmachine extension create --name "CustomScriptExtension" --location "eastus2euap" --type \ -"CustomScriptExtension" --publisher "Microsoft.Compute" --settings '{\"commandToExecute\":\"hostname\"}' --type-handler-version "1.10" --machine-name \ -"myMachine" --resource-group "myResourceGroup" -""" - -helps['connectedmachine extension update'] = """ - type: command - short-summary: "The operation to create or update the extension." - examples: - - name: Create or Update a Machine Extension - text: |- - az connectedmachine extension update --name "CustomScriptExtension" --type "CustomScriptExtension" \ ---publisher "Microsoft.Compute" --settings '{\"commandToExecute\":\"hostname\"}' --type-handler-version "1.10" --machine-name "myMachine" --resource-group \ -"myResourceGroup" -""" - -helps['connectedmachine extension delete'] = """ - type: command - short-summary: "The operation to delete the extension." - examples: - - name: Delete a Machine Extension - text: |- - az connectedmachine extension delete --name "MMA" --machine-name "myMachine" --resource-group \ -"myResourceGroup" -""" - -helps['connectedmachine extension wait'] = """ - type: command - short-summary: Place the CLI in a waiting state until a condition of the connectedmachine extension is met. - examples: - - name: Pause executing next line of CLI script until the connectedmachine extension is successfully created. - text: |- - az connectedmachine extension wait --name "CustomScriptExtension" --machine-name "myMachine" \ ---resource-group "myResourceGroup" --created - - name: Pause executing next line of CLI script until the connectedmachine extension is successfully updated. - text: |- - az connectedmachine extension wait --name "CustomScriptExtension" --machine-name "myMachine" \ ---resource-group "myResourceGroup" --updated - - name: Pause executing next line of CLI script until the connectedmachine extension is successfully deleted. - text: |- - az connectedmachine extension wait --name "CustomScriptExtension" --machine-name "myMachine" \ ---resource-group "myResourceGroup" --deleted -""" - -helps['connectedmachine upgrade-extension'] = """ - type: command - short-summary: "The operation to upgrade Machine Extensions." - examples: - - name: Upgrade Machine Extensions - text: |- - az connectedmachine upgrade-extension --extension-targets '{\"Microsoft.Azure.Monitoring\":{\"targetV\ -ersion\":\"2.0\"},\"Microsoft.Compute.CustomScriptExtension\":{\"targetVersion\":\"1.10\"}}' --machine-name \ -"myMachine" --resource-group "myResourceGroup" -""" - -helps['connectedmachine private-link-scope'] = """ - type: group - short-summary: Manage private link scope with connectedmachine -""" - -helps['connectedmachine private-link-scope list'] = """ - type: command - short-summary: "Get a list of Azure Arc PrivateLinkScopes within a resource group. And Gets a list of all Azure \ -Arc PrivateLinkScopes within a subscription." - examples: - - name: PrivateLinkScopeListByResourceGroup - text: |- - az connectedmachine private-link-scope list --resource-group "my-resource-group" - - name: PrivateLinkScopesList.json - text: |- - az connectedmachine private-link-scope list -""" - -helps['connectedmachine private-link-scope show'] = """ - type: command - short-summary: "Return a Azure Arc PrivateLinkScope." - examples: - - name: PrivateLinkScopeGet - text: |- - az connectedmachine private-link-scope show --resource-group "my-resource-group" --scope-name \ -"my-privatelinkscope" -""" - -helps['connectedmachine private-link-scope create'] = """ - type: command - short-summary: "Create (or update) a Azure Arc PrivateLinkScope. Note: You cannot specify a different value for \ -InstrumentationKey nor AppId in the Put operation." - examples: - - name: PrivateLinkScopeCreate - text: |- - az connectedmachine private-link-scope create --location "westus" --resource-group "my-resource-group" \ ---scope-name "my-privatelinkscope" -""" - -helps['connectedmachine private-link-scope update'] = """ - type: command - short-summary: "Update a Azure Arc PrivateLinkScope. Note: You cannot specify a different value for \ -InstrumentationKey nor AppId in the Put operation." - examples: - - name: PrivateLinkScopeUpdate - text: |- - az connectedmachine private-link-scope update --location "westus" --tags Tag1="Value1" --resource-group \ -"my-resource-group" --scope-name "my-privatelinkscope" -""" - -helps['connectedmachine private-link-scope delete'] = """ - type: command - short-summary: "Delete a Azure Arc PrivateLinkScope." - examples: - - name: PrivateLinkScopesDelete - text: |- - az connectedmachine private-link-scope delete --resource-group "my-resource-group" --scope-name \ -"my-privatelinkscope" -""" - -helps['connectedmachine private-link-scope show-validation-detail'] = """ - type: command - short-summary: "Return a Azure Arc PrivateLinkScope's validation details." - examples: - - name: PrivateLinkScopeGet - text: |- - az connectedmachine private-link-scope show-validation-detail --location "wus2" --private-link-scope-id \ -"f5dc51d3-92ed-4d7e-947a-775ea79b4919" -""" - -helps['connectedmachine private-link-scope show-validation-detail-for-machine'] = """ - type: command - short-summary: "Return a Azure Arc PrivateLinkScope's validation details for a given machine." - examples: - - name: PrivateLinkScopeGet - text: |- - az connectedmachine private-link-scope show-validation-detail-for-machine --machine-name "machineName" \ ---resource-group "my-resource-group" -""" - helps['connectedmachine private-link-scope update-tag'] = """ type: command short-summary: "Update an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate \ @@ -234,111 +22,3 @@ az connectedmachine private-link-scope update-tag --tags Tag1="Value1" Tag2="Value2" --resource-group \ "my-resource-group" --scope-name "my-privatelinkscope" """ - -helps['connectedmachine private-link-scope wait'] = """ - type: command - short-summary: Place the CLI in a waiting state until a condition of the connectedmachine private-link-scope is \ -met. - examples: - - name: Pause executing next line of CLI script until the connectedmachine private-link-scope is successfully \ -deleted. - text: |- - az connectedmachine private-link-scope wait --resource-group "my-resource-group" --scope-name \ -"my-privatelinkscope" --deleted -""" - -helps['connectedmachine private-link-resource'] = """ - type: group - short-summary: Manage private link resource with connectedmachine -""" - -helps['connectedmachine private-link-resource list'] = """ - type: command - short-summary: "Get the private link resources that need to be created for a Azure Monitor PrivateLinkScope." - examples: - - name: Get private endpoint connection. - text: |- - az connectedmachine private-link-resource list --resource-group "myResourceGroup" --scope-name \ -"myPrivateLinkScope" -""" - -helps['connectedmachine private-link-resource show'] = """ - type: command - short-summary: "Get the private link resources that need to be created for a Azure Monitor PrivateLinkScope." - examples: - - name: Get private endpoint connection. - text: |- - az connectedmachine private-link-resource show --group-name "hybridcompute" --resource-group \ -"myResourceGroup" --scope-name "myPrivateLinkScope" -""" - -helps['connectedmachine private-endpoint-connection'] = """ - type: group - short-summary: Manage private endpoint connection with connectedmachine -""" - -helps['connectedmachine private-endpoint-connection list'] = """ - type: command - short-summary: "Get all private endpoint connections on a private link scope." - examples: - - name: Get list of private endpoint connections on a private link scope. - text: |- - az connectedmachine private-endpoint-connection list --resource-group "myResourceGroup" --scope-name \ -"myPrivateLinkScope" -""" - -helps['connectedmachine private-endpoint-connection show'] = """ - type: command - short-summary: "Get a private endpoint connection." - examples: - - name: Get private endpoint connection. - text: |- - az connectedmachine private-endpoint-connection show --name "private-endpoint-connection-name" \ ---resource-group "myResourceGroup" --scope-name "myPrivateLinkScope" -""" - -helps['connectedmachine private-endpoint-connection update'] = """ - type: command - short-summary: "Approve or reject a private endpoint connection with a given name." - parameters: - - name: --connection-state - short-summary: "Connection state of the private endpoint connection." - long-summary: | - Usage: --connection-state status=XX description=XX - - status: Required. The private link service connection status. - description: Required. The private link service connection description. - examples: - - name: Approve or reject a private endpoint connection with a given name. - text: |- - az connectedmachine private-endpoint-connection update --connection-state description="Approved by \ -johndoe@contoso.com" status="Approved" --name "private-endpoint-connection-name" --resource-group "myResourceGroup" \ ---scope-name "myPrivateLinkScope" -""" - -helps['connectedmachine private-endpoint-connection delete'] = """ - type: command - short-summary: "Delete a private endpoint connection with a given name." - examples: - - name: Delete a private endpoint connection with a given name. - text: |- - az connectedmachine private-endpoint-connection delete --name "private-endpoint-connection-name" \ ---resource-group "myResourceGroup" --scope-name "myPrivateLinkScope" -""" - -helps['connectedmachine private-endpoint-connection wait'] = """ - type: command - short-summary: Place the CLI in a waiting state until a condition of the connectedmachine \ -private-endpoint-connection is met. - examples: - - name: Pause executing next line of CLI script until the connectedmachine private-endpoint-connection is \ -successfully updated. - text: |- - az connectedmachine private-endpoint-connection wait --name "private-endpoint-connection-name" \ ---resource-group "myResourceGroup" --scope-name "myPrivateLinkScope" --updated - - name: Pause executing next line of CLI script until the connectedmachine private-endpoint-connection is \ -successfully deleted. - text: |- - az connectedmachine private-endpoint-connection wait --name "private-endpoint-connection-name" \ ---resource-group "myResourceGroup" --scope-name "myPrivateLinkScope" --deleted -""" diff --git a/src/connectedmachine/azext_connectedmachine/generated/_params.py b/src/connectedmachine/azext_connectedmachine/generated/_params.py index f689d6708ec..95d3febe8dc 100644 --- a/src/connectedmachine/azext_connectedmachine/generated/_params.py +++ b/src/connectedmachine/azext_connectedmachine/generated/_params.py @@ -29,199 +29,8 @@ def load_arguments(self, _): - with self.argument_context('connectedmachine list') as c: - c.argument('resource_group_name', resource_group_name_type) - - with self.argument_context('connectedmachine show') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('machine_name', options_list=['--name', '-n', '--machine-name'], help='The name of the ' - 'hybrid machine.', id_part='name') - - with self.argument_context('connectedmachine delete') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('machine_name', options_list=['--name', '-n', '--machine-name'], help='The name of the ' - 'hybrid machine.', id_part='name') - - with self.argument_context('connectedmachine extension list') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('machine_name', help='The name of the machine containing the extension.') - c.argument('expand', help='The expand expression to apply on the operation.') - - with self.argument_context('connectedmachine extension show') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('machine_name', help='The name of the machine containing the extension.', id_part='name') - c.argument('name', help='The name of the machine extension.', id_part='child_name_1') - - with self.argument_context('connectedmachine extension create') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('machine_name', help='The name of the machine where the extension should be created or ' - 'updated.') - c.argument('name', help='The name of the machine extension.') - c.argument('tags', tags_type) - c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, - validator=get_default_location_from_resource_group) - c.argument('force_update_tag', help='How the extension handler should be forced to update even if ' - 'the extension configuration has not changed.') - c.argument('publisher', type=str, help='The name of the extension handler publisher.') - c.argument('type_', options_list=['--type'], help='Specify the type of the extension; an example ' - 'is "CustomScriptExtension".') - c.argument('type_handler_version', type=str, help='Specify the version of the script handler.') - c.argument('enable_auto_upgrade', arg_type=get_three_state_flag(), help='Indicate whether the extension ' - 'should be automatically upgraded by the platform if there is a newer version available.') - c.argument('auto_upgrade_minor', arg_type=get_three_state_flag(), help='Indicate whether the extension should ' - 'use a newer minor version if one is available at deployment time. Once deployed, however, the ' - 'extension will not upgrade minor versions unless redeployed, even with this property set to true.') - c.argument('settings', type=validate_file_or_dict, help='Json formatted public settings for the extension. ' - 'Expected value: json-string/json-file/@json-file.') - c.argument('protected_settings', type=validate_file_or_dict, help='The extension can contain either ' - 'protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. Expected ' - 'value: json-string/json-file/@json-file.') - c.argument('instance_view_type', help='Specify the type of the extension; an example is ' - '"CustomScriptExtension".', arg_group='Instance View') - c.argument('inst_handler_version', help='Specify the version of the script handler.', - arg_group='Instance View') - c.argument('status', action=AddStatus, nargs='+', help='Instance view status.', arg_group='Instance View') - - with self.argument_context('connectedmachine extension update') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('machine_name', help='The name of the machine where the extension should be created or ' - 'updated.', id_part='name') - c.argument('name', help='The name of the machine extension.', id_part='child_name_1') - c.argument('tags', tags_type) - c.argument('force_update_tag', help='How the extension handler should be forced to update even if ' - 'the extension configuration has not changed.') - c.argument('publisher', help='The name of the extension handler publisher.') - c.argument('type_', options_list=['--type'], help='Specify the type of the extension; an example ' - 'is "CustomScriptExtension".') - c.argument('type_handler_version', help='Specify the version of the script handler.') - c.argument('enable_auto_upgrade', arg_type=get_three_state_flag(), help='Indicate whether the extension ' - 'should be automatically upgraded by the platform if there is a newer version available.') - c.argument('auto_upgrade_minor', arg_type=get_three_state_flag(), help='Indicate whether the extension should ' - 'use a newer minor version if one is available at deployment time. Once deployed, however, the ' - 'extension will not upgrade minor versions unless redeployed, even with this property set to true.') - c.argument('settings', type=validate_file_or_dict, help='Json formatted public settings for the extension. ' - 'Expected value: json-string/json-file/@json-file.') - c.argument('protected_settings', type=validate_file_or_dict, help='The extension can contain either ' - 'protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. Expected ' - 'value: json-string/json-file/@json-file.') - - with self.argument_context('connectedmachine extension delete') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('machine_name', help='The name of the machine where the extension should be deleted.', - id_part='name') - c.argument('name', help='The name of the machine extension.', id_part='child_name_1') - - with self.argument_context('connectedmachine extension wait') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('machine_name', help='The name of the machine containing the extension.', id_part='name') - c.argument('name', help='The name of the machine extension.', id_part='child_name_1') - - with self.argument_context('connectedmachine upgrade-extension') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('machine_name', help='The name of the hybrid machine.', id_part='name') - c.argument('extension_targets', type=validate_file_or_dict, help='Describe the Extension Target Properties. ' - 'Expected value: json-string/json-file/@json-file.') - - with self.argument_context('connectedmachine private-link-scope list') as c: - c.argument('resource_group_name', resource_group_name_type) - - with self.argument_context('connectedmachine private-link-scope show') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('scope_name', help='The name of the Azure Arc PrivateLinkScope resource.', - id_part='name') - - with self.argument_context('connectedmachine private-link-scope create') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('scope_name', help='The name of the Azure Arc PrivateLinkScope resource.') - c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, - validator=get_default_location_from_resource_group) - c.argument('tags', tags_type) - c.argument('public_network_access', arg_type=get_enum_type(['Enabled', 'Disabled']), help='Indicate whether ' - 'machines associated with the private link scope can also use public Azure Arc service endpoints.') - - with self.argument_context('connectedmachine private-link-scope update') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('scope_name', help='The name of the Azure Arc PrivateLinkScope resource.', - id_part='name') - c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, - validator=get_default_location_from_resource_group) - c.argument('tags', tags_type) - c.argument('public_network_access', arg_type=get_enum_type(['Enabled', 'Disabled']), help='Indicate whether ' - 'machines associated with the private link scope can also use public Azure Arc service endpoints.') - c.ignore('parameters') - - with self.argument_context('connectedmachine private-link-scope delete') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('scope_name', help='The name of the Azure Arc PrivateLinkScope resource.', - id_part='name') - - with self.argument_context('connectedmachine private-link-scope show-validation-detail') as c: - c.argument('location', arg_type=get_location_type(self.cli_ctx), id_part='name') - c.argument('private_link_scope_id', help='The id (Guid) of the Azure Arc PrivateLinkScope resource.', - id_part='child_name_1') - - with self.argument_context('connectedmachine private-link-scope show-validation-detail-for-machine') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('machine_name', help='The name of the target machine to get the private link scope ' - 'validation details for.', id_part='name') - with self.argument_context('connectedmachine private-link-scope update-tag') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('scope_name', help='The name of the Azure Arc PrivateLinkScope resource.', id_part='name') c.argument('tags', tags_type) - - with self.argument_context('connectedmachine private-link-scope wait') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('scope_name', help='The name of the Azure Arc PrivateLinkScope resource.', - id_part='name') - - with self.argument_context('connectedmachine private-link-resource list') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('scope_name', help='The name of the Azure Arc PrivateLinkScope resource.') - - with self.argument_context('connectedmachine private-link-resource show') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('scope_name', help='The name of the Azure Arc PrivateLinkScope resource.', - id_part='name') - c.argument('group_name', help='The name of the private link resource.', id_part='child_name_1') - - with self.argument_context('connectedmachine private-endpoint-connection list') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('scope_name', help='The name of the Azure Arc PrivateLinkScope resource.') - - with self.argument_context('connectedmachine private-endpoint-connection show') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('scope_name', help='The name of the Azure Arc PrivateLinkScope resource.', - id_part='name') - c.argument('private_endpoint_connection_name', options_list=['--name', '-n', '--private-endpoint-connection-nam' - 'e'], help='The name of the private ' - 'endpoint connection.', id_part='child_name_1') - - with self.argument_context('connectedmachine private-endpoint-connection update') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('scope_name', help='The name of the Azure Arc PrivateLinkScope resource.', - id_part='name') - c.argument('private_endpoint_connection_name', options_list=['--name', '-n', '--private-endpoint-connection-nam' - 'e'], help='The name of the private ' - 'endpoint connection.', id_part='child_name_1') - c.argument('connection_state', action=AddConnectionState, nargs='+', help='Connection state of the private ' - 'endpoint connection.') - c.argument('id_', options_list=['--id'], help='Resource id of the private endpoint.', - arg_group='Private Endpoint') - - with self.argument_context('connectedmachine private-endpoint-connection delete') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('scope_name', help='The name of the Azure Arc PrivateLinkScope resource.', - id_part='name') - c.argument('private_endpoint_connection_name', options_list=['--name', '-n', '--private-endpoint-connection-nam' - 'e'], help='The name of the private ' - 'endpoint connection.', id_part='child_name_1') - - with self.argument_context('connectedmachine private-endpoint-connection wait') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('scope_name', help='The name of the Azure Arc PrivateLinkScope resource.', - id_part='name') - c.argument('private_endpoint_connection_name', options_list=['--name', '-n', '--private-endpoint-connection-nam' - 'e'], help='The name of the private ' - 'endpoint connection.', id_part='child_name_1') diff --git a/src/connectedmachine/azext_connectedmachine/generated/commands.py b/src/connectedmachine/azext_connectedmachine/generated/commands.py index 8efa8eb102f..e4720496618 100644 --- a/src/connectedmachine/azext_connectedmachine/generated/commands.py +++ b/src/connectedmachine/azext_connectedmachine/generated/commands.py @@ -23,38 +23,6 @@ ) -connectedmachine_machine = CliCommandType( - operations_tmpl=( - 'azext_connectedmachine.vendored_sdks.connectedmachine.operations._machines_operations#MachinesOperations.{}' - ), - client_factory=cf_machine, -) - - -connectedmachine_ = CliCommandType( - operations_tmpl='azext_connectedmachine.vendored_sdks.connectedmachine.operations._connected_machine_operations#ConnectedMachineOperationsMixin.{}', - client_factory=cf_connectedmachine_cl, -) - - -connectedmachine_machine_extension = CliCommandType( - operations_tmpl='azext_connectedmachine.vendored_sdks.connectedmachine.operations._machine_extensions_operations#MachineExtensionsOperations.{}', - client_factory=cf_machine_extension, -) - - -connectedmachine_private_endpoint_connection = CliCommandType( - operations_tmpl='azext_connectedmachine.vendored_sdks.connectedmachine.operations._private_endpoint_connections_operations#PrivateEndpointConnectionsOperations.{}', - client_factory=cf_private_endpoint_connection, -) - - -connectedmachine_private_link_resource = CliCommandType( - operations_tmpl='azext_connectedmachine.vendored_sdks.connectedmachine.operations._private_link_resources_operations#PrivateLinkResourcesOperations.{}', - client_factory=cf_private_link_resource, -) - - connectedmachine_private_link_scope = CliCommandType( operations_tmpl='azext_connectedmachine.vendored_sdks.connectedmachine.operations._private_link_scopes_operations#PrivateLinkScopesOperations.{}', client_factory=cf_private_link_scope, @@ -62,60 +30,7 @@ def load_command_table(self, _): - - with self.command_group('connectedmachine', connectedmachine_machine, client_factory=cf_machine) as g: - g.custom_command('list', 'connectedmachine_list') - g.custom_show_command('show', 'connectedmachine_show') - g.custom_command('delete', 'connectedmachine_delete', confirmation=True) - - with self.command_group('connectedmachine', connectedmachine_, client_factory=cf_connectedmachine_cl) as g: - g.custom_command('upgrade-extension', 'connectedmachine_upgrade_extension') - - with self.command_group( - 'connectedmachine extension', connectedmachine_machine_extension, client_factory=cf_machine_extension - ) as g: - g.custom_command('list', 'connectedmachine_extension_list') - g.custom_show_command('show', 'connectedmachine_extension_show') - g.custom_command('create', 'connectedmachine_extension_create', supports_no_wait=True) - g.custom_command('update', 'connectedmachine_extension_update', supports_no_wait=True) - g.custom_command('delete', 'connectedmachine_extension_delete', supports_no_wait=True, confirmation=True) - g.custom_wait_command('wait', 'connectedmachine_extension_show') - - with self.command_group( - 'connectedmachine private-endpoint-connection', - connectedmachine_private_endpoint_connection, - client_factory=cf_private_endpoint_connection, - ) as g: - g.custom_command('list', 'connectedmachine_private_endpoint_connection_list') - g.custom_show_command('show', 'connectedmachine_private_endpoint_connection_show') - g.custom_command('update', 'connectedmachine_private_endpoint_connection_update', supports_no_wait=True) - g.custom_command( - 'delete', 'connectedmachine_private_endpoint_connection_delete', supports_no_wait=True, confirmation=True - ) - g.custom_wait_command('wait', 'connectedmachine_private_endpoint_connection_show') - - with self.command_group( - 'connectedmachine private-link-resource', - connectedmachine_private_link_resource, - client_factory=cf_private_link_resource, - ) as g: - g.custom_command('list', 'connectedmachine_private_link_resource_list') - g.custom_show_command('show', 'connectedmachine_private_link_resource_show') - with self.command_group( 'connectedmachine private-link-scope', connectedmachine_private_link_scope, client_factory=cf_private_link_scope ) as g: - g.custom_command('list', 'connectedmachine_private_link_scope_list') - g.custom_show_command('show', 'connectedmachine_private_link_scope_show') - g.custom_command('create', 'connectedmachine_private_link_scope_create') - g.generic_update_command('update', custom_func_name='connectedmachine_private_link_scope_update') - g.custom_command( - 'delete', 'connectedmachine_private_link_scope_delete', supports_no_wait=True, confirmation=True - ) - g.custom_command('show-validation-detail', 'connectedmachine_private_link_scope_show_validation_detail') - g.custom_command( - 'show-validation-detail-for-machine', - 'connectedmachine_private_link_scope_show_validation_detail_for_machine', - ) g.custom_command('update-tag', 'connectedmachine_private_link_scope_update_tag') - g.custom_wait_command('wait', 'connectedmachine_private_link_scope_show') diff --git a/src/connectedmachine/azext_connectedmachine/generated/custom.py b/src/connectedmachine/azext_connectedmachine/generated/custom.py index a5cb1502d3f..f428da912c8 100644 --- a/src/connectedmachine/azext_connectedmachine/generated/custom.py +++ b/src/connectedmachine/azext_connectedmachine/generated/custom.py @@ -13,245 +13,6 @@ from azure.cli.core.util import sdk_no_wait -def connectedmachine_list(client, - resource_group_name=None): - if resource_group_name: - return client.list_by_resource_group(resource_group_name=resource_group_name) - return client.list_by_subscription() - - -def connectedmachine_show(client, - resource_group_name, - machine_name): - return client.get(resource_group_name=resource_group_name, - machine_name=machine_name, - expand="instanceView") - - -def connectedmachine_delete(client, - resource_group_name, - machine_name): - return client.delete(resource_group_name=resource_group_name, - machine_name=machine_name) - - -def connectedmachine_extension_list(client, - resource_group_name, - machine_name, - expand=None): - return client.list(resource_group_name=resource_group_name, - machine_name=machine_name, - expand=expand) - - -def connectedmachine_extension_show(client, - resource_group_name, - machine_name, - name): - return client.get(resource_group_name=resource_group_name, - machine_name=machine_name, - extension_name=name) - - -def connectedmachine_extension_create(client, - resource_group_name, - machine_name, - name, - location, - tags=None, - force_update_tag=None, - publisher=None, - type_=None, - type_handler_version=None, - enable_auto_upgrade=None, - auto_upgrade_minor=None, - settings=None, - protected_settings=None, - instance_view_type=None, - inst_handler_version=None, - status=None, - no_wait=False): - extension_parameters = {} - if tags is not None: - extension_parameters['tags'] = tags - extension_parameters['location'] = location - extension_parameters['properties'] = {} - if force_update_tag is not None: - extension_parameters['properties']['force_update_tag'] = force_update_tag - if publisher is not None: - extension_parameters['properties']['publisher'] = publisher - if type_ is not None: - extension_parameters['properties']['type'] = type_ - if type_handler_version is not None: - extension_parameters['properties']['type_handler_version'] = type_handler_version - if enable_auto_upgrade is not None: - extension_parameters['properties']['enable_automatic_upgrade'] = enable_auto_upgrade - if auto_upgrade_minor is not None: - extension_parameters['properties']['auto_upgrade_minor_version'] = auto_upgrade_minor - if settings is not None: - extension_parameters['properties']['settings'] = settings - if protected_settings is not None: - extension_parameters['properties']['protected_settings'] = protected_settings - extension_parameters['properties']['instance_view'] = {} - extension_parameters['properties']['instance_view']['name'] = name - if instance_view_type is not None: - extension_parameters['properties']['instance_view']['type'] = instance_view_type - if inst_handler_version is not None: - extension_parameters['properties']['instance_view']['type_handler_version'] = inst_handler_version - if status is not None: - extension_parameters['properties']['instance_view']['status'] = status - if len(extension_parameters['properties']['instance_view']) == 0: - del extension_parameters['properties']['instance_view'] - return sdk_no_wait(no_wait, - client.begin_create_or_update, - resource_group_name=resource_group_name, - machine_name=machine_name, - extension_name=name, - extension_parameters=extension_parameters) - - -def connectedmachine_extension_update(client, - resource_group_name, - machine_name, - name, - tags=None, - force_update_tag=None, - publisher=None, - type_=None, - type_handler_version=None, - enable_auto_upgrade=None, - auto_upgrade_minor=None, - settings=None, - protected_settings=None, - no_wait=False): - extension_parameters = {} - if tags is not None: - extension_parameters['tags'] = tags - extension_parameters['properties'] = {} - if force_update_tag is not None: - extension_parameters['properties']['force_update_tag'] = force_update_tag - if publisher is not None: - extension_parameters['properties']['publisher'] = publisher - if type_ is not None: - extension_parameters['properties']['type'] = type_ - if type_handler_version is not None: - extension_parameters['properties']['type_handler_version'] = type_handler_version - if enable_auto_upgrade is not None: - extension_parameters['properties']['enable_automatic_upgrade'] = enable_auto_upgrade - if auto_upgrade_minor is not None: - extension_parameters['properties']['auto_upgrade_minor_version'] = auto_upgrade_minor - if settings is not None: - extension_parameters['properties']['settings'] = settings - if protected_settings is not None: - extension_parameters['properties']['protected_settings'] = protected_settings - if len(extension_parameters['properties']) == 0: - del extension_parameters['properties'] - return sdk_no_wait(no_wait, - client.begin_update, - resource_group_name=resource_group_name, - machine_name=machine_name, - extension_name=name, - extension_parameters=extension_parameters) - - -def connectedmachine_extension_delete(client, - resource_group_name, - machine_name, - name, - no_wait=False): - return sdk_no_wait(no_wait, - client.begin_delete, - resource_group_name=resource_group_name, - machine_name=machine_name, - extension_name=name) - - -def connectedmachine_upgrade_extension(client, - resource_group_name, - machine_name, - extension_targets=None): - extension_upgrade_parameters = {} - if extension_targets is not None: - extension_upgrade_parameters['extension_targets'] = extension_targets - return client.begin_upgrade_extensions(resource_group_name=resource_group_name, - machine_name=machine_name, - extension_upgrade_parameters=extension_upgrade_parameters) - - -def connectedmachine_private_link_scope_list(client, - resource_group_name=None): - if resource_group_name: - return client.list_by_resource_group(resource_group_name=resource_group_name) - return client.list() - - -def connectedmachine_private_link_scope_show(client, - resource_group_name, - scope_name): - return client.get(resource_group_name=resource_group_name, - scope_name=scope_name) - - -def connectedmachine_private_link_scope_create(client, - resource_group_name, - scope_name, - location, - tags=None, - public_network_access=None): - parameters = {} - parameters['location'] = location - if tags is not None: - parameters['tags'] = tags - parameters['properties'] = {} - if public_network_access is not None: - parameters['properties']['public_network_access'] = public_network_access - else: - parameters['properties']['public_network_access'] = "Disabled" - if len(parameters['properties']) == 0: - del parameters['properties'] - return client.create_or_update(resource_group_name=resource_group_name, - scope_name=scope_name, - parameters=parameters) - - -def connectedmachine_private_link_scope_update(instance, - resource_group_name, - scope_name, - location, - tags=None, - public_network_access=None): - instance.location = location - if tags is not None: - instance.tags = tags - if public_network_access is not None: - instance.properties.public_network_access = public_network_access - return instance - - -def connectedmachine_private_link_scope_delete(client, - resource_group_name, - scope_name, - no_wait=False): - return sdk_no_wait(no_wait, - client.begin_delete, - resource_group_name=resource_group_name, - scope_name=scope_name) - - -def connectedmachine_private_link_scope_show_validation_detail(client, - location, - private_link_scope_id): - return client.get_validation_details(location=location, - private_link_scope_id=private_link_scope_id) - - -def connectedmachine_private_link_scope_show_validation_detail_for_machine(client, - resource_group_name, - machine_name): - return client.get_validation_details_for_machine(resource_group_name=resource_group_name, - machine_name=machine_name) - - def connectedmachine_private_link_scope_update_tag(client, resource_group_name, scope_name, @@ -262,71 +23,3 @@ def connectedmachine_private_link_scope_update_tag(client, return client.update_tags(resource_group_name=resource_group_name, scope_name=scope_name, private_link_scope_tags=private_link_scope_tags) - - -def connectedmachine_private_link_resource_list(client, - resource_group_name, - scope_name): - return client.list_by_private_link_scope(resource_group_name=resource_group_name, - scope_name=scope_name) - - -def connectedmachine_private_link_resource_show(client, - resource_group_name, - scope_name, - group_name): - return client.get(resource_group_name=resource_group_name, - scope_name=scope_name, - group_name=group_name) - - -def connectedmachine_private_endpoint_connection_list(client, - resource_group_name, - scope_name): - return client.list_by_private_link_scope(resource_group_name=resource_group_name, - scope_name=scope_name) - - -def connectedmachine_private_endpoint_connection_show(client, - resource_group_name, - scope_name, - private_endpoint_connection_name): - return client.get(resource_group_name=resource_group_name, - scope_name=scope_name, - private_endpoint_connection_name=private_endpoint_connection_name) - - -def connectedmachine_private_endpoint_connection_update(client, - resource_group_name, - scope_name, - private_endpoint_connection_name, - connection_state=None, - id_=None, - no_wait=False): - parameters = {} - parameters['properties'] = {} - if connection_state is not None: - parameters['properties']['private_link_service_connection_state'] = connection_state - parameters['properties']['private_endpoint'] = {} - if id_ is not None: - parameters['properties']['private_endpoint']['id'] = id_ - if len(parameters['properties']['private_endpoint']) == 0: - del parameters['properties']['private_endpoint'] - return sdk_no_wait(no_wait, - client.begin_update, - resource_group_name=resource_group_name, - scope_name=scope_name, - private_endpoint_connection_name=private_endpoint_connection_name, - parameters=parameters) - - -def connectedmachine_private_endpoint_connection_delete(client, - resource_group_name, - scope_name, - private_endpoint_connection_name, - no_wait=False): - return sdk_no_wait(no_wait, - client.begin_delete, - resource_group_name=resource_group_name, - scope_name=scope_name, - private_endpoint_connection_name=private_endpoint_connection_name) diff --git a/src/connectedmachine/azext_connectedmachine/manual/commands.py b/src/connectedmachine/azext_connectedmachine/manual/commands.py index 8ba207ac56f..efdeb3eec37 100644 --- a/src/connectedmachine/azext_connectedmachine/manual/commands.py +++ b/src/connectedmachine/azext_connectedmachine/manual/commands.py @@ -63,9 +63,7 @@ def load_command_table(self, _): - - with self.command_group('connectedmachine', connectedmachine_machine, client_factory=cf_machine) as g: - g.custom_command('list', 'connectedmachine_list', table_transformer=transform_machine_list) + pass def transform_machine_list(result): diff --git a/src/connectedmachine/azext_connectedmachine/tests/latest/recordings/test_ConnectedMachineAndExtension_Scenario.yaml b/src/connectedmachine/azext_connectedmachine/tests/latest/recordings/test_ConnectedMachineAndExtension_Scenario.yaml deleted file mode 100644 index 5617d55cacc..00000000000 --- a/src/connectedmachine/azext_connectedmachine/tests/latest/recordings/test_ConnectedMachineAndExtension_Scenario.yaml +++ /dev/null @@ -1,790 +0,0 @@ -interactions: -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - connectedmachine show - Connection: - - keep-alive - ParameterSetName: - - -n -g - User-Agent: - - AZURECLI/2.32.0 azsdk-python-mgmt-hybridcompute/1.0.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/az-sdk-test/providers/Microsoft.HybridCompute/machines/testMachine?api-version=2022-03-10&$expand=instanceView - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/az-sdk-test/providers/Microsoft.HybridCompute/machines/testMachine","name":"testMachine","location":"eastus2euap","tags":{},"identity":{"type":"SystemAssigned","principalId":"fc9a4766-a5d2-41d3-8fdd-3a32ddb4343a","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47"},"type":"Microsoft.HybridCompute/machines","properties":{"provisioningState":"Succeeded","agentVersion":"1.18.01965.249","status":"Connected","lastStatusChange":"2022-05-23T22:55:52.7801454Z","errorDetails":[],"displayName":"DorothysSurface","machineFqdn":"DorothysSurface","osName":"windows","osVersion":"10.0.19044.1645","osType":"windows","osProfile":{"computerName":"DorothysSurface"},"vmId":"194cde1e-8ee6-425e-b231-a9ec7ecec8d8","vmUuid":"2883CCA3-7EE6-60E9-A204-97718B655D1D","clientPublicKey":"MIIBCgKCAQEAzLWw7rpNN42u19EbdGGfI0+aqdQKwbQA+Dh6iBsIgJM4R2uyuMiZxB+ek6pq3XhM9aQ7Kuooo7vNzIEGLI/RHMS+rMNrFQcQpqmKTKV8NDb2KB/1siovUL2vNXl2X8D8a0/y2MDk/ID1KCXF0bQlmaP5Rji8E9bb+owJNKvfgp2S+0N9Vu9VfBlewzztpwJJKqnBkzAR76ehfTYpmHpoYlvYxtWFGrpri2sEOSsRLf6QgzFy6vPxnYgDfMw/hC3X7x1BmFVBcY8QrGhJ/Nu6ZHsfwrH6PiK8XB58R0OyIRWcKK1FtEt3j2lTdkd7bsl8NBeQDm8L7deSRSIiPAc4pwIDAQAB","osSku":"Windows - 10 Enterprise","domainName":"WORKGROUP","adFqdn":"DorothysSurface","dnsFqdn":"DorothysSurface","mssqlDiscovered":"false","cloudMetadata":{"provider":"N/A"},"detectedProperties":{"cloudprovider":"N/A","manufacturer":"Microsoft - Corporation","model":"Surface Book 2","mssqldiscovered":"false"},"agentConfiguration":{"proxyUrl":"","incomingConnectionsPorts":[],"extensionsAllowList":[],"extensionsBlockList":[],"proxyBypass":[],"extensionsEnabled":"true","guestConfigurationEnabled":"true"},"serviceStatuses":{"extensionService":{"status":"running","startupType":"automatic"},"guestConfigurationService":{"status":"running","startupType":"automatic"}}},"resources":[]}' - headers: - cache-control: - - no-cache - content-length: - - '1882' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 May 2022 23:00:44 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Kestrel - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - connectedmachine list - Connection: - - keep-alive - ParameterSetName: - - -g - User-Agent: - - AZURECLI/2.32.0 azsdk-python-mgmt-hybridcompute/1.0.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/az-sdk-test/providers/Microsoft.HybridCompute/machines?api-version=2022-03-10 - response: - body: - string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/az-sdk-test/providers/Microsoft.HybridCompute/machines/testMachine","name":"testMachine","location":"eastus2euap","tags":{},"identity":{"type":"SystemAssigned","principalId":"fc9a4766-a5d2-41d3-8fdd-3a32ddb4343a","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47"},"type":"Microsoft.HybridCompute/machines","properties":{"provisioningState":"Succeeded","agentVersion":"1.18.01965.249","status":"Connected","lastStatusChange":"2022-05-23T22:55:52.7801454Z","errorDetails":[],"displayName":"DorothysSurface","machineFqdn":"DorothysSurface","osName":"windows","osVersion":"10.0.19044.1645","osType":"windows","osProfile":{"computerName":"DorothysSurface"},"vmId":"194cde1e-8ee6-425e-b231-a9ec7ecec8d8","vmUuid":"2883CCA3-7EE6-60E9-A204-97718B655D1D","clientPublicKey":"MIIBCgKCAQEAzLWw7rpNN42u19EbdGGfI0+aqdQKwbQA+Dh6iBsIgJM4R2uyuMiZxB+ek6pq3XhM9aQ7Kuooo7vNzIEGLI/RHMS+rMNrFQcQpqmKTKV8NDb2KB/1siovUL2vNXl2X8D8a0/y2MDk/ID1KCXF0bQlmaP5Rji8E9bb+owJNKvfgp2S+0N9Vu9VfBlewzztpwJJKqnBkzAR76ehfTYpmHpoYlvYxtWFGrpri2sEOSsRLf6QgzFy6vPxnYgDfMw/hC3X7x1BmFVBcY8QrGhJ/Nu6ZHsfwrH6PiK8XB58R0OyIRWcKK1FtEt3j2lTdkd7bsl8NBeQDm8L7deSRSIiPAc4pwIDAQAB","osSku":"Windows - 10 Enterprise","domainName":"WORKGROUP","adFqdn":"DorothysSurface","dnsFqdn":"DorothysSurface","mssqlDiscovered":"false","cloudMetadata":{"provider":"N/A"},"detectedProperties":{"cloudprovider":"N/A","manufacturer":"Microsoft - Corporation","model":"Surface Book 2","mssqldiscovered":"false"},"agentConfiguration":{"proxyUrl":"","incomingConnectionsPorts":[],"extensionsAllowList":[],"extensionsBlockList":[],"proxyBypass":[],"extensionsEnabled":"true","guestConfigurationEnabled":"true"},"serviceStatuses":{"extensionService":{"status":"running","startupType":"automatic"},"guestConfigurationService":{"status":"running","startupType":"automatic"}}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/az-sdk-test/providers/Microsoft.HybridCompute/machines/dorothylinux2-Virtual-Machine","name":"dorothylinux2-Virtual-Machine","location":"eastus2euap","tags":{},"identity":{"type":"SystemAssigned","principalId":"5ce02094-bd55-44ba-b1e4-2d56b6a6ba69","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47"},"type":"Microsoft.HybridCompute/machines","properties":{"provisioningState":"Succeeded","agentVersion":"1.7.21162.005","status":"Expired","lastStatusChange":"2021-09-30T06:14:01.8555779Z","errorDetails":[],"displayName":"dorothylinux2-Virtual-Machine","machineFqdn":"dorothylinux2-Virtual-Machine","osName":"linux","osVersion":"5.8.0-59-generic","osType":"linux","osProfile":{"computerName":"dorothylinux2-Virtual-Machine","linuxConfiguration":{"patchSettings":{"assessmentMode":"null"}}},"vmId":"8948ef10-f369-471d-b363-8e2ff44614ca","vmUuid":"80f26cf0-d9a7-4637-a2ff-587bd51626fc","clientPublicKey":"MIIBCgKCAQEAukhdoNaMfaHRGP6MvgdWdyefHdET/mV0J3NdpMU+LFRE5IWwZxG+mGOb2lK3dsgX6HenWyRiumC2BMDX6RuLfRuscZw+HT/W4W/9ScDxbD18o4vECD7DmiFmIs4iPaF8GLTjO2fJzjAl59k7nblfr38SexA8EKo5WqG2LFhbT6CAXtBMPtWebWeZCQ3uXCri8838nDtqhQtqY6Efg4A2sEV9s4Mk7LjINpzcVuPYdvxcFngM22hixUawE9GH8UKIV5XF+/c8xk1b1fvUGizf+sNbgSMZFyJ3Vgg5ne5ibepxyR3WBtmvd3L/mF1negSh/5h9QQKTt7djeUYCb+ztjwIDAQAB","osSku":"Ubuntu - 20.04 LTS","domainName":"unknown","adFqdn":"unknown","dnsFqdn":"dorothylinux2-Virtual-Machine","mssqlDiscovered":"false","detectedProperties":{"cloudprovider":"N/A","manufacturer":"Microsoft - Corporation","model":"Virtual Machine","mssqldiscovered":"false"},"agentConfiguration":{}}}]}' - headers: - cache-control: - - no-cache - content-length: - - '3516' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 May 2022 23:00:45 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Kestrel - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: '{"location": "eastus2euap", "properties": {"publisher": "Microsoft.Compute", - "type": "CustomScriptExtension", "typeHandlerVersion": "1.10.10", "enableAutomaticUpgrade": - true, "settings": {"commandToExecute": "hostname"}, "instanceView": {"name": - "custom-000001"}}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - connectedmachine extension create - Connection: - - keep-alive - Content-Length: - - '264' - Content-Type: - - application/json - ParameterSetName: - - --name --location --enable-auto-upgrade --type --publisher --type-handler-version - --machine-name --resource-group --settings - User-Agent: - - AZURECLI/2.32.0 azsdk-python-mgmt-hybridcompute/1.0.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0) - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/az-sdk-test/providers/Microsoft.HybridCompute/machines/testMachine/extensions/custom-000001?api-version=2022-03-10 - response: - body: - string: '' - headers: - azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.HybridCompute/locations/eastus2euap/operationstatus/d3c75246-97de-491a-a4eb-01bee20c7d0b?api-version=2022-03-10 - cache-control: - - no-cache - content-length: - - '0' - content-type: - - application/json - date: - - Mon, 23 May 2022 23:00:49 GMT - expires: - - '-1' - location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.HybridCompute/locations/eastus2euap/operationresults/d3c75246-97de-491a-a4eb-01bee20c7d0b?api-version=2022-03-10 - pragma: - - no-cache - server: - - Kestrel - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-resource-requests: - - '319' - status: - code: 202 - message: Accepted -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - CommandName: - - connectedmachine extension create - Connection: - - keep-alive - ParameterSetName: - - --name --location --enable-auto-upgrade --type --publisher --type-handler-version - --machine-name --resource-group --settings - User-Agent: - - AZURECLI/2.32.0 azsdk-python-mgmt-hybridcompute/1.0.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.HybridCompute/locations/eastus2euap/operationstatus/d3c75246-97de-491a-a4eb-01bee20c7d0b?api-version=2022-03-10 - response: - body: - string: '{"name":"d3c75246-97de-491a-a4eb-01bee20c7d0b","status":"Succeeded","startTime":"2022-05-23T23:00:49.6799697Z","properties":{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/az-sdk-test/providers/Microsoft.HybridCompute/machines/testMachine/extensions/custom-000001","name":"custom-000001","location":"eastus2euap","type":"Microsoft.HybridCompute/machines/extensions","properties":{"publisher":"Microsoft.Compute","type":"CustomScriptExtension","typeHandlerVersion":"1.10.10","autoUpgradeMinorVersion":false,"enableAutomaticUpgrade":true,"settings":{"commandToExecute":"hostname"},"provisioningState":"Succeeded","instanceView":{"name":"custom-000001","type":"CustomScriptExtension","typeHandlerVersion":"1.10.10","status":{"code":"success","level":"Information","message":"Extension - Message: Command execution finished, StdOut: DorothysSurface\r\n"}}}}}' - headers: - cache-control: - - no-cache - content-length: - - '878' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 May 2022 23:02:49 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Kestrel - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - CommandName: - - connectedmachine extension create - Connection: - - keep-alive - ParameterSetName: - - --name --location --enable-auto-upgrade --type --publisher --type-handler-version - --machine-name --resource-group --settings - User-Agent: - - AZURECLI/2.32.0 azsdk-python-mgmt-hybridcompute/1.0.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/az-sdk-test/providers/Microsoft.HybridCompute/machines/testMachine/extensions/custom-000001?api-version=2022-03-10 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/az-sdk-test/providers/Microsoft.HybridCompute/machines/testMachine/extensions/custom-000001","name":"custom-000001","type":"Microsoft.HybridCompute/machines/extensions","location":"eastus2euap","properties":{"publisher":"Microsoft.Compute","type":"CustomScriptExtension","typeHandlerVersion":"1.10.10","autoUpgradeMinorVersion":false,"enableAutomaticUpgrade":true,"settings":{"commandToExecute":"hostname"},"provisioningState":"Succeeded","instanceView":{"name":"custom-000001","type":"CustomScriptExtension","typeHandlerVersion":"1.10.10","status":{"code":"success","level":"Information","message":"Extension - Message: Command execution finished, StdOut: DorothysSurface\r\n"}}}}' - headers: - cache-control: - - no-cache - content-length: - - '753' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 May 2022 23:02:49 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Kestrel - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - connectedmachine extension list - Connection: - - keep-alive - ParameterSetName: - - --machine-name -g - User-Agent: - - AZURECLI/2.32.0 azsdk-python-mgmt-hybridcompute/1.0.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/az-sdk-test/providers/Microsoft.HybridCompute/machines/testMachine/extensions?api-version=2022-03-10 - response: - body: - string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/az-sdk-test/providers/Microsoft.HybridCompute/machines/testMachine/extensions/custom-000001","name":"custom-000001","location":"eastus2euap","type":"Microsoft.HybridCompute/machines/extensions","properties":{"publisher":"Microsoft.Compute","type":"CustomScriptExtension","typeHandlerVersion":"1.10.10","autoUpgradeMinorVersion":false,"enableAutomaticUpgrade":true,"settings":{"commandToExecute":"hostname"},"provisioningState":"Succeeded","instanceView":{"name":"custom-000001","type":"CustomScriptExtension","typeHandlerVersion":"1.10.10","status":{"code":"success","level":"Information","message":"Extension - Message: Command execution finished, StdOut: DorothysSurface\r\n"}}}}]}' - headers: - cache-control: - - no-cache - content-length: - - '765' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 May 2022 23:02:50 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Kestrel - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - connectedmachine extension show - Connection: - - keep-alive - ParameterSetName: - - --name --machine-name --resource-group - User-Agent: - - AZURECLI/2.32.0 azsdk-python-mgmt-hybridcompute/1.0.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/az-sdk-test/providers/Microsoft.HybridCompute/machines/testMachine/extensions/custom-000001?api-version=2022-03-10 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/az-sdk-test/providers/Microsoft.HybridCompute/machines/testMachine/extensions/custom-000001","name":"custom-000001","type":"Microsoft.HybridCompute/machines/extensions","location":"eastus2euap","properties":{"publisher":"Microsoft.Compute","type":"CustomScriptExtension","typeHandlerVersion":"1.10.10","autoUpgradeMinorVersion":false,"enableAutomaticUpgrade":true,"settings":{"commandToExecute":"hostname"},"provisioningState":"Succeeded","instanceView":{"name":"custom-000001","type":"CustomScriptExtension","typeHandlerVersion":"1.10.10","status":{"code":"success","level":"Information","message":"Extension - Message: Command execution finished, StdOut: DorothysSurface\r\n"}}}}' - headers: - cache-control: - - no-cache - content-length: - - '753' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 May 2022 23:02:52 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Kestrel - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: '{"extensionTargets": {"Microsoft.Compute.CustomScriptExtension": {"targetVersion": - "1.10.12"}}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - connectedmachine upgrade-extension - Connection: - - keep-alive - Content-Length: - - '95' - Content-Type: - - application/json - ParameterSetName: - - --extension-targets --machine-name --resource-group - User-Agent: - - AZURECLI/2.32.0 azsdk-python-mgmt-hybridcompute/1.0.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0) - method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/az-sdk-test/providers/Microsoft.HybridCompute/machines/testMachine/upgradeExtensions?api-version=2022-03-10 - response: - body: - string: '' - headers: - azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.HybridCompute/locations/eastus2euap/operationstatus/ea8afb78-b38f-4179-b7da-f2a94486f3a1?api-version=2022-03-10 - cache-control: - - no-cache - content-length: - - '0' - content-type: - - application/json - date: - - Mon, 23 May 2022 23:02:53 GMT - expires: - - '-1' - location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.HybridCompute/locations/eastus2euap/operationresults/ea8afb78-b38f-4179-b7da-f2a94486f3a1?api-version=2022-03-10 - pragma: - - no-cache - server: - - Kestrel - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1199' - status: - code: 202 - message: Accepted -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - CommandName: - - connectedmachine upgrade-extension - Connection: - - keep-alive - ParameterSetName: - - --extension-targets --machine-name --resource-group - User-Agent: - - AZURECLI/2.32.0 azsdk-python-mgmt-hybridcompute/1.0.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.HybridCompute/locations/eastus2euap/operationstatus/ea8afb78-b38f-4179-b7da-f2a94486f3a1?api-version=2022-03-10 - response: - body: - string: '{"name":"ea8afb78-b38f-4179-b7da-f2a94486f3a1","status":"Succeeded","startTime":"2022-05-23T23:02:53.8776167Z","properties":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/az-sdk-test/providers/Microsoft.HybridCompute/machines/testMachine/extensions/custom-000001","name":"custom-000001","type":"Microsoft.HybridCompute/machines/extensions","location":"eastus2euap","properties":{"publisher":"Microsoft.Compute","type":"CustomScriptExtension","typeHandlerVersion":"1.10.12","autoUpgradeMinorVersion":false,"enableAutomaticUpgrade":false,"settings":{"commandToExecute":"hostname"},"provisioningState":"Succeeded","instanceView":{"name":"custom-000001","type":"CustomScriptExtension","typeHandlerVersion":"1.10.12","status":{"code":"success","level":"Information","message":"Extension - Message: Command execution finished, StdOut: DorothysSurface\r\n"}}}}]}' - headers: - cache-control: - - no-cache - content-length: - - '881' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 May 2022 23:07:54 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Kestrel - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - CommandName: - - connectedmachine upgrade-extension - Connection: - - keep-alive - ParameterSetName: - - --extension-targets --machine-name --resource-group - User-Agent: - - AZURECLI/2.32.0 azsdk-python-mgmt-hybridcompute/1.0.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.HybridCompute/locations/eastus2euap/operationresults/ea8afb78-b38f-4179-b7da-f2a94486f3a1?api-version=2022-03-10 - response: - body: - string: '[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/az-sdk-test/providers/Microsoft.HybridCompute/machines/testMachine/extensions/custom-000001","name":"custom-000001","type":"Microsoft.HybridCompute/machines/extensions","location":"eastus2euap","properties":{"publisher":"Microsoft.Compute","type":"CustomScriptExtension","typeHandlerVersion":"1.10.12","autoUpgradeMinorVersion":false,"enableAutomaticUpgrade":false,"settings":{"commandToExecute":"hostname"},"provisioningState":"Succeeded","instanceView":{"name":"custom-000001","type":"CustomScriptExtension","typeHandlerVersion":"1.10.12","status":{"code":"success","level":"Information","message":"Extension - Message: Command execution finished, StdOut: DorothysSurface\r\n"}}}}]' - headers: - cache-control: - - no-cache - content-length: - - '756' - content-type: - - application/json - date: - - Mon, 23 May 2022 23:07:54 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Kestrel - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: '{"properties": {"enableAutomaticUpgrade": false, "settings": {"commandToExecute": - "dir"}}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - connectedmachine extension update - Connection: - - keep-alive - Content-Length: - - '90' - Content-Type: - - application/json - ParameterSetName: - - --name --enable-auto-upgrade --settings --machine-name --resource-group - User-Agent: - - AZURECLI/2.32.0 azsdk-python-mgmt-hybridcompute/1.0.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0) - method: PATCH - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/az-sdk-test/providers/Microsoft.HybridCompute/machines/testMachine/extensions/custom-000001?api-version=2022-03-10 - response: - body: - string: '' - headers: - azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.HybridCompute/locations/eastus2euap/operationstatus/44ade452-9ccb-4611-9e84-fdad48bffc87?api-version=2022-03-10 - cache-control: - - no-cache - content-length: - - '0' - content-type: - - application/json - date: - - Mon, 23 May 2022 23:07:56 GMT - expires: - - '-1' - location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.HybridCompute/locations/eastus2euap/operationresults/44ade452-9ccb-4611-9e84-fdad48bffc87?api-version=2022-03-10 - pragma: - - no-cache - server: - - Kestrel - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-resource-requests: - - '319' - status: - code: 202 - message: Accepted -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - CommandName: - - connectedmachine extension update - Connection: - - keep-alive - ParameterSetName: - - --name --enable-auto-upgrade --settings --machine-name --resource-group - User-Agent: - - AZURECLI/2.32.0 azsdk-python-mgmt-hybridcompute/1.0.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.HybridCompute/locations/eastus2euap/operationstatus/44ade452-9ccb-4611-9e84-fdad48bffc87?api-version=2022-03-10 - response: - body: - string: '{"name":"44ade452-9ccb-4611-9e84-fdad48bffc87","status":"Succeeded","startTime":"2022-05-23T23:07:56.9038639Z","properties":{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/az-sdk-test/providers/Microsoft.HybridCompute/machines/testMachine/extensions/custom-000001","name":"custom-000001","location":"eastus2euap","type":"Microsoft.HybridCompute/machines/extensions","properties":{"publisher":"Microsoft.Compute","type":"CustomScriptExtension","typeHandlerVersion":"1.10.12","autoUpgradeMinorVersion":false,"enableAutomaticUpgrade":false,"settings":{"commandToExecute":"dir"},"provisioningState":"Succeeded","instanceView":{"name":"custom-000001","type":"CustomScriptExtension","typeHandlerVersion":"1.10.12","status":{"code":"success","level":"Information","message":"Extension - Message: Command execution finished, StdOut: Volume in drive C has no label.\r\n - Volume Serial Number is 867D-A9DE\r\n\r\n Directory of C:\\Packages\\Plugins\\Microsoft.Compute.CustomScriptExtension\\1.10.12\\Downloads\\1\r\n\r\n05/23/2022 04:08 - PM