diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 695d660d7ec..8ea48788f5a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -267,3 +267,5 @@ /src/billing-benefits/ @gaoyp830 @rkapso @msft-adrianma @sornaks /src/mobile-network/ @jsntcy + +/src/automanage/ @calvinhzy diff --git a/src/automanage/HISTORY.rst b/src/automanage/HISTORY.rst new file mode 100644 index 00000000000..8c34bccfff8 --- /dev/null +++ b/src/automanage/HISTORY.rst @@ -0,0 +1,8 @@ +.. :changelog: + +Release History +=============== + +0.1.0 +++++++ +* Initial release. \ No newline at end of file diff --git a/src/automanage/README.md b/src/automanage/README.md new file mode 100644 index 00000000000..c6ab5b3f969 --- /dev/null +++ b/src/automanage/README.md @@ -0,0 +1,39 @@ +# Azure CLI Automanage Extension # +This is an extension to Azure CLI to manage Automanage resources. + +## How to use ## +# configuration-profile +Create a configuration-profile +`az automanage configuration-profile create -n {profile_name} -g {rg} --configuration {"Antimalware/Enable":false,"Backup/Enable":false,"VMInsights/Enable":true,"AzureSecurityCenter/Enable":true,"UpdateManagement/Enable":true,"ChangeTrackingAndInventory/Enable":true,"GuestConfiguration/Enable":true,"LogAnalytics/Enable":true,"BootDiagnostics/Enable":true}` + +Show a configuration-profile +`az automanage configuration-profile show -n {profile_name} -g {rg}` + +Update a configuration-profile +`az automanage configuration-profile update -n {profile_name} -g {rg} --configuration {"Antimalware/Enable":true,"VMInsights/Enable":false}` + +List configuration-profiles +`az automanage configuration-profile list -g {rg}` + +Delete a configuration-profile +`az automanage configuration-profile delete -n {profile_name} -g {rg}` + +# configuration-profile-assignment +Create a configuration-profile-assignment for vm +`az automanage configuration-profile-assignment vm create -n default -g {rg} --vm-name {vm_name} --configuration-profile {profile_id}` + +Show a configuration-profile-assignment for vm +`az automanage configuration-profile-assignment vm show -n default -g {rg} --vm-name {vm_name}` + +Update a configuration-profile-assignment for vm +`az automanage configuration-profile-assignment vm update --n default -g {rg} --vm-name {vm_name} --configuration-profile {profile_id_2}` + +Delete configuration-profile-assignment for vm +`az automanage configuration-profile-assignment vm delete -n default -g {rg} --vm-name {vm_name}` + +Create a configuration-profile-assignment for arc +`az automanage configuration-profile-assignment arc create -n default -g {rg} --machine-name {arc_name} --configuration-profile {profile_id}` + +# configuration-profile-assignment report +List configuration-profile-assignment report for vm +`az automanage configuration-profile-assignment vm report list --assignment-name default -g {rg} --vm-name {vm_name}` \ No newline at end of file diff --git a/src/automanage/azext_automanage/__init__.py b/src/automanage/azext_automanage/__init__.py new file mode 100644 index 00000000000..9b48da13837 --- /dev/null +++ b/src/automanage/azext_automanage/__init__.py @@ -0,0 +1,42 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +from azure.cli.core import AzCommandsLoader +from azext_automanage._help import helps # pylint: disable=unused-import + + +class AutomanageCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + custom_command_type = CliCommandType( + operations_tmpl='azext_automanage.custom#{}') + super().__init__(cli_ctx=cli_ctx, + custom_command_type=custom_command_type) + + def load_command_table(self, args): + from azext_automanage.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) + return self.command_table + + def load_arguments(self, command): + from azext_automanage._params import load_arguments + load_arguments(self, command) + + +COMMAND_LOADER_CLS = AutomanageCommandsLoader diff --git a/src/automanage/azext_automanage/_help.py b/src/automanage/azext_automanage/_help.py new file mode 100644 index 00000000000..126d5d00714 --- /dev/null +++ b/src/automanage/azext_automanage/_help.py @@ -0,0 +1,11 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long +# pylint: disable=too-many-lines + +from knack.help_files import helps # pylint: disable=unused-import diff --git a/src/automanage/azext_automanage/_params.py b/src/automanage/azext_automanage/_params.py new file mode 100644 index 00000000000..cfcec717c9c --- /dev/null +++ b/src/automanage/azext_automanage/_params.py @@ -0,0 +1,13 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + + +def load_arguments(self, _): # pylint: disable=unused-argument + pass diff --git a/src/automanage/azext_automanage/aaz/__init__.py b/src/automanage/azext_automanage/aaz/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/automanage/azext_automanage/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/automanage/azext_automanage/aaz/latest/__init__.py b/src/automanage/azext_automanage/aaz/latest/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/automanage/azext_automanage/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/automanage/azext_automanage/aaz/latest/automanage/__cmd_group.py b/src/automanage/azext_automanage/aaz/latest/automanage/__cmd_group.py new file mode 100644 index 00000000000..d578704b52c --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/__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( + "automanage", +) +class __CMDGroup(AAZCommandGroup): + """Manage Automanage + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/__init__.py b/src/automanage/azext_automanage/aaz/latest/automanage/__init__.py new file mode 100644 index 00000000000..5a9d61963d6 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/__init__.py @@ -0,0 +1,11 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/best_practice/__cmd_group.py b/src/automanage/azext_automanage/aaz/latest/automanage/best_practice/__cmd_group.py new file mode 100644 index 00000000000..3f67f002f5d --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/best_practice/__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( + "automanage best-practice", +) +class __CMDGroup(AAZCommandGroup): + """Manage Automanage best practice + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/best_practice/__init__.py b/src/automanage/azext_automanage/aaz/latest/automanage/best_practice/__init__.py new file mode 100644 index 00000000000..2df85698253 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/best_practice/__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/automanage/azext_automanage/aaz/latest/automanage/best_practice/_list.py b/src/automanage/azext_automanage/aaz/latest/automanage/best_practice/_list.py new file mode 100644 index 00000000000..59a953e0e76 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/best_practice/_list.py @@ -0,0 +1,167 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage best-practice list", +) +class List(AAZCommand): + """List Automanage best practices + + :example: List best practices + az automanage best-practice list + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/providers/microsoft.automanage/bestpractices", "2022-05-04"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + def _execute_operations(self): + self.pre_operations() + self.BestPracticesListByTenant(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 BestPracticesListByTenant(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/providers/Microsoft.Automanage/bestPractices", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.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.configuration = AAZFreeFormDictType() + + 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/automanage/azext_automanage/aaz/latest/automanage/best_practice/_show.py b/src/automanage/azext_automanage/aaz/latest/automanage/best_practice/_show.py new file mode 100644 index 00000000000..c66e637020c --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/best_practice/_show.py @@ -0,0 +1,189 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage best-practice show", +) +class Show(AAZCommand): + """Get information about a Automanage best practice + + :example: Show best-practice + az automanage best-practice show --best-practice-name {} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/providers/microsoft.automanage/bestpractices/{}", "2022-05-04"], + ] + } + + 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.best_practice_name = AAZStrArg( + options=["--best-practice-name"], + help="The Automanage best practice name.", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.BestPracticesGet(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 BestPracticesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/providers/Microsoft.Automanage/bestPractices/{bestPracticeName}", + **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( + "bestPracticeName", self.ctx.args.best_practice_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + 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.configuration = AAZFreeFormDictType() + + 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/automanage/azext_automanage/aaz/latest/automanage/best_practice/version/__cmd_group.py b/src/automanage/azext_automanage/aaz/latest/automanage/best_practice/version/__cmd_group.py new file mode 100644 index 00000000000..903321f1080 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/best_practice/version/__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( + "automanage best-practice version", +) +class __CMDGroup(AAZCommandGroup): + """Manage Automanage best practice version + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/best_practice/version/__init__.py b/src/automanage/azext_automanage/aaz/latest/automanage/best_practice/version/__init__.py new file mode 100644 index 00000000000..2df85698253 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/best_practice/version/__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/automanage/azext_automanage/aaz/latest/automanage/best_practice/version/_list.py b/src/automanage/azext_automanage/aaz/latest/automanage/best_practice/version/_list.py new file mode 100644 index 00000000000..435023ae6db --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/best_practice/version/_list.py @@ -0,0 +1,195 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage best-practice version list", +) +class List(AAZCommand): + """List Automanage best practice versions + + :example: List best-practice versions + az automanage best-practice version list --best-practice-name {} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/providers/microsoft.automanage/bestpractices/{}/versions", "2022-05-04"], + ] + } + + 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.best_practice_name = AAZStrArg( + options=["--best-practice-name"], + help="The Automanage best practice name.", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.BestPracticesVersionsListByTenant(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 BestPracticesVersionsListByTenant(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/providers/Microsoft.Automanage/bestPractices/{bestPracticeName}/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( + "bestPracticeName", self.ctx.args.best_practice_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.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.configuration = AAZFreeFormDictType() + + 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/automanage/azext_automanage/aaz/latest/automanage/best_practice/version/_show.py b/src/automanage/azext_automanage/aaz/latest/automanage/best_practice/version/_show.py new file mode 100644 index 00000000000..e8ddb5eface --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/best_practice/version/_show.py @@ -0,0 +1,198 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage best-practice version show", +) +class Show(AAZCommand): + """Get information about a Automanage best practice version + + :example: show a best-practice version + az automanage best-practice version show --best-practice-name {} --version-name {} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/providers/microsoft.automanage/bestpractices/{}/versions/{}", "2022-05-04"], + ] + } + + 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.best_practice_name = AAZStrArg( + options=["--best-practice-name"], + help="The Automanage best practice name.", + required=True, + ) + _args_schema.version_name = AAZStrArg( + options=["--version-name"], + help="The Automanage best practice version name.", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.BestPracticesVersionsGet(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 BestPracticesVersionsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/providers/Microsoft.Automanage/bestPractices/{bestPracticeName}/versions/{versionName}", + **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( + "bestPracticeName", self.ctx.args.best_practice_name, + required=True, + ), + **self.serialize_url_param( + "versionName", self.ctx.args.version_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + 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.configuration = AAZFreeFormDictType() + + 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/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/__cmd_group.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/__cmd_group.py new file mode 100644 index 00000000000..f9e2dc5fc77 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "automanage configuration-profile", +) +class __CMDGroup(AAZCommandGroup): + """Manage configuration profile + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/__init__.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/__init__.py new file mode 100644 index 00000000000..c401f439385 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/__init__.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/_create.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/_create.py new file mode 100644 index 00000000000..52c324fd9c4 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/_create.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( + "automanage configuration-profile create", +) +class Create(AAZCommand): + """Create a configuration profile + + :example: create configuration-profile + az automanage configuration-profile create -n {profile_name} -g {rg} --configuration {"Antimalware/Enable":false,"Backup/Enable":false,"VMInsights/Enable":true,"AzureSecurityCenter/Enable":true,"UpdateManagement/Enable":true,"ChangeTrackingAndInventory/Enable":true,"GuestConfiguration/Enable":true,"LogAnalytics/Enable":true,"BootDiagnostics/Enable":true} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.automanage/configurationprofiles/{}", "2022-05-04"], + ] + } + + 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.configuration_profile_name = AAZStrArg( + options=["-n", "--name", "--configuration-profile-name"], + help="Name of the configuration profile.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Parameters" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Parameters", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Parameters", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.configuration = AAZFreeFormDictArg( + options=["--configuration"], + arg_group="Properties", + help="configuration dictionary of the configuration profile.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConfigurationProfilesCreateOrUpdate(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 ConfigurationProfilesCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *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.Automanage/configurationProfiles/{configurationProfileName}", + **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( + "configurationProfileName", self.ctx.args.configuration_profile_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-05-04", + 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("configuration", AAZFreeFormDictType, ".configuration") + + configuration = _builder.get(".properties.configuration") + if configuration is not None: + configuration.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_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.configuration = AAZFreeFormDictType() + + 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/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/_delete.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/_delete.py new file mode 100644 index 00000000000..5b420db5a52 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/_delete.py @@ -0,0 +1,139 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete a configuration profile + + :example: delete configuration-profile + az automanage configuration-profile delete -n {profile_name} -g {rg} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.automanage/configurationprofiles/{}", "2022-05-04"], + ] + } + + 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.configuration_profile_name = AAZStrArg( + options=["-n", "--name", "--configuration-profile-name"], + help="Name of the configuration profile", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConfigurationProfilesDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class ConfigurationProfilesDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_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.Automanage/configurationProfiles/{configurationProfileName}", + **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( + "configurationProfileName", self.ctx.args.configuration_profile_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-05-04", + 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/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/_list.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/_list.py new file mode 100644 index 00000000000..8df54c71e8d --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/_list.py @@ -0,0 +1,334 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile list", +) +class List(AAZCommand): + """List configuration profiles within a subscription + + :example: list configuration-profile + az automanage configuration-profile list -g {rg} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.automanage/configurationprofiles", "2022-05-04"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.automanage/configurationprofiles", "2022-05-04"], + ] + } + + 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() + 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.ConfigurationProfilesListByResourceGroup(ctx=self.ctx)() + if condition_1: + self.ConfigurationProfilesListBySubscription(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 ConfigurationProfilesListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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.Automanage/configurationProfiles", + **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-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.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.configuration = AAZFreeFormDictType() + + 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 ConfigurationProfilesListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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.Automanage/configurationProfiles", + **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-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.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.configuration = AAZFreeFormDictType() + + 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/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/_show.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/_show.py new file mode 100644 index 00000000000..65a47c4e8ab --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/_show.py @@ -0,0 +1,208 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile show", +) +class Show(AAZCommand): + """Get information about a configuration profile + + :example: show configuration-profile + az automanage configuration-profile show -n {profile_name} -g {rg} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.automanage/configurationprofiles/{}", "2022-05-04"], + ] + } + + 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.configuration_profile_name = AAZStrArg( + options=["-n", "--name", "--configuration-profile-name"], + help="The configuration profile name.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConfigurationProfilesGet(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 ConfigurationProfilesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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.Automanage/configurationProfiles/{configurationProfileName}", + **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( + "configurationProfileName", self.ctx.args.configuration_profile_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-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + 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.configuration = AAZFreeFormDictType() + + 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/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/_update.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/_update.py new file mode 100644 index 00000000000..7ebdacf3b46 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/_update.py @@ -0,0 +1,404 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile update", +) +class Update(AAZCommand): + """Update a configuration profile + + :example: update configuration-profile + az automanage configuration-profile update -n {profile_name} -g {rg} --configuration {"Antimalware/Enable":true,"VMInsights/Enable":false} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.automanage/configurationprofiles/{}", "2022-05-04"], + ] + } + + 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.configuration_profile_name = AAZStrArg( + options=["-n", "--name", "--configuration-profile-name"], + help="The configuration profile name.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Parameters" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Parameters", + help="Resource tags.", + nullable=True, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg( + nullable=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.configuration = AAZFreeFormDictArg( + options=["--configuration"], + arg_group="Properties", + help="configuration dictionary of the configuration profile.", + nullable=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConfigurationProfilesGet(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.ConfigurationProfilesCreateOrUpdate(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 ConfigurationProfilesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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.Automanage/configurationProfiles/{configurationProfileName}", + **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( + "configurationProfileName", self.ctx.args.configuration_profile_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-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + 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_configuration_profile_read(cls._schema_on_200) + + return cls._schema_on_200 + + class ConfigurationProfilesCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *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.Automanage/configurationProfiles/{configurationProfileName}", + **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( + "configurationProfileName", self.ctx.args.configuration_profile_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-05-04", + 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_configuration_profile_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("properties", AAZObjectType) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("configuration", AAZFreeFormDictType, ".configuration") + + configuration = _builder.get(".properties.configuration") + if configuration is not None: + configuration.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_configuration_profile_read = None + + @classmethod + def _build_schema_configuration_profile_read(cls, _schema): + if cls._schema_configuration_profile_read is not None: + _schema.id = cls._schema_configuration_profile_read.id + _schema.location = cls._schema_configuration_profile_read.location + _schema.name = cls._schema_configuration_profile_read.name + _schema.properties = cls._schema_configuration_profile_read.properties + _schema.system_data = cls._schema_configuration_profile_read.system_data + _schema.tags = cls._schema_configuration_profile_read.tags + _schema.type = cls._schema_configuration_profile_read.type + return + + cls._schema_configuration_profile_read = _schema_configuration_profile_read = AAZObjectType() + + configuration_profile_read = _schema_configuration_profile_read + configuration_profile_read.id = AAZStrType( + flags={"read_only": True}, + ) + configuration_profile_read.location = AAZStrType( + flags={"required": True}, + ) + configuration_profile_read.name = AAZStrType( + flags={"read_only": True}, + ) + configuration_profile_read.properties = AAZObjectType() + configuration_profile_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + configuration_profile_read.tags = AAZDictType() + configuration_profile_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_configuration_profile_read.properties + properties.configuration = AAZFreeFormDictType() + + system_data = _schema_configuration_profile_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = _schema_configuration_profile_read.tags + tags.Element = AAZStrType() + + _schema.id = cls._schema_configuration_profile_read.id + _schema.location = cls._schema_configuration_profile_read.location + _schema.name = cls._schema_configuration_profile_read.name + _schema.properties = cls._schema_configuration_profile_read.properties + _schema.system_data = cls._schema_configuration_profile_read.system_data + _schema.tags = cls._schema_configuration_profile_read.tags + _schema.type = cls._schema_configuration_profile_read.type + + +__all__ = ["Update"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/version/__cmd_group.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/version/__cmd_group.py new file mode 100644 index 00000000000..19ff961f87e --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/version/__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( + "automanage configuration-profile version", +) +class __CMDGroup(AAZCommandGroup): + """Manage configuration profile version + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/version/__init__.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/version/__init__.py new file mode 100644 index 00000000000..c401f439385 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/version/__init__.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/version/_create.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/version/_create.py new file mode 100644 index 00000000000..dbc54b31313 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/version/_create.py @@ -0,0 +1,273 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile version create", +) +class Create(AAZCommand): + """Create a configuration profile version + + :example: create configuration-profile version + az automanage configuration-profile version create --profile-name {profile_name} -g {rg} -n {version_name} --configuration {"Antimalware/Enable":false} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.automanage/configurationprofiles/{}/versions/{}", "2022-05-04"], + ] + } + + 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.configuration_profile_name = AAZStrArg( + options=["--profile-name", "--configuration-profile-name"], + help="Name of the configuration profile.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.version_name = AAZStrArg( + options=["-n", "--name", "--version-name"], + help="The configuration profile version name.", + required=True, + ) + + # define Arg Group "Parameters" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Parameters", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Parameters", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.configuration = AAZFreeFormDictArg( + options=["--configuration"], + arg_group="Properties", + help="configuration dictionary of the configuration profile.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConfigurationProfilesVersionsCreateOrUpdate(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 ConfigurationProfilesVersionsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *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.Automanage/configurationProfiles/{configurationProfileName}/versions/{versionName}", + **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( + "configurationProfileName", self.ctx.args.configuration_profile_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "versionName", self.ctx.args.version_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-05-04", + 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("configuration", AAZFreeFormDictType, ".configuration") + + configuration = _builder.get(".properties.configuration") + if configuration is not None: + configuration.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_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.configuration = AAZFreeFormDictType() + + 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/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/version/_delete.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/version/_delete.py new file mode 100644 index 00000000000..b1053e782a7 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/version/_delete.py @@ -0,0 +1,149 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile version delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete a configuration profile version + + :example: delete configuration-profile version + az automanage configuration-profile version delete --profile-name {profile_name} -g {rg} -n {version_name} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.automanage/configurationprofiles/{}/versions/{}", "2022-05-04"], + ] + } + + 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.configuration_profile_name = AAZStrArg( + options=["--profile-name", "--configuration-profile-name"], + help="Name of the configuration profile", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.version_name = AAZStrArg( + options=["-n", "--name", "--version-name"], + help="The configuration profile version name.", + required=True, + id_part="child_name_1", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConfigurationProfilesVersionsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class ConfigurationProfilesVersionsDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_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.Automanage/configurationProfiles/{configurationProfileName}/versions/{versionName}", + **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( + "configurationProfileName", self.ctx.args.configuration_profile_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "versionName", self.ctx.args.version_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-05-04", + 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/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/version/_list.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/version/_list.py new file mode 100644 index 00000000000..21ffaf36d5c --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/version/_list.py @@ -0,0 +1,213 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile version list", +) +class List(AAZCommand): + """List configuration profile versions for a configuration profile + + :example: list configuration-profile version + az automanage configuration-profile version list --profile-name {profile_name} -g {rg} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.automanage/configurationprofiles/{}/versions", "2022-05-04"], + ] + } + + 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.configuration_profile_name = AAZStrArg( + options=["--profile-name", "--configuration-profile-name"], + help="Name of the configuration profile.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConfigurationProfilesVersionsListChildResources(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 ConfigurationProfilesVersionsListChildResources(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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.Automanage/configurationProfiles/{configurationProfileName}/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( + "configurationProfileName", self.ctx.args.configuration_profile_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-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.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.configuration = AAZFreeFormDictType() + + 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/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/version/_show.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/version/_show.py new file mode 100644 index 00000000000..30380f63978 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/version/_show.py @@ -0,0 +1,218 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile version show", +) +class Show(AAZCommand): + """Get information about a configuration profile version + + :example: show configuration-profile version + az automanage configuration-profile version show --profile-name {profile_name} -g {rg} -n {version_name} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.automanage/configurationprofiles/{}/versions/{}", "2022-05-04"], + ] + } + + 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.configuration_profile_name = AAZStrArg( + options=["--profile-name", "--configuration-profile-name"], + help="The configuration profile name.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.version_name = AAZStrArg( + options=["-n", "--name", "--version-name"], + help="The configuration profile version name.", + required=True, + id_part="child_name_1", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConfigurationProfilesVersionsGet(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 ConfigurationProfilesVersionsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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.Automanage/configurationProfiles/{configurationProfileName}/versions/{versionName}", + **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( + "configurationProfileName", self.ctx.args.configuration_profile_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "versionName", self.ctx.args.version_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + 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.configuration = AAZFreeFormDictType() + + 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/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/version/_update.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/version/_update.py new file mode 100644 index 00000000000..4ff97a427e7 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile/version/_update.py @@ -0,0 +1,418 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile version update", +) +class Update(AAZCommand): + """Update a configuration profile version + + :example: update configuration-profile version + az automanage configuration-profile version update --profile-name {profile_name} -g {rg} -n {version_name} --configuration {"Antimalware/Enable":true} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.automanage/configurationprofiles/{}/versions/{}", "2022-05-04"], + ] + } + + 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.configuration_profile_name = AAZStrArg( + options=["--profile-name", "--configuration-profile-name"], + help="The configuration profile name.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.version_name = AAZStrArg( + options=["-n", "--name", "--version-name"], + help="The configuration profile version name.", + required=True, + id_part="child_name_1", + ) + + # 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.configuration = AAZFreeFormDictArg( + options=["--configuration"], + arg_group="Properties", + help="configuration dictionary of the configuration profile.", + nullable=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConfigurationProfilesVersionsGet(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.ConfigurationProfilesVersionsCreateOrUpdate(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 ConfigurationProfilesVersionsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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.Automanage/configurationProfiles/{configurationProfileName}/versions/{versionName}", + **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( + "configurationProfileName", self.ctx.args.configuration_profile_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "versionName", self.ctx.args.version_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + 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_configuration_profile_read(cls._schema_on_200) + + return cls._schema_on_200 + + class ConfigurationProfilesVersionsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *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.Automanage/configurationProfiles/{configurationProfileName}/versions/{versionName}", + **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( + "configurationProfileName", self.ctx.args.configuration_profile_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "versionName", self.ctx.args.version_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-05-04", + 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_configuration_profile_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("properties", AAZObjectType) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("configuration", AAZFreeFormDictType, ".configuration") + + configuration = _builder.get(".properties.configuration") + if configuration is not None: + configuration.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_configuration_profile_read = None + + @classmethod + def _build_schema_configuration_profile_read(cls, _schema): + if cls._schema_configuration_profile_read is not None: + _schema.id = cls._schema_configuration_profile_read.id + _schema.location = cls._schema_configuration_profile_read.location + _schema.name = cls._schema_configuration_profile_read.name + _schema.properties = cls._schema_configuration_profile_read.properties + _schema.system_data = cls._schema_configuration_profile_read.system_data + _schema.tags = cls._schema_configuration_profile_read.tags + _schema.type = cls._schema_configuration_profile_read.type + return + + cls._schema_configuration_profile_read = _schema_configuration_profile_read = AAZObjectType() + + configuration_profile_read = _schema_configuration_profile_read + configuration_profile_read.id = AAZStrType( + flags={"read_only": True}, + ) + configuration_profile_read.location = AAZStrType( + flags={"required": True}, + ) + configuration_profile_read.name = AAZStrType( + flags={"read_only": True}, + ) + configuration_profile_read.properties = AAZObjectType() + configuration_profile_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + configuration_profile_read.tags = AAZDictType() + configuration_profile_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_configuration_profile_read.properties + properties.configuration = AAZFreeFormDictType() + + system_data = _schema_configuration_profile_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = _schema_configuration_profile_read.tags + tags.Element = AAZStrType() + + _schema.id = cls._schema_configuration_profile_read.id + _schema.location = cls._schema_configuration_profile_read.location + _schema.name = cls._schema_configuration_profile_read.name + _schema.properties = cls._schema_configuration_profile_read.properties + _schema.system_data = cls._schema_configuration_profile_read.system_data + _schema.tags = cls._schema_configuration_profile_read.tags + _schema.type = cls._schema_configuration_profile_read.type + + +__all__ = ["Update"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/__cmd_group.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/__cmd_group.py new file mode 100644 index 00000000000..c0d69f38103 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/__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( + "automanage configuration-profile-assignment", +) +class __CMDGroup(AAZCommandGroup): + """Manage configuration profile assignment + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/__init__.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/__init__.py new file mode 100644 index 00000000000..d63ae5a6fc9 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/__init__.py @@ -0,0 +1,12 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._list import * diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/_list.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/_list.py new file mode 100644 index 00000000000..9860940905b --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/_list.py @@ -0,0 +1,785 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile-assignment list", +) +class List(AAZCommand): + """List configuration profile assignments under a given subscription + + :example: list configuration-profile-assignment + az automanage configuration-profile-assignment list -g {rg} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.automanage/configurationprofileassignments", "2022-05-04"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.automanage/configurationprofileassignments", "2022-05-04"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.azurestackhci/clusters/{}/providers/microsoft.automanage/configurationprofileassignments", "2022-05-04"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/providers/microsoft.automanage/configurationprofileassignments", "2022-05-04"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/providers/microsoft.automanage/configurationprofileassignments", "2022-05-04"], + ] + } + + 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.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the Arc machine.", + ) + _args_schema.machine_name = AAZStrArg( + options=["--machine-name"], + help="The name of the Arc machine.", + ) + _args_schema.resource_group = AAZResourceGroupNameArg() + _args_schema.vm_name = AAZStrArg( + options=["--vm-name"], + help="The name of the virtual machine.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.args.machine_name) and has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) and has_value(self.ctx.args.vm_name) + condition_2 = has_value(self.ctx.args.cluster_name) and has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + condition_3 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) and has_value(self.ctx.args.cluster_name) is not True and has_value(self.ctx.args.machine_name) is not True and has_value(self.ctx.args.vm_name) is not True + condition_4 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.cluster_name) is not True and has_value(self.ctx.args.machine_name) is not True and has_value(self.ctx.args.resource_group) is not True and has_value(self.ctx.args.vm_name) is not True + if condition_0: + self.ConfigurationProfileAssignmentsListByMachineName(ctx=self.ctx)() + if condition_1: + self.ConfigurationProfileAssignmentsListByVirtualMachines(ctx=self.ctx)() + if condition_2: + self.ConfigurationProfileAssignmentsListByClusterName(ctx=self.ctx)() + if condition_3: + self.ConfigurationProfileAssignmentsList(ctx=self.ctx)() + if condition_4: + self.ConfigurationProfileAssignmentsListBySubscription(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 ConfigurationProfileAssignmentsListByMachineName(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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}/providers/Microsoft.Automanage/configurationProfileAssignments", + **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-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.managed_by = AAZStrType( + serialized_name="managedBy", + ) + _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.configuration_profile = AAZStrType( + serialized_name="configurationProfile", + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + properties.target_id = AAZStrType( + serialized_name="targetId", + 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 ConfigurationProfileAssignmentsListByVirtualMachines(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "vmName", self.ctx.args.vm_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.managed_by = AAZStrType( + serialized_name="managedBy", + ) + _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.configuration_profile = AAZStrType( + serialized_name="configurationProfile", + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + properties.target_id = AAZStrType( + serialized_name="targetId", + 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 ConfigurationProfileAssignmentsListByClusterName(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments", + **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( + "clusterName", self.ctx.args.cluster_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-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.managed_by = AAZStrType( + serialized_name="managedBy", + ) + _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.configuration_profile = AAZStrType( + serialized_name="configurationProfile", + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + properties.target_id = AAZStrType( + serialized_name="targetId", + 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 ConfigurationProfileAssignmentsList(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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.Automanage/configurationProfileAssignments", + **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-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.managed_by = AAZStrType( + serialized_name="managedBy", + ) + _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.configuration_profile = AAZStrType( + serialized_name="configurationProfile", + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + properties.target_id = AAZStrType( + serialized_name="targetId", + 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 ConfigurationProfileAssignmentsListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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.Automanage/configurationProfileAssignments", + **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-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.managed_by = AAZStrType( + serialized_name="managedBy", + ) + _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.configuration_profile = AAZStrType( + serialized_name="configurationProfile", + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + properties.target_id = AAZStrType( + serialized_name="targetId", + 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/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/__cmd_group.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/__cmd_group.py new file mode 100644 index 00000000000..66b39075fb4 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/__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( + "automanage configuration-profile-assignment arc", +) +class __CMDGroup(AAZCommandGroup): + """Manage association between an ARC machine and Automanage configuration profile + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/__init__.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/__init__.py new file mode 100644 index 00000000000..a3db3e36481 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/__init__.py @@ -0,0 +1,15 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the 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 ._show import * +from ._update import * diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/_create.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/_create.py new file mode 100644 index 00000000000..09c2e5a7373 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/_create.py @@ -0,0 +1,248 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile-assignment arc create", +) +class Create(AAZCommand): + """Create an association between an ARC machine and Automanage configuration profile + + :example: create configuration-profile-assignment for arc + az automanage configuration-profile-assignment arc create -n default -g {rg} --machine-name {arc_name} --configuration-profile {profile_id} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/providers/microsoft.automanage/configurationprofileassignments/{}", "2022-05-04"], + ] + } + + 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.configuration_profile_assignment_name = AAZStrArg( + options=["-n", "--name", "--configuration-profile-assignment-name"], + help="Name of the configuration profile assignment. Only default is supported.", + required=True, + ) + _args_schema.machine_name = AAZStrArg( + options=["--machine-name"], + help="The name of the Arc machine.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.configuration_profile = AAZStrArg( + options=["--configuration-profile"], + arg_group="Properties", + help="The Automanage configurationProfile ARM Resource URI.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConfigurationProfileHCRPAssignmentsCreateOrUpdate(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 ConfigurationProfileHCRPAssignmentsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *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/machines/{machineName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}", + **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( + "configurationProfileAssignmentName", self.ctx.args.configuration_profile_assignment_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-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("configurationProfile", AAZStrType, ".configuration_profile") + + 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.managed_by = AAZStrType( + serialized_name="managedBy", + ) + _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.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.configuration_profile = AAZStrType( + serialized_name="configurationProfile", + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + properties.target_id = AAZStrType( + serialized_name="targetId", + flags={"read_only": 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", + ) + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/_delete.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/_delete.py new file mode 100644 index 00000000000..927d26bd456 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/_delete.py @@ -0,0 +1,149 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile-assignment arc delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete an association between an ARC machine and Automanage configuration profile + + :example: delete configuration-profile-assignment for arc + az automanage configuration-profile-assignment arc delete -n default -g {rg} --machine-name {arc_name} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/providers/microsoft.automanage/configurationprofileassignments/{}", "2022-05-04"], + ] + } + + 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.configuration_profile_assignment_name = AAZStrArg( + options=["-n", "--name", "--configuration-profile-assignment-name"], + help="Name of the configuration profile assignment", + required=True, + id_part="child_name_1", + ) + _args_schema.machine_name = AAZStrArg( + options=["--machine-name"], + help="The name of the Arc machine.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConfigurationProfileHCRPAssignmentsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class ConfigurationProfileHCRPAssignmentsDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_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}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}", + **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( + "configurationProfileAssignmentName", self.ctx.args.configuration_profile_assignment_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-05-04", + 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/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/_show.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/_show.py new file mode 100644 index 00000000000..55f86a95d53 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/_show.py @@ -0,0 +1,223 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile-assignment arc show", +) +class Show(AAZCommand): + """Get information about an association between an ARC machine and Automanage configuration profile + + :example: show configuration-profile-assignment for arc + az automanage configuration-profile-assignment arc show -n default -g {rg} --machine-name {arc_name} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/providers/microsoft.automanage/configurationprofileassignments/{}", "2022-05-04"], + ] + } + + 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.configuration_profile_assignment_name = AAZStrArg( + options=["-n", "--name", "--configuration-profile-assignment-name"], + help="The configuration profile assignment name.", + required=True, + id_part="child_name_1", + ) + _args_schema.machine_name = AAZStrArg( + options=["--machine-name"], + help="The name of the Arc machine.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConfigurationProfileHCRPAssignmentsGet(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 ConfigurationProfileHCRPAssignmentsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}", + **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( + "configurationProfileAssignmentName", self.ctx.args.configuration_profile_assignment_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-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + 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.managed_by = AAZStrType( + serialized_name="managedBy", + ) + _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.configuration_profile = AAZStrType( + serialized_name="configurationProfile", + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + properties.target_id = AAZStrType( + serialized_name="targetId", + 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/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/_update.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/_update.py new file mode 100644 index 00000000000..06b8e0b94eb --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/_update.py @@ -0,0 +1,397 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile-assignment arc update", +) +class Update(AAZCommand): + """Update an association between a ARC machine and Automanage configuration profile + + :example: update configuration-profile-assignment for arc + az automanage configuration-profile-assignment arc update --n default -g {rg} --machine-name {arc_name} --configuration-profile {profile_id_2} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/providers/microsoft.automanage/configurationprofileassignments/{}", "2022-05-04"], + ] + } + + 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.configuration_profile_assignment_name = AAZStrArg( + options=["-n", "--name", "--configuration-profile-assignment-name"], + help="The configuration profile assignment name.", + required=True, + id_part="child_name_1", + ) + _args_schema.machine_name = AAZStrArg( + options=["--machine-name"], + help="The name of the Arc machine.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.configuration_profile = AAZStrArg( + options=["--configuration-profile"], + arg_group="Properties", + help="The Automanage configurationProfile ARM Resource URI.", + nullable=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConfigurationProfileHCRPAssignmentsGet(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.ConfigurationProfileHCRPAssignmentsCreateOrUpdate(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 ConfigurationProfileHCRPAssignmentsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}", + **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( + "configurationProfileAssignmentName", self.ctx.args.configuration_profile_assignment_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-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + 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_configuration_profile_assignment_read(cls._schema_on_200) + + return cls._schema_on_200 + + class ConfigurationProfileHCRPAssignmentsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *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/machines/{machineName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}", + **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( + "configurationProfileAssignmentName", self.ctx.args.configuration_profile_assignment_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-05-04", + 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_configuration_profile_assignment_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) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("configurationProfile", AAZStrType, ".configuration_profile") + + 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_configuration_profile_assignment_read = None + + @classmethod + def _build_schema_configuration_profile_assignment_read(cls, _schema): + if cls._schema_configuration_profile_assignment_read is not None: + _schema.id = cls._schema_configuration_profile_assignment_read.id + _schema.managed_by = cls._schema_configuration_profile_assignment_read.managed_by + _schema.name = cls._schema_configuration_profile_assignment_read.name + _schema.properties = cls._schema_configuration_profile_assignment_read.properties + _schema.system_data = cls._schema_configuration_profile_assignment_read.system_data + _schema.type = cls._schema_configuration_profile_assignment_read.type + return + + cls._schema_configuration_profile_assignment_read = _schema_configuration_profile_assignment_read = AAZObjectType() + + configuration_profile_assignment_read = _schema_configuration_profile_assignment_read + configuration_profile_assignment_read.id = AAZStrType( + flags={"read_only": True}, + ) + configuration_profile_assignment_read.managed_by = AAZStrType( + serialized_name="managedBy", + ) + configuration_profile_assignment_read.name = AAZStrType( + flags={"read_only": True}, + ) + configuration_profile_assignment_read.properties = AAZObjectType() + configuration_profile_assignment_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + configuration_profile_assignment_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_configuration_profile_assignment_read.properties + properties.configuration_profile = AAZStrType( + serialized_name="configurationProfile", + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + properties.target_id = AAZStrType( + serialized_name="targetId", + flags={"read_only": True}, + ) + + system_data = _schema_configuration_profile_assignment_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_configuration_profile_assignment_read.id + _schema.managed_by = cls._schema_configuration_profile_assignment_read.managed_by + _schema.name = cls._schema_configuration_profile_assignment_read.name + _schema.properties = cls._schema_configuration_profile_assignment_read.properties + _schema.system_data = cls._schema_configuration_profile_assignment_read.system_data + _schema.type = cls._schema_configuration_profile_assignment_read.type + + +__all__ = ["Update"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/report/__cmd_group.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/report/__cmd_group.py new file mode 100644 index 00000000000..7b822596db4 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/report/__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( + "automanage configuration-profile-assignment arc report", +) +class __CMDGroup(AAZCommandGroup): + """Manage report within a given ARC machine configuration profile assignment + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/report/__init__.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/report/__init__.py new file mode 100644 index 00000000000..2df85698253 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/report/__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/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/report/_list.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/report/_list.py new file mode 100644 index 00000000000..5ad83f1e6ca --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/report/_list.py @@ -0,0 +1,315 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile-assignment arc report list", +) +class List(AAZCommand): + """List reports within a given ARC machine configuration profile assignment + + :example: list configuration-profile-assignment for arc report + az automanage configuration-profile-assignment arc report list --assignment-name default -g {rg} --machine-name {arc_name} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/providers/microsoft.automanage/configurationprofileassignments/{}/reports", "2022-05-04"], + ] + } + + 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.configuration_profile_assignment_name = AAZStrArg( + options=["--assignment-name", "--configuration-profile-assignment-name"], + help="The configuration profile assignment name.", + required=True, + ) + _args_schema.machine_name = AAZStrArg( + options=["--machine-name"], + help="The name of the Arc machine.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.HCRPReportsListByConfigurationProfileAssignments(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 HCRPReportsListByConfigurationProfileAssignments(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}/reports", + **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( + "configurationProfileAssignmentName", self.ctx.args.configuration_profile_assignment_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-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.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.configuration_profile = AAZStrType( + serialized_name="configurationProfile", + flags={"read_only": True}, + ) + properties.duration = AAZStrType( + flags={"read_only": True}, + ) + properties.end_time = AAZStrType( + serialized_name="endTime", + ) + properties.error = AAZObjectType() + _ListHelper._build_schema_error_detail_read(properties.error) + properties.last_modified_time = AAZStrType( + serialized_name="lastModifiedTime", + flags={"read_only": True}, + ) + properties.report_format_version = AAZStrType( + serialized_name="reportFormatVersion", + flags={"read_only": True}, + ) + properties.resources = AAZListType( + flags={"read_only": True}, + ) + properties.start_time = AAZStrType( + serialized_name="startTime", + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + properties.type = AAZStrType( + flags={"read_only": True}, + ) + + resources = cls._schema_on_200.value.Element.properties.resources + resources.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.resources.Element + _element.error = AAZObjectType() + _ListHelper._build_schema_error_detail_read(_element.error) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.status = AAZStrType( + flags={"read_only": True}, + ) + _element.type = 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""" + + _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__ = ["List"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/report/_show.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/report/_show.py new file mode 100644 index 00000000000..b6ce441fd53 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/arc/report/_show.py @@ -0,0 +1,321 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile-assignment arc report show", +) +class Show(AAZCommand): + """Get information about a report associated with an ARC machine configuration profile assignment run + + :example: show configuration-profile-assignment for arc report + az automanage configuration-profile-assignment arc report show -n {report_name} --assignment-name default -g {rg} --machine-name {arc_name} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/providers/microsoft.automanage/configurationprofileassignments/{}/reports/{}", "2022-05-04"], + ] + } + + 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.configuration_profile_assignment_name = AAZStrArg( + options=["--assignment-name", "--configuration-profile-assignment-name"], + help="The configuration profile assignment name.", + required=True, + id_part="child_name_1", + ) + _args_schema.machine_name = AAZStrArg( + options=["--machine-name"], + help="The name of the Arc machine.", + required=True, + id_part="name", + ) + _args_schema.report_name = AAZStrArg( + options=["-n", "--name", "--report-name"], + help="The report name.", + required=True, + id_part="child_name_2", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.HCRPReportsGet(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 HCRPReportsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}/reports/{reportName}", + **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( + "configurationProfileAssignmentName", self.ctx.args.configuration_profile_assignment_name, + required=True, + ), + **self.serialize_url_param( + "machineName", self.ctx.args.machine_name, + required=True, + ), + **self.serialize_url_param( + "reportName", self.ctx.args.report_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-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + 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.configuration_profile = AAZStrType( + serialized_name="configurationProfile", + flags={"read_only": True}, + ) + properties.duration = AAZStrType( + flags={"read_only": True}, + ) + properties.end_time = AAZStrType( + serialized_name="endTime", + ) + properties.error = AAZObjectType() + _ShowHelper._build_schema_error_detail_read(properties.error) + properties.last_modified_time = AAZStrType( + serialized_name="lastModifiedTime", + flags={"read_only": True}, + ) + properties.report_format_version = AAZStrType( + serialized_name="reportFormatVersion", + flags={"read_only": True}, + ) + properties.resources = AAZListType( + flags={"read_only": True}, + ) + properties.start_time = AAZStrType( + serialized_name="startTime", + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + properties.type = AAZStrType( + flags={"read_only": True}, + ) + + resources = cls._schema_on_200.properties.resources + resources.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.resources.Element + _element.error = AAZObjectType() + _ShowHelper._build_schema_error_detail_read(_element.error) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.status = AAZStrType( + flags={"read_only": True}, + ) + _element.type = 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""" + + _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__ = ["Show"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/__cmd_group.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/__cmd_group.py new file mode 100644 index 00000000000..2b8aab8552f --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/__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( + "automanage configuration-profile-assignment cluster", +) +class __CMDGroup(AAZCommandGroup): + """Manage association between an AzureStackHCI cluster and Automanage configuration profile + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/__init__.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/__init__.py new file mode 100644 index 00000000000..a3db3e36481 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/__init__.py @@ -0,0 +1,15 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the 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 ._show import * +from ._update import * diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/_create.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/_create.py new file mode 100644 index 00000000000..6b1028ae151 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/_create.py @@ -0,0 +1,248 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile-assignment cluster create", +) +class Create(AAZCommand): + """Create an association between an AzureStackHCI cluster and Automanage configuration profile + + :example: create configuration-profile-assignment for cluster + az automanage configuration-profile-assignment cluster create -n default -g {rg} --cluster-name {cluster_name} --configuration-profile {profile_id} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.azurestackhci/clusters/{}/providers/microsoft.automanage/configurationprofileassignments/{}", "2022-05-04"], + ] + } + + 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.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the Arc machine.", + required=True, + ) + _args_schema.configuration_profile_assignment_name = AAZStrArg( + options=["-n", "--name", "--configuration-profile-assignment-name"], + help="Name of the configuration profile assignment. Only default is supported.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.configuration_profile = AAZStrArg( + options=["--configuration-profile"], + arg_group="Properties", + help="The Automanage configurationProfile ARM Resource URI.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConfigurationProfileHCIAssignmentsCreateOrUpdate(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 ConfigurationProfileHCIAssignmentsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *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.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}", + **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( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "configurationProfileAssignmentName", self.ctx.args.configuration_profile_assignment_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-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("configurationProfile", AAZStrType, ".configuration_profile") + + 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.managed_by = AAZStrType( + serialized_name="managedBy", + ) + _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.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.configuration_profile = AAZStrType( + serialized_name="configurationProfile", + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + properties.target_id = AAZStrType( + serialized_name="targetId", + flags={"read_only": 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", + ) + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/_delete.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/_delete.py new file mode 100644 index 00000000000..78eb0131a02 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/_delete.py @@ -0,0 +1,149 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile-assignment cluster delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete an association between an AzureStackHCI cluster and Automanage configuration profile + + :example: delete configuration-profile-assignment cluster + az automanage configuration-profile-assignment cluster delete -n default -g {rg} --cluster-name {cluster_name} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.azurestackhci/clusters/{}/providers/microsoft.automanage/configurationprofileassignments/{}", "2022-05-04"], + ] + } + + 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.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the Arc machine.", + required=True, + id_part="name", + ) + _args_schema.configuration_profile_assignment_name = AAZStrArg( + options=["-n", "--name", "--configuration-profile-assignment-name"], + help="Name of the configuration profile assignment", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConfigurationProfileHCIAssignmentsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class ConfigurationProfileHCIAssignmentsDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_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.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}", + **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( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "configurationProfileAssignmentName", self.ctx.args.configuration_profile_assignment_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-05-04", + 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/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/_show.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/_show.py new file mode 100644 index 00000000000..d1d2bbbe3e9 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/_show.py @@ -0,0 +1,223 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile-assignment cluster show", +) +class Show(AAZCommand): + """Get information about an association between an AzureStackHCI cluster and Automanage configuration profile + + :example: show configuration-profile-assignment for cluster + az automanage configuration-profile-assignment cluster show -n default -g {rg} --cluster-name {cluster_name} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.azurestackhci/clusters/{}/providers/microsoft.automanage/configurationprofileassignments/{}", "2022-05-04"], + ] + } + + 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.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the Arc machine.", + required=True, + id_part="name", + ) + _args_schema.configuration_profile_assignment_name = AAZStrArg( + options=["-n", "--name", "--configuration-profile-assignment-name"], + help="The configuration profile assignment name.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConfigurationProfileHCIAssignmentsGet(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 ConfigurationProfileHCIAssignmentsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}", + **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( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "configurationProfileAssignmentName", self.ctx.args.configuration_profile_assignment_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-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + 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.managed_by = AAZStrType( + serialized_name="managedBy", + ) + _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.configuration_profile = AAZStrType( + serialized_name="configurationProfile", + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + properties.target_id = AAZStrType( + serialized_name="targetId", + 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/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/_update.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/_update.py new file mode 100644 index 00000000000..db704548886 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/_update.py @@ -0,0 +1,397 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile-assignment cluster update", +) +class Update(AAZCommand): + """Update an association between a AzureStackHCI cluster and Automanage configuration profile + + :example: update configuration-profile-assignment cluster + az automanage configuration-profile-assignment cluster update --n default -g {rg} --cluster-name {cluster_name} --configuration-profile {profile_id_2} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.azurestackhci/clusters/{}/providers/microsoft.automanage/configurationprofileassignments/{}", "2022-05-04"], + ] + } + + 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.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the Arc machine.", + required=True, + id_part="name", + ) + _args_schema.configuration_profile_assignment_name = AAZStrArg( + options=["-n", "--name", "--configuration-profile-assignment-name"], + help="The configuration profile assignment name.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.configuration_profile = AAZStrArg( + options=["--configuration-profile"], + arg_group="Properties", + help="The Automanage configurationProfile ARM Resource URI.", + nullable=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConfigurationProfileHCIAssignmentsGet(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.ConfigurationProfileHCIAssignmentsCreateOrUpdate(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 ConfigurationProfileHCIAssignmentsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}", + **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( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "configurationProfileAssignmentName", self.ctx.args.configuration_profile_assignment_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-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + 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_configuration_profile_assignment_read(cls._schema_on_200) + + return cls._schema_on_200 + + class ConfigurationProfileHCIAssignmentsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *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.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}", + **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( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "configurationProfileAssignmentName", self.ctx.args.configuration_profile_assignment_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-05-04", + 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_configuration_profile_assignment_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) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("configurationProfile", AAZStrType, ".configuration_profile") + + 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_configuration_profile_assignment_read = None + + @classmethod + def _build_schema_configuration_profile_assignment_read(cls, _schema): + if cls._schema_configuration_profile_assignment_read is not None: + _schema.id = cls._schema_configuration_profile_assignment_read.id + _schema.managed_by = cls._schema_configuration_profile_assignment_read.managed_by + _schema.name = cls._schema_configuration_profile_assignment_read.name + _schema.properties = cls._schema_configuration_profile_assignment_read.properties + _schema.system_data = cls._schema_configuration_profile_assignment_read.system_data + _schema.type = cls._schema_configuration_profile_assignment_read.type + return + + cls._schema_configuration_profile_assignment_read = _schema_configuration_profile_assignment_read = AAZObjectType() + + configuration_profile_assignment_read = _schema_configuration_profile_assignment_read + configuration_profile_assignment_read.id = AAZStrType( + flags={"read_only": True}, + ) + configuration_profile_assignment_read.managed_by = AAZStrType( + serialized_name="managedBy", + ) + configuration_profile_assignment_read.name = AAZStrType( + flags={"read_only": True}, + ) + configuration_profile_assignment_read.properties = AAZObjectType() + configuration_profile_assignment_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + configuration_profile_assignment_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_configuration_profile_assignment_read.properties + properties.configuration_profile = AAZStrType( + serialized_name="configurationProfile", + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + properties.target_id = AAZStrType( + serialized_name="targetId", + flags={"read_only": True}, + ) + + system_data = _schema_configuration_profile_assignment_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_configuration_profile_assignment_read.id + _schema.managed_by = cls._schema_configuration_profile_assignment_read.managed_by + _schema.name = cls._schema_configuration_profile_assignment_read.name + _schema.properties = cls._schema_configuration_profile_assignment_read.properties + _schema.system_data = cls._schema_configuration_profile_assignment_read.system_data + _schema.type = cls._schema_configuration_profile_assignment_read.type + + +__all__ = ["Update"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/report/__cmd_group.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/report/__cmd_group.py new file mode 100644 index 00000000000..2b1c5341a15 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/report/__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( + "automanage configuration-profile-assignment cluster report", +) +class __CMDGroup(AAZCommandGroup): + """Manage report within a given AzureStackHCI cluster configuration profile assignment + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/report/__init__.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/report/__init__.py new file mode 100644 index 00000000000..2df85698253 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/report/__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/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/report/_list.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/report/_list.py new file mode 100644 index 00000000000..3bc43a148e1 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/report/_list.py @@ -0,0 +1,315 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile-assignment cluster report list", +) +class List(AAZCommand): + """List reports within a given AzureStackHCI cluster configuration profile assignment + + :example: list configuration-profile-assignment cluster report + az automanage configuration-profile-assignment cluster report list --assignment-name default -g {rg} --cluster-name {cluster_name} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.azurestackhci/clusters/{}/providers/microsoft.automanage/configurationprofileassignments/{}/reports", "2022-05-04"], + ] + } + + 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.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the HCI cluster.", + required=True, + ) + _args_schema.configuration_profile_assignment_name = AAZStrArg( + options=["--assignment-name", "--configuration-profile-assignment-name"], + help="The configuration profile assignment name.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.HCIReportsListByConfigurationProfileAssignments(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 HCIReportsListByConfigurationProfileAssignments(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}/reports", + **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( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "configurationProfileAssignmentName", self.ctx.args.configuration_profile_assignment_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-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.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.configuration_profile = AAZStrType( + serialized_name="configurationProfile", + flags={"read_only": True}, + ) + properties.duration = AAZStrType( + flags={"read_only": True}, + ) + properties.end_time = AAZStrType( + serialized_name="endTime", + ) + properties.error = AAZObjectType() + _ListHelper._build_schema_error_detail_read(properties.error) + properties.last_modified_time = AAZStrType( + serialized_name="lastModifiedTime", + flags={"read_only": True}, + ) + properties.report_format_version = AAZStrType( + serialized_name="reportFormatVersion", + flags={"read_only": True}, + ) + properties.resources = AAZListType( + flags={"read_only": True}, + ) + properties.start_time = AAZStrType( + serialized_name="startTime", + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + properties.type = AAZStrType( + flags={"read_only": True}, + ) + + resources = cls._schema_on_200.value.Element.properties.resources + resources.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.resources.Element + _element.error = AAZObjectType() + _ListHelper._build_schema_error_detail_read(_element.error) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.status = AAZStrType( + flags={"read_only": True}, + ) + _element.type = 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""" + + _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__ = ["List"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/report/_show.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/report/_show.py new file mode 100644 index 00000000000..070ffb33d4c --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/cluster/report/_show.py @@ -0,0 +1,321 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile-assignment cluster report show", +) +class Show(AAZCommand): + """Get information about a report associated with a AzureStackHCI cluster configuration profile assignment run + + :example: show configuration-profile-assignment cluster report + az automanage configuration-profile-assignment cluster report show -n {report_name} --assignment-name default -g {rg} --cluster-name {cluster_name} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.azurestackhci/clusters/{}/providers/microsoft.automanage/configurationprofileassignments/{}/reports/{}", "2022-05-04"], + ] + } + + 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.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the HCI cluster.", + required=True, + id_part="name", + ) + _args_schema.configuration_profile_assignment_name = AAZStrArg( + options=["--assignment-name", "--configuration-profile-assignment-name"], + help="The configuration profile assignment name.", + required=True, + id_part="child_name_1", + ) + _args_schema.report_name = AAZStrArg( + options=["-n", "--name", "--report-name"], + help="The report name.", + required=True, + id_part="child_name_2", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.HCIReportsGet(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 HCIReportsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}/reports/{reportName}", + **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( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "configurationProfileAssignmentName", self.ctx.args.configuration_profile_assignment_name, + required=True, + ), + **self.serialize_url_param( + "reportName", self.ctx.args.report_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-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + 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.configuration_profile = AAZStrType( + serialized_name="configurationProfile", + flags={"read_only": True}, + ) + properties.duration = AAZStrType( + flags={"read_only": True}, + ) + properties.end_time = AAZStrType( + serialized_name="endTime", + ) + properties.error = AAZObjectType() + _ShowHelper._build_schema_error_detail_read(properties.error) + properties.last_modified_time = AAZStrType( + serialized_name="lastModifiedTime", + flags={"read_only": True}, + ) + properties.report_format_version = AAZStrType( + serialized_name="reportFormatVersion", + flags={"read_only": True}, + ) + properties.resources = AAZListType( + flags={"read_only": True}, + ) + properties.start_time = AAZStrType( + serialized_name="startTime", + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + properties.type = AAZStrType( + flags={"read_only": True}, + ) + + resources = cls._schema_on_200.properties.resources + resources.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.resources.Element + _element.error = AAZObjectType() + _ShowHelper._build_schema_error_detail_read(_element.error) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.status = AAZStrType( + flags={"read_only": True}, + ) + _element.type = 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""" + + _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__ = ["Show"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/__cmd_group.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/__cmd_group.py new file mode 100644 index 00000000000..04d7d0fca87 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/__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( + "automanage configuration-profile-assignment vm", +) +class __CMDGroup(AAZCommandGroup): + """Manage association between a VM and Automanage configuration profile + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/__init__.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/__init__.py new file mode 100644 index 00000000000..a3db3e36481 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/__init__.py @@ -0,0 +1,15 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the 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 ._show import * +from ._update import * diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/_create.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/_create.py new file mode 100644 index 00000000000..b4b418ed772 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/_create.py @@ -0,0 +1,248 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile-assignment vm create", +) +class Create(AAZCommand): + """Create an association between a VM and Automanage configuration profile + + :example: create configuration-profile-assignment for vm + az automanage configuration-profile-assignment vm create -n default -g {rg} --vm-name {vm_name} --configuration-profile {profile_id} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/providers/microsoft.automanage/configurationprofileassignments/{}", "2022-05-04"], + ] + } + + 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.configuration_profile_assignment_name = AAZStrArg( + options=["-n", "--name", "--configuration-profile-assignment-name"], + help="Name of the configuration profile assignment. Only default is supported.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.vm_name = AAZStrArg( + options=["--vm-name"], + help="The name of the virtual machine.", + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.configuration_profile = AAZStrArg( + options=["--configuration-profile"], + arg_group="Properties", + help="The Automanage configurationProfile ARM Resource URI.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConfigurationProfileAssignmentsCreateOrUpdate(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 ConfigurationProfileAssignmentsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}", + **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( + "configurationProfileAssignmentName", self.ctx.args.configuration_profile_assignment_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "vmName", self.ctx.args.vm_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("configurationProfile", AAZStrType, ".configuration_profile") + + 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.managed_by = AAZStrType( + serialized_name="managedBy", + ) + _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.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.configuration_profile = AAZStrType( + serialized_name="configurationProfile", + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + properties.target_id = AAZStrType( + serialized_name="targetId", + flags={"read_only": 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", + ) + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/_delete.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/_delete.py new file mode 100644 index 00000000000..6f8c0732623 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/_delete.py @@ -0,0 +1,149 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile-assignment vm delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete an association between a VM and Automanage configuration profile + + :example: delete configuration-profile-assignment for vm + az automanage configuration-profile-assignment vm delete -n default -g {rg} --vm-name {vm_name} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/providers/microsoft.automanage/configurationprofileassignments/{}", "2022-05-04"], + ] + } + + 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.configuration_profile_assignment_name = AAZStrArg( + options=["-n", "--name", "--configuration-profile-assignment-name"], + help="Name of the configuration profile assignment", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.vm_name = AAZStrArg( + options=["--vm-name"], + help="The name of the virtual machine.", + required=True, + id_part="name", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConfigurationProfileAssignmentsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class ConfigurationProfileAssignmentsDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + if session.http_response.status_code in [204]: + return self.on_204(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}", + **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( + "configurationProfileAssignmentName", self.ctx.args.configuration_profile_assignment_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "vmName", self.ctx.args.vm_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-05-04", + 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/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/_show.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/_show.py new file mode 100644 index 00000000000..ed63af283db --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/_show.py @@ -0,0 +1,223 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile-assignment vm show", +) +class Show(AAZCommand): + """Get information about an association between a VM and Automanage configuration profile + + :example: show configuration-profile-assignment vm + az automanage configuration-profile-assignment vm show -n default -g {rg} --vm-name {vm_name} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/providers/microsoft.automanage/configurationprofileassignments/{}", "2022-05-04"], + ] + } + + 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.configuration_profile_assignment_name = AAZStrArg( + options=["-n", "--name", "--configuration-profile-assignment-name"], + help="The configuration profile assignment name.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.vm_name = AAZStrArg( + options=["--vm-name"], + help="The name of the virtual machine.", + required=True, + id_part="name", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConfigurationProfileAssignmentsGet(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 ConfigurationProfileAssignmentsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}", + **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( + "configurationProfileAssignmentName", self.ctx.args.configuration_profile_assignment_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "vmName", self.ctx.args.vm_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + 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.managed_by = AAZStrType( + serialized_name="managedBy", + ) + _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.configuration_profile = AAZStrType( + serialized_name="configurationProfile", + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + properties.target_id = AAZStrType( + serialized_name="targetId", + 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/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/_update.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/_update.py new file mode 100644 index 00000000000..ba5b49d2649 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/_update.py @@ -0,0 +1,397 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile-assignment vm update", +) +class Update(AAZCommand): + """Update an association between a VM and Automanage configuration profile + + :example: update configuration-profile-assignment vm + az automanage configuration-profile-assignment vm update --n default -g {rg} --vm-name {vm_name} --configuration-profile {profile_id_2} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/providers/microsoft.automanage/configurationprofileassignments/{}", "2022-05-04"], + ] + } + + 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.configuration_profile_assignment_name = AAZStrArg( + options=["-n", "--name", "--configuration-profile-assignment-name"], + help="The configuration profile assignment name.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.vm_name = AAZStrArg( + options=["--vm-name"], + help="The name of the virtual machine.", + required=True, + id_part="name", + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.configuration_profile = AAZStrArg( + options=["--configuration-profile"], + arg_group="Properties", + help="The Automanage configurationProfile ARM Resource URI.", + nullable=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConfigurationProfileAssignmentsGet(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.ConfigurationProfileAssignmentsCreateOrUpdate(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 ConfigurationProfileAssignmentsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}", + **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( + "configurationProfileAssignmentName", self.ctx.args.configuration_profile_assignment_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "vmName", self.ctx.args.vm_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + 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_configuration_profile_assignment_read(cls._schema_on_200) + + return cls._schema_on_200 + + class ConfigurationProfileAssignmentsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}", + **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( + "configurationProfileAssignmentName", self.ctx.args.configuration_profile_assignment_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "vmName", self.ctx.args.vm_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-05-04", + 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_configuration_profile_assignment_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) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("configurationProfile", AAZStrType, ".configuration_profile") + + 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_configuration_profile_assignment_read = None + + @classmethod + def _build_schema_configuration_profile_assignment_read(cls, _schema): + if cls._schema_configuration_profile_assignment_read is not None: + _schema.id = cls._schema_configuration_profile_assignment_read.id + _schema.managed_by = cls._schema_configuration_profile_assignment_read.managed_by + _schema.name = cls._schema_configuration_profile_assignment_read.name + _schema.properties = cls._schema_configuration_profile_assignment_read.properties + _schema.system_data = cls._schema_configuration_profile_assignment_read.system_data + _schema.type = cls._schema_configuration_profile_assignment_read.type + return + + cls._schema_configuration_profile_assignment_read = _schema_configuration_profile_assignment_read = AAZObjectType() + + configuration_profile_assignment_read = _schema_configuration_profile_assignment_read + configuration_profile_assignment_read.id = AAZStrType( + flags={"read_only": True}, + ) + configuration_profile_assignment_read.managed_by = AAZStrType( + serialized_name="managedBy", + ) + configuration_profile_assignment_read.name = AAZStrType( + flags={"read_only": True}, + ) + configuration_profile_assignment_read.properties = AAZObjectType() + configuration_profile_assignment_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + configuration_profile_assignment_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_configuration_profile_assignment_read.properties + properties.configuration_profile = AAZStrType( + serialized_name="configurationProfile", + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + properties.target_id = AAZStrType( + serialized_name="targetId", + flags={"read_only": True}, + ) + + system_data = _schema_configuration_profile_assignment_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_configuration_profile_assignment_read.id + _schema.managed_by = cls._schema_configuration_profile_assignment_read.managed_by + _schema.name = cls._schema_configuration_profile_assignment_read.name + _schema.properties = cls._schema_configuration_profile_assignment_read.properties + _schema.system_data = cls._schema_configuration_profile_assignment_read.system_data + _schema.type = cls._schema_configuration_profile_assignment_read.type + + +__all__ = ["Update"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/report/__cmd_group.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/report/__cmd_group.py new file mode 100644 index 00000000000..245b13512d9 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/report/__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( + "automanage configuration-profile-assignment vm report", +) +class __CMDGroup(AAZCommandGroup): + """Manage report within a given VM configuration profile assignment + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/report/__init__.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/report/__init__.py new file mode 100644 index 00000000000..2df85698253 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/report/__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/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/report/_list.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/report/_list.py new file mode 100644 index 00000000000..41b9c5b09ea --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/report/_list.py @@ -0,0 +1,315 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile-assignment vm report list", +) +class List(AAZCommand): + """List reports within a given VM configuration profile assignment + + :example: list configuration-profile-assignment vm report + az automanage configuration-profile-assignment vm report list --assignment-name default -g {rg} --vm-name {vm_name} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/providers/microsoft.automanage/configurationprofileassignments/{}/reports", "2022-05-04"], + ] + } + + 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.configuration_profile_assignment_name = AAZStrArg( + options=["--assignment-name", "--configuration-profile-assignment-name"], + help="The configuration profile assignment name.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.vm_name = AAZStrArg( + options=["--vm-name"], + help="The name of the virtual machine.", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.VMreportsListByConfigurationProfileAssignments(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 VMreportsListByConfigurationProfileAssignments(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}/reports", + **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( + "configurationProfileAssignmentName", self.ctx.args.configuration_profile_assignment_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "vmName", self.ctx.args.vm_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.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.configuration_profile = AAZStrType( + serialized_name="configurationProfile", + flags={"read_only": True}, + ) + properties.duration = AAZStrType( + flags={"read_only": True}, + ) + properties.end_time = AAZStrType( + serialized_name="endTime", + ) + properties.error = AAZObjectType() + _ListHelper._build_schema_error_detail_read(properties.error) + properties.last_modified_time = AAZStrType( + serialized_name="lastModifiedTime", + flags={"read_only": True}, + ) + properties.report_format_version = AAZStrType( + serialized_name="reportFormatVersion", + flags={"read_only": True}, + ) + properties.resources = AAZListType( + flags={"read_only": True}, + ) + properties.start_time = AAZStrType( + serialized_name="startTime", + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + properties.type = AAZStrType( + flags={"read_only": True}, + ) + + resources = cls._schema_on_200.value.Element.properties.resources + resources.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.resources.Element + _element.error = AAZObjectType() + _ListHelper._build_schema_error_detail_read(_element.error) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.status = AAZStrType( + flags={"read_only": True}, + ) + _element.type = 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""" + + _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__ = ["List"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/report/_show.py b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/report/_show.py new file mode 100644 index 00000000000..5b851c40e61 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/configuration_profile_assignment/vm/report/_show.py @@ -0,0 +1,321 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage configuration-profile-assignment vm report show", +) +class Show(AAZCommand): + """Get information about a report associated with a VM configuration profile assignment run + + :example: show configuration-profile-assignment vm report + az automanage configuration-profile-assignment vm report show -n {report_name} --assignment-name default -g {rg} --vm-name {vm_name} + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/providers/microsoft.automanage/configurationprofileassignments/{}/reports/{}", "2022-05-04"], + ] + } + + 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.configuration_profile_assignment_name = AAZStrArg( + options=["--assignment-name", "--configuration-profile-assignment-name"], + help="The configuration profile assignment name.", + required=True, + id_part="child_name_1", + ) + _args_schema.report_name = AAZStrArg( + options=["-n", "--name", "--report-name"], + help="The report name.", + required=True, + id_part="child_name_2", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.vm_name = AAZStrArg( + options=["--vm-name"], + help="The name of the virtual machine.", + required=True, + id_part="name", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.VMreportsGet(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 VMreportsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}/reports/{reportName}", + **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( + "configurationProfileAssignmentName", self.ctx.args.configuration_profile_assignment_name, + required=True, + ), + **self.serialize_url_param( + "reportName", self.ctx.args.report_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "vmName", self.ctx.args.vm_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + 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.configuration_profile = AAZStrType( + serialized_name="configurationProfile", + flags={"read_only": True}, + ) + properties.duration = AAZStrType( + flags={"read_only": True}, + ) + properties.end_time = AAZStrType( + serialized_name="endTime", + ) + properties.error = AAZObjectType() + _ShowHelper._build_schema_error_detail_read(properties.error) + properties.last_modified_time = AAZStrType( + serialized_name="lastModifiedTime", + flags={"read_only": True}, + ) + properties.report_format_version = AAZStrType( + serialized_name="reportFormatVersion", + flags={"read_only": True}, + ) + properties.resources = AAZListType( + flags={"read_only": True}, + ) + properties.start_time = AAZStrType( + serialized_name="startTime", + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + properties.type = AAZStrType( + flags={"read_only": True}, + ) + + resources = cls._schema_on_200.properties.resources + resources.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.resources.Element + _element.error = AAZObjectType() + _ShowHelper._build_schema_error_detail_read(_element.error) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.status = AAZStrType( + flags={"read_only": True}, + ) + _element.type = 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""" + + _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__ = ["Show"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/service_principal/__cmd_group.py b/src/automanage/azext_automanage/aaz/latest/automanage/service_principal/__cmd_group.py new file mode 100644 index 00000000000..c9dc763e075 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/service_principal/__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( + "automanage service-principal", +) +class __CMDGroup(AAZCommandGroup): + """Manage Automanage AAD first party Application Service Principal + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/service_principal/__init__.py b/src/automanage/azext_automanage/aaz/latest/automanage/service_principal/__init__.py new file mode 100644 index 00000000000..26439c0091c --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/service_principal/__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_default import * diff --git a/src/automanage/azext_automanage/aaz/latest/automanage/service_principal/_list.py b/src/automanage/azext_automanage/aaz/latest/automanage/service_principal/_list.py new file mode 100644 index 00000000000..80055853a88 --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/service_principal/_list.py @@ -0,0 +1,195 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage service-principal list", +) +class List(AAZCommand): + """List the Automanage AAD first party Application Service Principal details for the subscription id. + + :example: list service-principal + az automanage service-principal list + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.automanage/serviceprincipals", "2022-05-04"], + ] + } + + 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 "" + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ServicePrincipalsListBySubscription(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 ServicePrincipalsListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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.Automanage/servicePrincipals", + **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-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.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.authorization_set = AAZBoolType( + serialized_name="authorizationSet", + flags={"read_only": True}, + ) + properties.service_principal_id = AAZStrType( + serialized_name="servicePrincipalId", + 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/automanage/azext_automanage/aaz/latest/automanage/service_principal/_show_default.py b/src/automanage/azext_automanage/aaz/latest/automanage/service_principal/_show_default.py new file mode 100644 index 00000000000..36c12212f6d --- /dev/null +++ b/src/automanage/azext_automanage/aaz/latest/automanage/service_principal/_show_default.py @@ -0,0 +1,189 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automanage service-principal show-default", +) +class ShowDefault(AAZCommand): + """Get the Automanage AAD first party Application Service Principal details for the subscription id. + + :example: Show default service-principal + az automanage service-principal show-default + """ + + _aaz_info = { + "version": "2022-05-04", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.automanage/serviceprincipals/default", "2022-05-04"], + ] + } + + 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 "" + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ServicePrincipalsGet(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 ServicePrincipalsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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.Automanage/servicePrincipals/default", + **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-05-04", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + 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.authorization_set = AAZBoolType( + serialized_name="authorizationSet", + flags={"read_only": True}, + ) + properties.service_principal_id = AAZStrType( + serialized_name="servicePrincipalId", + 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 _ShowDefaultHelper: + """Helper class for ShowDefault""" + + +__all__ = ["ShowDefault"] diff --git a/src/automanage/azext_automanage/azext_metadata.json b/src/automanage/azext_automanage/azext_metadata.json new file mode 100644 index 00000000000..f5c45b78119 --- /dev/null +++ b/src/automanage/azext_automanage/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isPreview": true, + "azext.minCliCoreVersion": "2.44.1" +} \ No newline at end of file diff --git a/src/automanage/azext_automanage/commands.py b/src/automanage/azext_automanage/commands.py new file mode 100644 index 00000000000..b0d842e4993 --- /dev/null +++ b/src/automanage/azext_automanage/commands.py @@ -0,0 +1,15 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +# from azure.cli.core.commands import CliCommandType + + +def load_command_table(self, _): # pylint: disable=unused-argument + pass diff --git a/src/automanage/azext_automanage/custom.py b/src/automanage/azext_automanage/custom.py new file mode 100644 index 00000000000..86df1e48ef5 --- /dev/null +++ b/src/automanage/azext_automanage/custom.py @@ -0,0 +1,14 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +from knack.log import get_logger + + +logger = get_logger(__name__) diff --git a/src/automanage/azext_automanage/tests/__init__.py b/src/automanage/azext_automanage/tests/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/automanage/azext_automanage/tests/__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/automanage/azext_automanage/tests/latest/__init__.py b/src/automanage/azext_automanage/tests/latest/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/automanage/azext_automanage/tests/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/automanage/azext_automanage/tests/latest/recordings/test_automanage_configuration_profile_assignment_arc_scenarios.yaml b/src/automanage/azext_automanage/tests/latest/recordings/test_automanage_configuration_profile_assignment_arc_scenarios.yaml new file mode 100644 index 00000000000..57ada16c724 --- /dev/null +++ b/src/automanage/azext_automanage/tests/latest/recordings/test_automanage_configuration_profile_assignment_arc_scenarios.yaml @@ -0,0 +1,647 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile create + Connection: + - keep-alive + ParameterSetName: + - -n -g --configuration + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-resource/21.1.0b1 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgtestautomanage?api-version=2021-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage","name":"rgtestautomanage","type":"Microsoft.Resources/resourceGroups","location":"eastus2euap","properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '234' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:12:49 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"location": "eastus2euap", "properties": {"configuration": {"Antimalware/Enable": + true}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile create + Connection: + - keep-alive + Content-Length: + - '90' + Content-Type: + - application/json + ParameterSetName: + - -n -g --configuration + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.Automanage/configurationProfiles/profile000001?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.Automanage/configurationProfiles/profile000001","name":"profile000001","type":"Microsoft.Automanage/configurationProfiles","location":"eastus2euap","properties":{"configuration":{"Antimalware/Enable":true}},"systemData":{"createdAt":"2023-01-20T06:12:55.7667759+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:12:55.7667759+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '568' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:12:58 GMT + expires: + - '-1' + location: + - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.Automanage/configurationProfiles/profile000001 + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 201 + message: Created +- request: + body: '{"properties": {"configurationProfile": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.Automanage/configurationProfiles/profile000001"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile-assignment arc create + Connection: + - keep-alive + Content-Length: + - '194' + Content-Type: + - application/json + ParameterSetName: + - -n -g --machine-name --configuration-profile + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1/providers/Microsoft.Automanage/configurationProfileAssignments/default?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1/providers/Microsoft.Automanage/configurationProfileAssignments/default","name":"default","type":"Microsoft.Automanage/configurationProfileAssignments","properties":{"targetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.Automanage/configurationProfiles/profile000001","status":"New"},"systemData":{"createdAt":"2023-01-20T06:12:59.1632937+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:12:59.1632937+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '891' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:02 GMT + expires: + - '-1' + location: + - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1/providers/Microsoft.Automanage/configurationProfileAssignments/default + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile-assignment arc show + Connection: + - keep-alive + ParameterSetName: + - -n -g --machine-name + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1/providers/Microsoft.Automanage/configurationProfileAssignments/default?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1/providers/Microsoft.Automanage/configurationProfileAssignments/default","name":"default","type":"Microsoft.Automanage/configurationProfileAssignments","properties":{"targetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.Automanage/configurationProfiles/profile000001","status":"New"},"systemData":{"createdAt":"2023-01-20T06:12:59.1632937+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:12:59.1632937+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '891' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:04 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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: + - automanage configuration-profile-assignment list + Connection: + - keep-alive + ParameterSetName: + - -g + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.Automanage/configurationProfileAssignments?api-version=2022-05-04 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1/providers/Microsoft.Automanage/configurationProfileAssignments/default","name":"default","type":"Microsoft.Automanage/configurationProfileAssignments","properties":{"targetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.Automanage/configurationProfiles/profile000001","status":"New"},"systemData":{"createdAt":"2023-01-20T06:12:59.1632937+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:12:59.1632937+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '903' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:05 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-original-request-ids: + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile create + Connection: + - keep-alive + ParameterSetName: + - -n -g --configuration + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-resource/21.1.0b1 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgtestautomanage?api-version=2021-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage","name":"rgtestautomanage","type":"Microsoft.Resources/resourceGroups","location":"eastus2euap","properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '234' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:06 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"location": "eastus2euap", "properties": {"configuration": {"Antimalware/Enable": + false}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile create + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + ParameterSetName: + - -n -g --configuration + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.Automanage/configurationProfiles/profile000002?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.Automanage/configurationProfiles/profile000002","name":"profile000002","type":"Microsoft.Automanage/configurationProfiles","location":"eastus2euap","properties":{"configuration":{"Antimalware/Enable":false}},"systemData":{"createdAt":"2023-01-20T06:13:12.5070531+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:13:12.5070531+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '569' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:15 GMT + expires: + - '-1' + location: + - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.Automanage/configurationProfiles/profile000002 + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile-assignment arc update + Connection: + - keep-alive + ParameterSetName: + - --n -g --machine-name --configuration-profile + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1/providers/Microsoft.Automanage/configurationProfileAssignments/default?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1/providers/Microsoft.Automanage/configurationProfileAssignments/default","name":"default","type":"Microsoft.Automanage/configurationProfileAssignments","properties":{"targetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.Automanage/configurationProfiles/profile000001","status":"NonConformant"},"systemData":{"createdAt":"2023-01-20T06:13:12.8428826+00:00","createdBy":"d828acde-4b48-47f5-a6e8-52460104a052","createdByType":"Application","lastModifiedAt":"2023-01-20T06:13:12.8428826+00:00","lastModifiedBy":"d828acde-4b48-47f5-a6e8-52460104a052","lastModifiedByType":"Application"}}' + headers: + cache-control: + - no-cache + content-length: + - '939' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:17 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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": {"configurationProfile": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.Automanage/configurationProfiles/profile000002"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile-assignment arc update + Connection: + - keep-alive + Content-Length: + - '194' + Content-Type: + - application/json + ParameterSetName: + - --n -g --machine-name --configuration-profile + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1/providers/Microsoft.Automanage/configurationProfileAssignments/default?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1/providers/Microsoft.Automanage/configurationProfileAssignments/default","name":"default","type":"Microsoft.Automanage/configurationProfileAssignments","properties":{"targetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.Automanage/configurationProfiles/profile000002","status":"NonConformant"},"systemData":{"createdAt":"2023-01-20T06:13:18.128175+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:13:18.128175+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '899' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:18 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile-assignment arc report list + Connection: + - keep-alive + ParameterSetName: + - --assignment-name -g --machine-name + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1/providers/Microsoft.Automanage/configurationProfileAssignments/default/reports?api-version=2022-05-04 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1/providers/Microsoft.Automanage/configurationProfileAssignments/default/reports/b695fbba-a47e-4477-8d44-ac1928e482b6","name":"b695fbba-a47e-4477-8d44-ac1928e482b6","type":"Microsoft.Automanage/configurationProfileAssignments/reports","properties":{"startTime":"2023-01-20T03:46:05.8035601Z","endTime":"2023-01-20T03:46:07.1124517Z","lastModifiedTime":"2023-01-20T03:46:07.1124514Z","duration":"PT1.3088916S","type":"Initial","status":"NonConformant","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.Automanage/configurationProfiles/profilehmjlza6ow3pqlsk2x","resources":[],"error":{"code":"UnsupportedOS","message":"The + machine has an unsupported OS version or distribution.","target":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1","details":null,"additionalInfo":[{"type":"hyperlink","info":"https://aka.ms/amvm_windows_supportedOS"},{"type":"hyperlink","info":"https://aka.ms/amvm_linux_supportedOS"},{"type":"hyperlink","info":"https://aka.ms/amvm_Arc_supportedOS"}]},"reportFormatVersion":null},"systemData":{"createdAt":"2023-01-20T03:46:07.2696368+00:00","createdBy":"d828acde-4b48-47f5-a6e8-52460104a052","createdByType":"Application","lastModifiedAt":"2023-01-20T03:46:07.2696368+00:00","lastModifiedBy":"d828acde-4b48-47f5-a6e8-52460104a052","lastModifiedByType":"Application"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1/providers/Microsoft.Automanage/configurationProfileAssignments/default/reports/fd957858-f2e0-401d-9a18-e4b209140077","name":"fd957858-f2e0-401d-9a18-e4b209140077","type":"Microsoft.Automanage/configurationProfileAssignments/reports","properties":{"startTime":"2023-01-20T03:46:33.9134518Z","endTime":"2023-01-20T03:46:35.3553345Z","lastModifiedTime":"2023-01-20T03:46:35.3553343Z","duration":"PT1.4418827S","type":"Consistency","status":"NonConformant","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.Automanage/configurationProfiles/profilejucml2pgti4dv36l7","resources":[],"error":{"code":"UnsupportedOS","message":"The + machine has an unsupported OS version or distribution.","target":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1","details":null,"additionalInfo":[{"type":"hyperlink","info":"https://aka.ms/amvm_windows_supportedOS"},{"type":"hyperlink","info":"https://aka.ms/amvm_linux_supportedOS"},{"type":"hyperlink","info":"https://aka.ms/amvm_Arc_supportedOS"}]},"reportFormatVersion":null},"systemData":{"createdAt":"2023-01-20T03:46:35.581645+00:00","createdBy":"d828acde-4b48-47f5-a6e8-52460104a052","createdByType":"Application","lastModifiedAt":"2023-01-20T03:46:35.581645+00:00","lastModifiedBy":"d828acde-4b48-47f5-a6e8-52460104a052","lastModifiedByType":"Application"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1/providers/Microsoft.Automanage/configurationProfileAssignments/default/reports/0a9cf1b2-cecc-4439-a218-70139ef8d0f7","name":"0a9cf1b2-cecc-4439-a218-70139ef8d0f7","type":"Microsoft.Automanage/configurationProfileAssignments/reports","properties":{"startTime":"2023-01-20T06:13:09.3629687Z","endTime":"2023-01-20T06:13:12.5487697Z","lastModifiedTime":"2023-01-20T06:13:12.5487695Z","duration":"PT3.185801S","type":"Initial","status":"NonConformant","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.Automanage/configurationProfiles/profile000001","resources":[],"error":{"code":"UnsupportedOS","message":"The + machine has an unsupported OS version or distribution.","target":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1","details":null,"additionalInfo":[{"type":"hyperlink","info":"https://aka.ms/amvm_windows_supportedOS"},{"type":"hyperlink","info":"https://aka.ms/amvm_linux_supportedOS"},{"type":"hyperlink","info":"https://aka.ms/amvm_Arc_supportedOS"}]},"reportFormatVersion":null},"systemData":{"createdAt":"2023-01-20T06:13:13.0928753+00:00","createdBy":"d828acde-4b48-47f5-a6e8-52460104a052","createdByType":"Application","lastModifiedAt":"2023-01-20T06:13:13.0928753+00:00","lastModifiedBy":"d828acde-4b48-47f5-a6e8-52460104a052","lastModifiedByType":"Application"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1/providers/Microsoft.Automanage/configurationProfileAssignments/default/reports/0daf51b9-1c5c-4dbd-ab62-6e9e26244c98","name":"0daf51b9-1c5c-4dbd-ab62-6e9e26244c98","type":"Microsoft.Automanage/configurationProfileAssignments/reports","properties":{"startTime":"2023-01-20T06:13:20.5968578Z","endTime":"2023-01-20T06:13:21.5531616Z","lastModifiedTime":"2023-01-20T06:13:21.5531613Z","duration":"PT0.9563038S","type":"Consistency","status":"NonConformant","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.Automanage/configurationProfiles/profile000002","resources":[],"error":{"code":"UnsupportedOS","message":"The + machine has an unsupported OS version or distribution.","target":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1","details":null,"additionalInfo":[{"type":"hyperlink","info":"https://aka.ms/amvm_windows_supportedOS"},{"type":"hyperlink","info":"https://aka.ms/amvm_linux_supportedOS"},{"type":"hyperlink","info":"https://aka.ms/amvm_Arc_supportedOS"}]},"reportFormatVersion":null},"systemData":{"createdAt":"2023-01-20T06:13:21.7133363+00:00","createdBy":"d828acde-4b48-47f5-a6e8-52460104a052","createdByType":"Application","lastModifiedAt":"2023-01-20T06:13:21.7133363+00:00","lastModifiedBy":"d828acde-4b48-47f5-a6e8-52460104a052","lastModifiedByType":"Application"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1/providers/Microsoft.Automanage/configurationProfileAssignments/default/reports/b32db40e-e06d-4d44-b223-d4f89e9fca73","name":"b32db40e-e06d-4d44-b223-d4f89e9fca73","type":"Microsoft.Automanage/configurationProfileAssignments/reports","properties":{"startTime":"2023-01-20T05:35:44.2032952Z","endTime":"2023-01-20T05:35:45.4790519Z","lastModifiedTime":"2023-01-20T05:35:45.4790517Z","duration":"PT1.2757567S","type":"Initial","status":"NonConformant","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.Automanage/configurationProfiles/profilekzhkpc5mtkpu3jz3k","resources":[],"error":{"code":"UnsupportedOS","message":"The + machine has an unsupported OS version or distribution.","target":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1","details":null,"additionalInfo":[{"type":"hyperlink","info":"https://aka.ms/amvm_windows_supportedOS"},{"type":"hyperlink","info":"https://aka.ms/amvm_linux_supportedOS"},{"type":"hyperlink","info":"https://aka.ms/amvm_Arc_supportedOS"}]},"reportFormatVersion":null},"systemData":{"createdAt":"2023-01-20T05:35:45.7084642+00:00","createdBy":"d828acde-4b48-47f5-a6e8-52460104a052","createdByType":"Application","lastModifiedAt":"2023-01-20T05:35:45.7084642+00:00","lastModifiedBy":"d828acde-4b48-47f5-a6e8-52460104a052","lastModifiedByType":"Application"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1/providers/Microsoft.Automanage/configurationProfileAssignments/default/reports/6e98e7d4-f4df-46bb-938e-39f0b513d738","name":"6e98e7d4-f4df-46bb-938e-39f0b513d738","type":"Microsoft.Automanage/configurationProfileAssignments/reports","properties":{"startTime":"2023-01-20T05:36:07.6120778Z","endTime":"2023-01-20T05:36:11.0837821Z","lastModifiedTime":"2023-01-20T05:36:11.0837819Z","duration":"PT3.4717043S","type":"Consistency","status":"NonConformant","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.Automanage/configurationProfiles/profile4yk3ouuaouleurlhs","resources":[],"error":{"code":"UnsupportedOS","message":"The + machine has an unsupported OS version or distribution.","target":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1","details":null,"additionalInfo":[{"type":"hyperlink","info":"https://aka.ms/amvm_windows_supportedOS"},{"type":"hyperlink","info":"https://aka.ms/amvm_linux_supportedOS"},{"type":"hyperlink","info":"https://aka.ms/amvm_Arc_supportedOS"}]},"reportFormatVersion":null},"systemData":{"createdAt":"2023-01-20T05:36:11.673933+00:00","createdBy":"d828acde-4b48-47f5-a6e8-52460104a052","createdByType":"Application","lastModifiedAt":"2023-01-20T05:36:11.673933+00:00","lastModifiedBy":"d828acde-4b48-47f5-a6e8-52460104a052","lastModifiedByType":"Application"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '9548' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:41 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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: + - automanage configuration-profile-assignment arc report show + Connection: + - keep-alive + ParameterSetName: + - -n --assignment-name -g --machine-name + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1/providers/Microsoft.Automanage/configurationProfileAssignments/default/reports/b695fbba-a47e-4477-8d44-ac1928e482b6?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1/providers/Microsoft.Automanage/configurationProfileAssignments/default/reports/b695fbba-a47e-4477-8d44-ac1928e482b6","name":"b695fbba-a47e-4477-8d44-ac1928e482b6","type":"Microsoft.Automanage/configurationProfileAssignments/reports","properties":{"startTime":"2023-01-20T03:46:05.8035601Z","endTime":"2023-01-20T03:46:07.1124517Z","lastModifiedTime":"2023-01-20T03:46:07.1124514Z","duration":"PT1.3088916S","type":"Initial","status":"NonConformant","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.Automanage/configurationProfiles/profilehmjlza6ow3pqlsk2x","resources":[],"error":{"code":"UnsupportedOS","message":"The + machine has an unsupported OS version or distribution.","target":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1","details":null,"additionalInfo":[{"type":"hyperlink","info":"https://aka.ms/amvm_windows_supportedOS"},{"type":"hyperlink","info":"https://aka.ms/amvm_linux_supportedOS"},{"type":"hyperlink","info":"https://aka.ms/amvm_Arc_supportedOS"}]},"reportFormatVersion":null},"systemData":{"createdAt":"2023-01-20T03:46:07.2696368+00:00","createdBy":"d828acde-4b48-47f5-a6e8-52460104a052","createdByType":"Application","lastModifiedAt":"2023-01-20T03:46:07.2696368+00:00","lastModifiedBy":"d828acde-4b48-47f5-a6e8-52460104a052","lastModifiedByType":"Application"}}' + headers: + cache-control: + - no-cache + content-length: + - '1591' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:44 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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: + - automanage configuration-profile-assignment arc delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -n -g --machine-name -y + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.HybridCompute/machines/arc1/providers/Microsoft.Automanage/configurationProfileAssignments/default?api-version=2022-05-04 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 20 Jan 2023 06:13:46 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14998' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile-assignment list + Connection: + - keep-alive + ParameterSetName: + - -g + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgtestautomanage/providers/Microsoft.Automanage/configurationProfileAssignments?api-version=2022-05-04 + response: + body: + string: '{"value":[]}' + headers: + cache-control: + - no-cache + content-length: + - '12' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:47 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-original-request-ids: + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + status: + code: 200 + message: OK +version: 1 diff --git a/src/automanage/azext_automanage/tests/latest/recordings/test_automanage_configuration_profile_assignment_cluster_scenarios.yaml b/src/automanage/azext_automanage/tests/latest/recordings/test_automanage_configuration_profile_assignment_cluster_scenarios.yaml new file mode 100644 index 00000000000..c6f40ec4acf --- /dev/null +++ b/src/automanage/azext_automanage/tests/latest/recordings/test_automanage_configuration_profile_assignment_cluster_scenarios.yaml @@ -0,0 +1,745 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile create + Connection: + - keep-alive + ParameterSetName: + - -n -g --configuration + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-resource/21.1.0b1 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg.automanage.profileassignment.cluster.000001?api-version=2021-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001","name":"clitest.rg.automanage.profileassignment.cluster.000001","type":"Microsoft.Resources/resourceGroups","location":"eastus2euap","tags":{"product":"azurecli","cause":"automation","date":"2023-01-20T06:12:49Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '391' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:12:54 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"location": "eastus2euap", "properties": {"configuration": {"Antimalware/Enable": + true}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile create + Connection: + - keep-alive + Content-Length: + - '90' + Content-Type: + - application/json + ParameterSetName: + - -n -g --configuration + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002","name":"profile000002","type":"Microsoft.Automanage/configurationProfiles","location":"eastus2euap","properties":{"configuration":{"Antimalware/Enable":true}},"systemData":{"createdAt":"2023-01-20T06:12:59.8871012+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:12:59.8871012+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '606' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:01 GMT + expires: + - '-1' + location: + - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002 + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - stack-hci cluster create + Connection: + - keep-alive + ParameterSetName: + - --cluster-name -g + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-resource/21.1.0b1 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg.automanage.profileassignment.cluster.000001?api-version=2021-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001","name":"clitest.rg.automanage.profileassignment.cluster.000001","type":"Microsoft.Resources/resourceGroups","location":"eastus2euap","tags":{"product":"azurecli","cause":"automation","date":"2023-01-20T06:12:49Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '391' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:01 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"location": "eastus2euap"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - stack-hci cluster create + Connection: + - keep-alive + Content-Length: + - '27' + Content-Type: + - application/json + ParameterSetName: + - --cluster-name -g + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-mgmt-azurestackhci/1.0.0b1 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.AzureStackHCI/clusters/cluster1?api-version=2022-05-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.AzureStackHCI/clusters/cluster1","name":"cluster1","type":"microsoft.azurestackhci/clusters","location":"eastus2euap","systemData":{"createdBy":"zhiyihuang@microsoft.com","createdByType":"User","createdAt":"2023-01-20T06:13:07.1461152Z","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2023-01-20T06:13:07.1461152Z"},"properties":{"provisioningState":"Succeeded","status":"NotYetRegistered","cloudId":"579592a1-c399-4111-8966-9bd85a2187f9","desiredProperties":{"windowsServerSubscription":"Disabled","diagnosticLevel":"Basic"},"trialDaysRemaining":60,"billingModel":"Trial","serviceEndpoint":"https://dp.stackhci.azure.com/eastus2euap/"}}' + headers: + cache-control: + - no-cache + content-length: + - '828' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:09 GMT + etag: + - '"030046ea-0000-3400-0000-63ca30f50000"' + expires: + - '-1' + mise-correlation-id: + - e12ae92a-e804-426b-8d1e-c38f540740e6 + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"configurationProfile": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile-assignment cluster create + Connection: + - keep-alive + Content-Length: + - '232' + Content-Type: + - application/json + ParameterSetName: + - -n -g --cluster-name --configuration-profile + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.AzureStackHci/clusters/cluster1/providers/Microsoft.Automanage/configurationProfileAssignments/default?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.AzureStackHci/clusters/cluster1/providers/Microsoft.Automanage/configurationProfileAssignments/default","name":"default","type":"Microsoft.Automanage/configurationProfileAssignments","properties":{"targetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.AzureStackHci/clusters/cluster1","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002","status":"New"},"systemData":{"createdAt":"2023-01-20T06:13:10.9942263+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:13:10.9942263+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '1013' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:12 GMT + expires: + - '-1' + location: + - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.AzureStackHci/clusters/cluster1/providers/Microsoft.Automanage/configurationProfileAssignments/default + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile-assignment cluster show + Connection: + - keep-alive + ParameterSetName: + - -n -g --cluster-name + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.AzureStackHci/clusters/cluster1/providers/Microsoft.Automanage/configurationProfileAssignments/default?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.AzureStackHci/clusters/cluster1/providers/Microsoft.Automanage/configurationProfileAssignments/default","name":"default","type":"Microsoft.Automanage/configurationProfileAssignments","properties":{"targetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.AzureStackHci/clusters/cluster1","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002","status":"InProgress"},"systemData":{"createdAt":"2023-01-20T06:13:14.8162038+00:00","createdBy":"d828acde-4b48-47f5-a6e8-52460104a052","createdByType":"Application","lastModifiedAt":"2023-01-20T06:13:14.8162038+00:00","lastModifiedBy":"d828acde-4b48-47f5-a6e8-52460104a052","lastModifiedByType":"Application"}}' + headers: + cache-control: + - no-cache + content-length: + - '1058' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:15 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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: + - automanage configuration-profile-assignment list + Connection: + - keep-alive + ParameterSetName: + - -g + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.Automanage/configurationProfileAssignments?api-version=2022-05-04 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.AzureStackHci/clusters/cluster1/providers/Microsoft.Automanage/configurationProfileAssignments/default","name":"default","type":"Microsoft.Automanage/configurationProfileAssignments","properties":{"targetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.AzureStackHci/clusters/cluster1","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002","status":"Error"},"systemData":{"createdAt":"2023-01-20T06:13:16.3658126+00:00","createdBy":"d828acde-4b48-47f5-a6e8-52460104a052","createdByType":"Application","lastModifiedAt":"2023-01-20T06:13:16.3658126+00:00","lastModifiedBy":"d828acde-4b48-47f5-a6e8-52460104a052","lastModifiedByType":"Application"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '1065' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:17 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-original-request-ids: + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile create + Connection: + - keep-alive + ParameterSetName: + - -n -g --configuration + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-resource/21.1.0b1 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg.automanage.profileassignment.cluster.000001?api-version=2021-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001","name":"clitest.rg.automanage.profileassignment.cluster.000001","type":"Microsoft.Resources/resourceGroups","location":"eastus2euap","tags":{"product":"azurecli","cause":"automation","date":"2023-01-20T06:12:49Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '391' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:18 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"location": "eastus2euap", "properties": {"configuration": {"Antimalware/Enable": + false}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile create + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + ParameterSetName: + - -n -g --configuration + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.Automanage/configurationProfiles/profile000003?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.Automanage/configurationProfiles/profile000003","name":"profile000003","type":"Microsoft.Automanage/configurationProfiles","location":"eastus2euap","properties":{"configuration":{"Antimalware/Enable":false}},"systemData":{"createdAt":"2023-01-20T06:13:24.0107875+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:13:24.0107875+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '607' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:26 GMT + expires: + - '-1' + location: + - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.Automanage/configurationProfiles/profile000003 + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile-assignment cluster update + Connection: + - keep-alive + ParameterSetName: + - --n -g --cluster-name --configuration-profile + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.AzureStackHci/clusters/cluster1/providers/Microsoft.Automanage/configurationProfileAssignments/default?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.AzureStackHci/clusters/cluster1/providers/Microsoft.Automanage/configurationProfileAssignments/default","name":"default","type":"Microsoft.Automanage/configurationProfileAssignments","properties":{"targetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.AzureStackHci/clusters/cluster1","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002","status":"Error"},"systemData":{"createdAt":"2023-01-20T06:13:16.3658126+00:00","createdBy":"d828acde-4b48-47f5-a6e8-52460104a052","createdByType":"Application","lastModifiedAt":"2023-01-20T06:13:16.3658126+00:00","lastModifiedBy":"d828acde-4b48-47f5-a6e8-52460104a052","lastModifiedByType":"Application"}}' + headers: + cache-control: + - no-cache + content-length: + - '1053' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:29 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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": {"configurationProfile": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.Automanage/configurationProfiles/profile000003"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile-assignment cluster update + Connection: + - keep-alive + Content-Length: + - '232' + Content-Type: + - application/json + ParameterSetName: + - --n -g --cluster-name --configuration-profile + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.AzureStackHci/clusters/cluster1/providers/Microsoft.Automanage/configurationProfileAssignments/default?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.AzureStackHci/clusters/cluster1/providers/Microsoft.Automanage/configurationProfileAssignments/default","name":"default","type":"Microsoft.Automanage/configurationProfileAssignments","properties":{"targetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.AzureStackHci/clusters/cluster1","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.Automanage/configurationProfiles/profile000003","status":"Error"},"systemData":{"createdAt":"2023-01-20T06:13:29.7808476+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:13:29.7808476+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '1015' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:30 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile-assignment cluster report list + Connection: + - keep-alive + ParameterSetName: + - --assignment-name -g --cluster-name + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.AzureStackHci/clusters/cluster1/providers/Microsoft.Automanage/configurationProfileAssignments/default/reports?api-version=2022-05-04 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.AzureStackHci/clusters/cluster1/providers/Microsoft.Automanage/configurationProfileAssignments/default/reports/be6b48e4-2042-4317-8240-6d360fcdbef5","name":"be6b48e4-2042-4317-8240-6d360fcdbef5","type":"Microsoft.Automanage/configurationProfileAssignments/reports","properties":{"startTime":"2023-01-20T06:13:15.3315914Z","endTime":"2023-01-20T06:13:16.2762564Z","lastModifiedTime":"2023-01-20T06:13:16.2762562Z","duration":"PT0.944665S","type":"Initial","status":"Error","configurationProfile":null,"resources":[],"error":{"code":null,"message":"Response + status code does not indicate success: PreconditionFailed (Precondition Failed).","target":null,"details":null,"additionalInfo":null},"reportFormatVersion":null},"systemData":{"createdAt":"2023-01-20T06:13:16.490778+00:00","createdBy":"d828acde-4b48-47f5-a6e8-52460104a052","createdByType":"Application","lastModifiedAt":"2023-01-20T06:13:16.490778+00:00","lastModifiedBy":"d828acde-4b48-47f5-a6e8-52460104a052","lastModifiedByType":"Application"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.AzureStackHci/clusters/cluster1/providers/Microsoft.Automanage/configurationProfileAssignments/default/reports/d037487d-8a8e-440e-9618-28eb8c7c8335","name":"d037487d-8a8e-440e-9618-28eb8c7c8335","type":"Microsoft.Automanage/configurationProfileAssignments/reports","properties":{"startTime":"2023-01-20T06:13:39.0565453Z","endTime":"2023-01-20T06:13:39.8037884Z","lastModifiedTime":"2023-01-20T06:13:39.8037883Z","duration":"PT0.7472431S","type":"Consistency","status":"Error","configurationProfile":null,"resources":[],"error":{"code":null,"message":"Response + status code does not indicate success: PreconditionFailed (Precondition Failed).","target":null,"details":null,"additionalInfo":null},"reportFormatVersion":null},"systemData":{"createdAt":"2023-01-20T06:13:40.1348331+00:00","createdBy":"d828acde-4b48-47f5-a6e8-52460104a052","createdByType":"Application","lastModifiedAt":"2023-01-20T06:13:40.1348331+00:00","lastModifiedBy":"d828acde-4b48-47f5-a6e8-52460104a052","lastModifiedByType":"Application"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '2326' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:53 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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: + - automanage configuration-profile-assignment cluster report show + Connection: + - keep-alive + ParameterSetName: + - -n --assignment-name -g --cluster-name + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.AzureStackHci/clusters/cluster1/providers/Microsoft.Automanage/configurationProfileAssignments/default/reports/be6b48e4-2042-4317-8240-6d360fcdbef5?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.AzureStackHci/clusters/cluster1/providers/Microsoft.Automanage/configurationProfileAssignments/default/reports/be6b48e4-2042-4317-8240-6d360fcdbef5","name":"be6b48e4-2042-4317-8240-6d360fcdbef5","type":"Microsoft.Automanage/configurationProfileAssignments/reports","properties":{"startTime":"2023-01-20T06:13:15.3315914Z","endTime":"2023-01-20T06:13:16.2762564Z","lastModifiedTime":"2023-01-20T06:13:16.2762562Z","duration":"PT0.944665S","type":"Initial","status":"Error","configurationProfile":null,"resources":[],"error":{"code":null,"message":"Response + status code does not indicate success: PreconditionFailed (Precondition Failed).","target":null,"details":null,"additionalInfo":null},"reportFormatVersion":null},"systemData":{"createdAt":"2023-01-20T06:13:16.490778+00:00","createdBy":"d828acde-4b48-47f5-a6e8-52460104a052","createdByType":"Application","lastModifiedAt":"2023-01-20T06:13:16.490778+00:00","lastModifiedBy":"d828acde-4b48-47f5-a6e8-52460104a052","lastModifiedByType":"Application"}}' + headers: + cache-control: + - no-cache + content-length: + - '1153' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:54 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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: + - automanage configuration-profile-assignment cluster delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -n -g --cluster-name -y + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.AzureStackHci/clusters/cluster1/providers/Microsoft.Automanage/configurationProfileAssignments/default?api-version=2022-05-04 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 20 Jan 2023 06:13:55 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile-assignment list + Connection: + - keep-alive + ParameterSetName: + - -g + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.cluster.000001/providers/Microsoft.Automanage/configurationProfileAssignments?api-version=2022-05-04 + response: + body: + string: '{"value":[]}' + headers: + cache-control: + - no-cache + content-length: + - '12' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:57 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-original-request-ids: + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + status: + code: 200 + message: OK +version: 1 diff --git a/src/automanage/azext_automanage/tests/latest/recordings/test_automanage_configuration_profile_assignment_vm_scenarios.yaml b/src/automanage/azext_automanage/tests/latest/recordings/test_automanage_configuration_profile_assignment_vm_scenarios.yaml new file mode 100644 index 00000000000..d441c68a128 --- /dev/null +++ b/src/automanage/azext_automanage/tests/latest/recordings/test_automanage_configuration_profile_assignment_vm_scenarios.yaml @@ -0,0 +1,1772 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile create + Connection: + - keep-alive + ParameterSetName: + - -n -g --configuration + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-resource/21.1.0b1 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg.automanage.profileassignment.vm.000001?api-version=2021-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001","name":"clitest.rg.automanage.profileassignment.vm.000001","type":"Microsoft.Resources/resourceGroups","location":"eastus2euap","tags":{"product":"azurecli","cause":"automation","date":"2023-01-20T06:12:49Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '381' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:12:54 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"location": "eastus2euap", "properties": {"configuration": {"Antimalware/Enable": + true}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile create + Connection: + - keep-alive + Content-Length: + - '90' + Content-Type: + - application/json + ParameterSetName: + - -n -g --configuration + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002","name":"profile000002","type":"Microsoft.Automanage/configurationProfiles","location":"eastus2euap","properties":{"configuration":{"Antimalware/Enable":true}},"systemData":{"createdAt":"2023-01-20T06:13:00.58581+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:13:00.58581+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '597' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:02 GMT + expires: + - '-1' + location: + - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002 + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --image --generate-ssh-keys + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-resource/21.1.0b1 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg.automanage.profileassignment.vm.000001?api-version=2021-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001","name":"clitest.rg.automanage.profileassignment.vm.000001","type":"Microsoft.Resources/resourceGroups","location":"eastus2euap","tags":{"product":"azurecli","cause":"automation","date":"2023-01-20T06:12:49Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '381' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:04 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.26.0 + method: GET + uri: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/arm-compute/quickstart-templates/aliases.json + response: + body: + string: "{\n \"$schema\": \"http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json\",\n + \ \"contentVersion\": \"1.0.0.0\",\n \"parameters\": {},\n \"variables\": + {},\n \"resources\": [],\n \"outputs\": {\n \"aliases\": {\n \"type\": + \"object\",\n \"value\": {\n \"Linux\": {\n \"CentOS\": + {\n \"publisher\": \"OpenLogic\",\n \"offer\": \"CentOS\",\n + \ \"sku\": \"7.5\",\n \"version\": \"latest\",\n \"architecture\": + \"x64\"\n },\n \"Debian\": {\n \"publisher\": + \"Debian\",\n \"offer\": \"debian-10\",\n \"sku\": \"10\",\n + \ \"version\": \"latest\",\n \"architecture\": \"x64\"\n + \ },\n \"Flatcar\": {\n \"publisher\": \"kinvolk\",\n + \ \"offer\": \"flatcar-container-linux-free\",\n \"sku\": + \"stable\",\n \"version\": \"latest\",\n \"architecture\": + \"x64\"\n },\n \"openSUSE-Leap\": {\n \"publisher\": + \"SUSE\",\n \"offer\": \"opensuse-leap-15-3\",\n \"sku\": + \"gen2\",\n \"version\": \"latest\",\n \"architecture\": + \"x64\"\n },\n \"RHEL\": {\n \"publisher\": \"RedHat\",\n + \ \"offer\": \"RHEL\",\n \"sku\": \"7-LVM\",\n \"version\": + \"latest\",\n \"architecture\": \"x64\"\n },\n \"SLES\": + {\n \"publisher\": \"SUSE\",\n \"offer\": \"sles-15-sp3\",\n + \ \"sku\": \"gen2\",\n \"version\": \"latest\",\n \"architecture\": + \"x64\"\n },\n \"UbuntuLTS\": {\n \"publisher\": + \"Canonical\",\n \"offer\": \"UbuntuServer\",\n \"sku\": + \"18.04-LTS\",\n \"version\": \"latest\",\n \"architecture\": + \"x64\"\n }\n },\n \"Windows\": {\n \"Win2022Datacenter\": + {\n \"publisher\": \"MicrosoftWindowsServer\",\n \"offer\": + \"WindowsServer\",\n \"sku\": \"2022-Datacenter\",\n \"version\": + \"latest\",\n \"architecture\": \"x64\"\n },\n \"Win2022AzureEditionCore\": + {\n \"publisher\": \"MicrosoftWindowsServer\",\n \"offer\": + \"WindowsServer\",\n \"sku\": \"2022-datacenter-azure-edition-core\",\n + \ \"version\": \"latest\",\n \"architecture\": \"x64\"\n + \ },\n \"Win2019Datacenter\": {\n \"publisher\": + \"MicrosoftWindowsServer\",\n \"offer\": \"WindowsServer\",\n \"sku\": + \"2019-Datacenter\",\n \"version\": \"latest\",\n \"architecture\": + \"x64\"\n },\n \"Win2016Datacenter\": {\n \"publisher\": + \"MicrosoftWindowsServer\",\n \"offer\": \"WindowsServer\",\n \"sku\": + \"2016-Datacenter\",\n \"version\": \"latest\",\n \"architecture\": + \"x64\"\n },\n \"Win2012R2Datacenter\": {\n \"publisher\": + \"MicrosoftWindowsServer\",\n \"offer\": \"WindowsServer\",\n \"sku\": + \"2012-R2-Datacenter\",\n \"version\": \"latest\",\n \"architecture\": + \"x64\"\n },\n \"Win2012Datacenter\": {\n \"publisher\": + \"MicrosoftWindowsServer\",\n \"offer\": \"WindowsServer\",\n \"sku\": + \"2012-Datacenter\",\n \"version\": \"latest\",\n \"architecture\": + \"x64\"\n },\n \"Win2008R2SP1\": {\n \"publisher\": + \"MicrosoftWindowsServer\",\n \"offer\": \"WindowsServer\",\n \"sku\": + \"2008-R2-SP1\",\n \"version\": \"latest\",\n \"architecture\": + \"x64\"\n }\n }\n }\n }\n }\n}" + headers: + accept-ranges: + - bytes + access-control-allow-origin: + - '*' + cache-control: + - max-age=300 + connection: + - keep-alive + content-length: + - '3463' + content-security-policy: + - default-src 'none'; style-src 'unsafe-inline'; sandbox + content-type: + - text/plain; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:04 GMT + etag: + - W/"41b202f4dc5098d126019dc00721a4c5e30df0c5196794514fadc3710ee2a5cb" + expires: + - Fri, 20 Jan 2023 06:18:04 GMT + source-age: + - '0' + strict-transport-security: + - max-age=31536000 + vary: + - Authorization,Accept-Encoding,Origin + via: + - 1.1 varnish + x-cache: + - HIT + x-cache-hits: + - '1' + x-content-type-options: + - nosniff + x-fastly-request-id: + - 471b6bf4dac1b48ea80290110be76219027cc936 + x-frame-options: + - deny + x-github-request-id: + - E30A:6795:9235:1F57B:63C75D91 + x-served-by: + - cache-qpg1254-QPG + x-timer: + - S1674195184.483968,VS0,VE296 + x-xss-protection: + - 1; mode=block + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --image --generate-ssh-keys + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-compute/29.0.0 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus2euap/publishers/Canonical/artifacttypes/vmimage/offers/UbuntuServer/skus/18.04-LTS/versions?$top=1&$orderby=name%20desc&api-version=2022-08-01 + response: + body: + string: "[\r\n {\r\n \"location\": \"EastUS2EUAP\",\r\n \"name\": \"18.04.202301100\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/EastUS2EUAP/Publishers/Canonical/ArtifactTypes/VMImage/Offers/UbuntuServer/Skus/18.04-LTS/Versions/18.04.202301100\"\r\n + \ }\r\n]" + headers: + cache-control: + - no-cache + content-length: + - '296' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:06 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/ListVMImagesVersionsFromLocation3Min;15999,Microsoft.Compute/ListVMImagesVersionsFromLocation30Min;43999 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --image --generate-ssh-keys + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-compute/29.0.0 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus2euap/publishers/Canonical/artifacttypes/vmimage/offers/UbuntuServer/skus/18.04-LTS/versions/18.04.202301100?api-version=2022-08-01 + response: + body: + string: "{\r\n \"properties\": {\r\n \"hyperVGeneration\": \"V1\",\r\n \"architecture\": + \"x64\",\r\n \"replicaType\": \"Unmanaged\",\r\n \"disallowed\": {\r\n + \ \"vmDiskType\": \"None\"\r\n },\r\n \"automaticOSUpgradeProperties\": + {\r\n \"automaticOSUpgradeSupported\": true\r\n },\r\n \"imageDeprecationStatus\": + {\r\n \"imageState\": \"Active\"\r\n },\r\n \"features\": [\r\n + \ {\r\n \"name\": \"IsAcceleratedNetworkSupported\",\r\n \"value\": + \"True\"\r\n },\r\n {\r\n \"name\": \"DiskControllerTypes\",\r\n + \ \"value\": \"SCSI, NVMe\"\r\n },\r\n {\r\n \"name\": + \"IsHibernateSupported\",\r\n \"value\": \"True\"\r\n }\r\n ],\r\n + \ \"osDiskImage\": {\r\n \"operatingSystem\": \"Linux\",\r\n \"sizeInGb\": + 31,\r\n \"sizeInBytes\": 32213303808\r\n },\r\n \"dataDiskImages\": + []\r\n },\r\n \"location\": \"EastUS2EUAP\",\r\n \"name\": \"18.04.202301100\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/EastUS2EUAP/Publishers/Canonical/ArtifactTypes/VMImage/Offers/UbuntuServer/Skus/18.04-LTS/Versions/18.04.202301100\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '1058' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:08 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/GetVMImageFromLocation3Min;12999,Microsoft.Compute/GetVMImageFromLocation30Min;73999 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --image --generate-ssh-keys + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-network/21.0.1 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/virtualNetworks?api-version=2022-01-01 + response: + body: + string: '{"value":[]}' + headers: + cache-control: + - no-cache + content-length: + - '12' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:09 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.26.0 + method: GET + uri: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/arm-compute/quickstart-templates/aliases.json + response: + body: + string: "{\n \"$schema\": \"http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json\",\n + \ \"contentVersion\": \"1.0.0.0\",\n \"parameters\": {},\n \"variables\": + {},\n \"resources\": [],\n \"outputs\": {\n \"aliases\": {\n \"type\": + \"object\",\n \"value\": {\n \"Linux\": {\n \"CentOS\": + {\n \"publisher\": \"OpenLogic\",\n \"offer\": \"CentOS\",\n + \ \"sku\": \"7.5\",\n \"version\": \"latest\",\n \"architecture\": + \"x64\"\n },\n \"Debian\": {\n \"publisher\": + \"Debian\",\n \"offer\": \"debian-10\",\n \"sku\": \"10\",\n + \ \"version\": \"latest\",\n \"architecture\": \"x64\"\n + \ },\n \"Flatcar\": {\n \"publisher\": \"kinvolk\",\n + \ \"offer\": \"flatcar-container-linux-free\",\n \"sku\": + \"stable\",\n \"version\": \"latest\",\n \"architecture\": + \"x64\"\n },\n \"openSUSE-Leap\": {\n \"publisher\": + \"SUSE\",\n \"offer\": \"opensuse-leap-15-3\",\n \"sku\": + \"gen2\",\n \"version\": \"latest\",\n \"architecture\": + \"x64\"\n },\n \"RHEL\": {\n \"publisher\": \"RedHat\",\n + \ \"offer\": \"RHEL\",\n \"sku\": \"7-LVM\",\n \"version\": + \"latest\",\n \"architecture\": \"x64\"\n },\n \"SLES\": + {\n \"publisher\": \"SUSE\",\n \"offer\": \"sles-15-sp3\",\n + \ \"sku\": \"gen2\",\n \"version\": \"latest\",\n \"architecture\": + \"x64\"\n },\n \"UbuntuLTS\": {\n \"publisher\": + \"Canonical\",\n \"offer\": \"UbuntuServer\",\n \"sku\": + \"18.04-LTS\",\n \"version\": \"latest\",\n \"architecture\": + \"x64\"\n }\n },\n \"Windows\": {\n \"Win2022Datacenter\": + {\n \"publisher\": \"MicrosoftWindowsServer\",\n \"offer\": + \"WindowsServer\",\n \"sku\": \"2022-Datacenter\",\n \"version\": + \"latest\",\n \"architecture\": \"x64\"\n },\n \"Win2022AzureEditionCore\": + {\n \"publisher\": \"MicrosoftWindowsServer\",\n \"offer\": + \"WindowsServer\",\n \"sku\": \"2022-datacenter-azure-edition-core\",\n + \ \"version\": \"latest\",\n \"architecture\": \"x64\"\n + \ },\n \"Win2019Datacenter\": {\n \"publisher\": + \"MicrosoftWindowsServer\",\n \"offer\": \"WindowsServer\",\n \"sku\": + \"2019-Datacenter\",\n \"version\": \"latest\",\n \"architecture\": + \"x64\"\n },\n \"Win2016Datacenter\": {\n \"publisher\": + \"MicrosoftWindowsServer\",\n \"offer\": \"WindowsServer\",\n \"sku\": + \"2016-Datacenter\",\n \"version\": \"latest\",\n \"architecture\": + \"x64\"\n },\n \"Win2012R2Datacenter\": {\n \"publisher\": + \"MicrosoftWindowsServer\",\n \"offer\": \"WindowsServer\",\n \"sku\": + \"2012-R2-Datacenter\",\n \"version\": \"latest\",\n \"architecture\": + \"x64\"\n },\n \"Win2012Datacenter\": {\n \"publisher\": + \"MicrosoftWindowsServer\",\n \"offer\": \"WindowsServer\",\n \"sku\": + \"2012-Datacenter\",\n \"version\": \"latest\",\n \"architecture\": + \"x64\"\n },\n \"Win2008R2SP1\": {\n \"publisher\": + \"MicrosoftWindowsServer\",\n \"offer\": \"WindowsServer\",\n \"sku\": + \"2008-R2-SP1\",\n \"version\": \"latest\",\n \"architecture\": + \"x64\"\n }\n }\n }\n }\n }\n}" + headers: + accept-ranges: + - bytes + access-control-allow-origin: + - '*' + cache-control: + - max-age=300 + connection: + - keep-alive + content-length: + - '3463' + content-security-policy: + - default-src 'none'; style-src 'unsafe-inline'; sandbox + content-type: + - text/plain; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:10 GMT + etag: + - W/"41b202f4dc5098d126019dc00721a4c5e30df0c5196794514fadc3710ee2a5cb" + expires: + - Fri, 20 Jan 2023 06:18:10 GMT + source-age: + - '6' + strict-transport-security: + - max-age=31536000 + vary: + - Authorization,Accept-Encoding,Origin + via: + - 1.1 varnish + x-cache: + - HIT + x-cache-hits: + - '1' + x-content-type-options: + - nosniff + x-fastly-request-id: + - ef2b9e431068bdf0f4755df732065d6b94aa891b + x-frame-options: + - deny + x-github-request-id: + - E30A:6795:9235:1F57B:63C75D91 + x-served-by: + - cache-qpg1255-QPG + x-timer: + - S1674195190.423284,VS0,VE2 + x-xss-protection: + - 1; mode=block + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --image --generate-ssh-keys + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-compute/29.0.0 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus2euap/publishers/Canonical/artifacttypes/vmimage/offers/UbuntuServer/skus/18.04-LTS/versions?$top=1&$orderby=name%20desc&api-version=2022-08-01 + response: + body: + string: "[\r\n {\r\n \"location\": \"EastUS2EUAP\",\r\n \"name\": \"18.04.202301100\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/EastUS2EUAP/Publishers/Canonical/ArtifactTypes/VMImage/Offers/UbuntuServer/Skus/18.04-LTS/Versions/18.04.202301100\"\r\n + \ }\r\n]" + headers: + cache-control: + - no-cache + content-length: + - '296' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:11 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/ListVMImagesVersionsFromLocation3Min;15998,Microsoft.Compute/ListVMImagesVersionsFromLocation30Min;43998 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --image --generate-ssh-keys + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-compute/29.0.0 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus2euap/publishers/Canonical/artifacttypes/vmimage/offers/UbuntuServer/skus/18.04-LTS/versions/18.04.202301100?api-version=2022-08-01 + response: + body: + string: "{\r\n \"properties\": {\r\n \"hyperVGeneration\": \"V1\",\r\n \"architecture\": + \"x64\",\r\n \"replicaType\": \"Unmanaged\",\r\n \"disallowed\": {\r\n + \ \"vmDiskType\": \"None\"\r\n },\r\n \"automaticOSUpgradeProperties\": + {\r\n \"automaticOSUpgradeSupported\": true\r\n },\r\n \"imageDeprecationStatus\": + {\r\n \"imageState\": \"Active\"\r\n },\r\n \"features\": [\r\n + \ {\r\n \"name\": \"IsAcceleratedNetworkSupported\",\r\n \"value\": + \"True\"\r\n },\r\n {\r\n \"name\": \"DiskControllerTypes\",\r\n + \ \"value\": \"SCSI, NVMe\"\r\n },\r\n {\r\n \"name\": + \"IsHibernateSupported\",\r\n \"value\": \"True\"\r\n }\r\n ],\r\n + \ \"osDiskImage\": {\r\n \"operatingSystem\": \"Linux\",\r\n \"sizeInGb\": + 31,\r\n \"sizeInBytes\": 32213303808\r\n },\r\n \"dataDiskImages\": + []\r\n },\r\n \"location\": \"EastUS2EUAP\",\r\n \"name\": \"18.04.202301100\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/EastUS2EUAP/Publishers/Canonical/ArtifactTypes/VMImage/Offers/UbuntuServer/Skus/18.04-LTS/Versions/18.04.202301100\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '1058' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:13 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/GetVMImageFromLocation3Min;12998,Microsoft.Compute/GetVMImageFromLocation30Min;73998 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --image --generate-ssh-keys + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-compute/29.0.0 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus2euap/publishers/Canonical/artifacttypes/vmimage/offers/UbuntuServer/skus/18.04-LTS/versions?$top=1&$orderby=name%20desc&api-version=2022-08-01 + response: + body: + string: "[\r\n {\r\n \"location\": \"EastUS2EUAP\",\r\n \"name\": \"18.04.202301100\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/EastUS2EUAP/Publishers/Canonical/ArtifactTypes/VMImage/Offers/UbuntuServer/Skus/18.04-LTS/Versions/18.04.202301100\"\r\n + \ }\r\n]" + headers: + cache-control: + - no-cache + content-length: + - '296' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:16 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/ListVMImagesVersionsFromLocation3Min;15997,Microsoft.Compute/ListVMImagesVersionsFromLocation30Min;43997 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --image --generate-ssh-keys + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-compute/29.0.0 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus2euap/publishers/Canonical/artifacttypes/vmimage/offers/UbuntuServer/skus/18.04-LTS/versions/18.04.202301100?api-version=2022-08-01 + response: + body: + string: "{\r\n \"properties\": {\r\n \"hyperVGeneration\": \"V1\",\r\n \"architecture\": + \"x64\",\r\n \"replicaType\": \"Unmanaged\",\r\n \"disallowed\": {\r\n + \ \"vmDiskType\": \"None\"\r\n },\r\n \"automaticOSUpgradeProperties\": + {\r\n \"automaticOSUpgradeSupported\": true\r\n },\r\n \"imageDeprecationStatus\": + {\r\n \"imageState\": \"Active\"\r\n },\r\n \"features\": [\r\n + \ {\r\n \"name\": \"IsAcceleratedNetworkSupported\",\r\n \"value\": + \"True\"\r\n },\r\n {\r\n \"name\": \"DiskControllerTypes\",\r\n + \ \"value\": \"SCSI, NVMe\"\r\n },\r\n {\r\n \"name\": + \"IsHibernateSupported\",\r\n \"value\": \"True\"\r\n }\r\n ],\r\n + \ \"osDiskImage\": {\r\n \"operatingSystem\": \"Linux\",\r\n \"sizeInGb\": + 31,\r\n \"sizeInBytes\": 32213303808\r\n },\r\n \"dataDiskImages\": + []\r\n },\r\n \"location\": \"EastUS2EUAP\",\r\n \"name\": \"18.04.202301100\",\r\n + \ \"id\": \"/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/EastUS2EUAP/Publishers/Canonical/ArtifactTypes/VMImage/Offers/UbuntuServer/Skus/18.04-LTS/Versions/18.04.202301100\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '1058' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:19 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/GetVMImageFromLocation3Min;12997,Microsoft.Compute/GetVMImageFromLocation30Min;73997 + status: + code: 200 + message: OK +- request: + body: '{"properties": {"template": {"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", "parameters": {}, "variables": {}, "resources": + [{"name": "vm000003VNET", "type": "Microsoft.Network/virtualNetworks", "location": + "eastus2euap", "apiVersion": "2015-06-15", "dependsOn": [], "tags": {}, "properties": + {"addressSpace": {"addressPrefixes": ["10.0.0.0/16"]}, "subnets": [{"name": + "vm000003Subnet", "properties": {"addressPrefix": "10.0.0.0/24"}}]}}, {"type": + "Microsoft.Network/networkSecurityGroups", "name": "vm000003NSG", "apiVersion": + "2015-06-15", "location": "eastus2euap", "tags": {}, "dependsOn": [], "properties": + {"securityRules": [{"name": "default-allow-ssh", "properties": {"protocol": + "Tcp", "sourcePortRange": "*", "destinationPortRange": "22", "sourceAddressPrefix": + "*", "destinationAddressPrefix": "*", "access": "Allow", "priority": 1000, "direction": + "Inbound"}}]}}, {"apiVersion": "2022-01-01", "type": "Microsoft.Network/publicIPAddresses", + "name": "vm000003PublicIP", "location": "eastus2euap", "tags": {}, "dependsOn": + [], "properties": {"publicIPAllocationMethod": null}}, {"apiVersion": "2015-06-15", + "type": "Microsoft.Network/networkInterfaces", "name": "vm000003VMNic", "location": + "eastus2euap", "tags": {}, "dependsOn": ["Microsoft.Network/virtualNetworks/vm000003VNET", + "Microsoft.Network/networkSecurityGroups/vm000003NSG", "Microsoft.Network/publicIpAddresses/vm000003PublicIP"], + "properties": {"ipConfigurations": [{"name": "ipconfigvm000003", "properties": + {"privateIPAllocationMethod": "Dynamic", "subnet": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/virtualNetworks/vm000003VNET/subnets/vm000003Subnet"}, + "publicIPAddress": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/publicIPAddresses/vm000003PublicIP"}}}], + "networkSecurityGroup": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/networkSecurityGroups/vm000003NSG"}}}, + {"apiVersion": "2022-08-01", "type": "Microsoft.Compute/virtualMachines", "name": + "vm000003", "location": "eastus2euap", "tags": {}, "dependsOn": ["Microsoft.Network/networkInterfaces/vm000003VMNic"], + "properties": {"hardwareProfile": {"vmSize": "Standard_DS1_v2"}, "networkProfile": + {"networkInterfaces": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/networkInterfaces/vm000003VMNic", + "properties": {"deleteOption": null}}]}, "storageProfile": {"osDisk": {"createOption": + "fromImage", "name": null, "caching": "ReadWrite", "managedDisk": {"storageAccountType": + null}}, "imageReference": {"publisher": "Canonical", "offer": "UbuntuServer", + "sku": "18.04-LTS", "version": "latest"}}, "osProfile": {"computerName": "vm000003", + "adminUsername": "zhiyihuang", "linuxConfiguration": {"disablePasswordAuthentication": + true, "ssh": {"publicKeys": [{"keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDy4KT6QZuyFbmWDdF/Vdc7B8PzU/TrgtnZNHofoVGpHUY9emsn6t3OhrT8y+he9stKP+CfcOEhR38Rn8gCJXdeo6VX3OyeCrkPMw+PZEj+TJi3Yp+N/BXritww+I8HFF+vihoKBPFP3DQSeq7VMQWGfFmf67Dm0r2F8CLvnqWPcrBx14GelF4vg3P3dDltHh9ZedEcNYA1b0+BcupL8249JVsv38oSMw3bTxTVzFzLY0KCgQno2HOt0VsZSvIp76UO4io4msPdmJm1NLIJ4s5YK6lHdnp8w+kuZi/pZyQx8GKbKjEqaxQaPDy5tHE5ohvIxqwZcewN7rlUJ3ZVYibd", + "path": "/home/zhiyihuang/.ssh/authorized_keys"}]}}}}}], "outputs": {}}, "parameters": + {}, "mode": "incremental"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + Content-Length: + - '3705' + Content-Type: + - application/json + ParameterSetName: + - -n -g --image --generate-ssh-keys + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-resource/21.1.0b1 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2021-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Resources/deployments/vm_deploy_jQMGDnL9OSTM3nGGKlWoJOUO31WPi26G","name":"vm_deploy_jQMGDnL9OSTM3nGGKlWoJOUO31WPi26G","type":"Microsoft.Resources/deployments","properties":{"templateHash":"13756716753965521186","parameters":{},"mode":"Incremental","provisioningState":"Accepted","timestamp":"2023-01-20T06:13:25.9774639Z","duration":"PT0.0001934S","correlationId":"b706806e-93a5-4562-beda-e115f67f7d77","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"virtualNetworks","locations":["eastus2euap"]},{"resourceType":"networkSecurityGroups","locations":["eastus2euap"]},{"resourceType":"publicIPAddresses","locations":["eastus2euap"]},{"resourceType":"networkInterfaces","locations":["eastus2euap"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["eastus2euap"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/virtualNetworks/vm000003VNET","resourceType":"Microsoft.Network/virtualNetworks","resourceName":"vm000003VNET"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/networkSecurityGroups/vm000003NSG","resourceType":"Microsoft.Network/networkSecurityGroups","resourceName":"vm000003NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/publicIPAddresses/vm000003PublicIP","resourceType":"Microsoft.Network/publicIPAddresses","resourceName":"vm000003PublicIP"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/networkInterfaces/vm000003VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm000003VMNic"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/networkInterfaces/vm000003VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm000003VMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vm000003"}]}}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Resources/deployments/vm_deploy_jQMGDnL9OSTM3nGGKlWoJOUO31WPi26G/operationStatuses/08585274116833028449?api-version=2021-04-01 + cache-control: + - no-cache + content-length: + - '2646' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:27 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --image --generate-ssh-keys + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-resource/21.1.0b1 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585274116833028449?api-version=2021-04-01 + response: + body: + string: '{"status":"Running"}' + headers: + cache-control: + - no-cache + content-length: + - '20' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:58 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --image --generate-ssh-keys + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-resource/21.1.0b1 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585274116833028449?api-version=2021-04-01 + response: + body: + string: '{"status":"Running"}' + headers: + cache-control: + - no-cache + content-length: + - '20' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:14:28 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --image --generate-ssh-keys + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-resource/21.1.0b1 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585274116833028449?api-version=2021-04-01 + response: + body: + string: '{"status":"Succeeded"}' + headers: + cache-control: + - no-cache + content-length: + - '22' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:14:59 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --image --generate-ssh-keys + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-resource/21.1.0b1 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2021-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Resources/deployments/vm_deploy_jQMGDnL9OSTM3nGGKlWoJOUO31WPi26G","name":"vm_deploy_jQMGDnL9OSTM3nGGKlWoJOUO31WPi26G","type":"Microsoft.Resources/deployments","properties":{"templateHash":"13756716753965521186","parameters":{},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2023-01-20T06:14:33.9460794Z","duration":"PT1M7.9688089S","correlationId":"b706806e-93a5-4562-beda-e115f67f7d77","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"virtualNetworks","locations":["eastus2euap"]},{"resourceType":"networkSecurityGroups","locations":["eastus2euap"]},{"resourceType":"publicIPAddresses","locations":["eastus2euap"]},{"resourceType":"networkInterfaces","locations":["eastus2euap"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["eastus2euap"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/virtualNetworks/vm000003VNET","resourceType":"Microsoft.Network/virtualNetworks","resourceName":"vm000003VNET"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/networkSecurityGroups/vm000003NSG","resourceType":"Microsoft.Network/networkSecurityGroups","resourceName":"vm000003NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/publicIPAddresses/vm000003PublicIP","resourceType":"Microsoft.Network/publicIPAddresses","resourceName":"vm000003PublicIP"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/networkInterfaces/vm000003VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm000003VMNic"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/networkInterfaces/vm000003VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm000003VMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vm000003"}],"outputs":{},"outputResources":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/networkInterfaces/vm000003VMNic"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/networkSecurityGroups/vm000003NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/publicIPAddresses/vm000003PublicIP"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/virtualNetworks/vm000003VNET"}]}}' + headers: + cache-control: + - no-cache + content-length: + - '3607' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:14:59 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + 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: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --image --generate-ssh-keys + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-compute/29.0.0 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003?$expand=instanceView&api-version=2022-08-01 + response: + body: + string: "{\r\n \"name\": \"vm000003\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003\",\r\n + \ \"type\": \"Microsoft.Compute/virtualMachines\",\r\n \"location\": \"eastus2euap\",\r\n + \ \"tags\": {},\r\n \"properties\": {\r\n \"vmId\": \"65755818-1c98-4462-9114-8024fc498ea6\",\r\n + \ \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\n },\r\n + \ \"storageProfile\": {\r\n \"imageReference\": {\r\n \"publisher\": + \"Canonical\",\r\n \"offer\": \"UbuntuServer\",\r\n \"sku\": + \"18.04-LTS\",\r\n \"version\": \"latest\",\r\n \"exactVersion\": + \"18.04.202301100\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": + \"Linux\",\r\n \"name\": \"vm000003_disk1_defe2fecf39d47c5912407ffc0c28c70\",\r\n + \ \"createOption\": \"FromImage\",\r\n \"caching\": \"ReadWrite\",\r\n + \ \"managedDisk\": {\r\n \"storageAccountType\": \"Premium_LRS\",\r\n + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/disks/vm000003_disk1_defe2fecf39d47c5912407ffc0c28c70\"\r\n + \ },\r\n \"deleteOption\": \"Detach\",\r\n \"diskSizeGB\": + 30\r\n },\r\n \"dataDisks\": []\r\n },\r\n \"osProfile\": + {\r\n \"computerName\": \"vm000003\",\r\n \"adminUsername\": \"zhiyihuang\",\r\n + \ \"linuxConfiguration\": {\r\n \"disablePasswordAuthentication\": + true,\r\n \"ssh\": {\r\n \"publicKeys\": [\r\n {\r\n + \ \"path\": \"/home/zhiyihuang/.ssh/authorized_keys\",\r\n \"keyData\": + \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDy4KT6QZuyFbmWDdF/Vdc7B8PzU/TrgtnZNHofoVGpHUY9emsn6t3OhrT8y+he9stKP+CfcOEhR38Rn8gCJXdeo6VX3OyeCrkPMw+PZEj+TJi3Yp+N/BXritww+I8HFF+vihoKBPFP3DQSeq7VMQWGfFmf67Dm0r2F8CLvnqWPcrBx14GelF4vg3P3dDltHh9ZedEcNYA1b0+BcupL8249JVsv38oSMw3bTxTVzFzLY0KCgQno2HOt0VsZSvIp76UO4io4msPdmJm1NLIJ4s5YK6lHdnp8w+kuZi/pZyQx8GKbKjEqaxQaPDy5tHE5ohvIxqwZcewN7rlUJ3ZVYibd\"\r\n + \ }\r\n ]\r\n },\r\n \"provisionVMAgent\": + true,\r\n \"patchSettings\": {\r\n \"patchMode\": \"ImageDefault\",\r\n + \ \"assessmentMode\": \"ImageDefault\"\r\n },\r\n \"enableVMAgentPlatformUpdates\": + false\r\n },\r\n \"secrets\": [],\r\n \"allowExtensionOperations\": + true,\r\n \"requireGuestProvisionSignal\": true\r\n },\r\n \"networkProfile\": + {\"networkInterfaces\":[{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/networkInterfaces/vm000003VMNic\"}]},\r\n + \ \"provisioningState\": \"Succeeded\",\r\n \"instanceView\": {\r\n \"computerName\": + \"vm000003\",\r\n \"osName\": \"ubuntu\",\r\n \"osVersion\": \"18.04\",\r\n + \ \"vmAgent\": {\r\n \"vmAgentVersion\": \"2.9.0.4\",\r\n \"statuses\": + [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n + \ \"level\": \"Info\",\r\n \"displayStatus\": \"Ready\",\r\n + \ \"message\": \"Guest Agent is running\",\r\n \"time\": + \"2023-01-20T06:14:33+00:00\"\r\n }\r\n ],\r\n \"extensionHandlers\": + []\r\n },\r\n \"disks\": [\r\n {\r\n \"name\": \"vm000003_disk1_defe2fecf39d47c5912407ffc0c28c70\",\r\n + \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n + \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning + succeeded\",\r\n \"time\": \"2023-01-20T06:14:13.6362534+00:00\"\r\n + \ }\r\n ]\r\n }\r\n ],\r\n \"hyperVGeneration\": + \"V1\",\r\n \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n + \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning + succeeded\",\r\n \"time\": \"2023-01-20T06:14:26.1524039+00:00\"\r\n + \ },\r\n {\r\n \"code\": \"PowerState/running\",\r\n + \ \"level\": \"Info\",\r\n \"displayStatus\": \"VM running\"\r\n + \ }\r\n ]\r\n },\r\n \"timeCreated\": \"2023-01-20T06:14:10.6361317+00:00\"\r\n + \ }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '3977' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:15:01 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/LowCostGet3Min;3997,Microsoft.Compute/LowCostGet30Min;31992 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --image --generate-ssh-keys + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-network/21.0.1 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/networkInterfaces/vm000003VMNic?api-version=2022-01-01 + response: + body: + string: "{\r\n \"name\": \"vm000003VMNic\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/networkInterfaces/vm000003VMNic\",\r\n + \ \"etag\": \"W/\\\"7e5fcc8b-f158-4299-895c-7d21fef087db\\\"\",\r\n \"tags\": + {},\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n + \ \"resourceGuid\": \"9c4fd676-29c4-4493-9a4f-823554781761\",\r\n \"ipConfigurations\": + [\r\n {\r\n \"name\": \"ipconfigvm000003\",\r\n \"id\": + \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/networkInterfaces/vm000003VMNic/ipConfigurations/ipconfigvm000003\",\r\n + \ \"etag\": \"W/\\\"7e5fcc8b-f158-4299-895c-7d21fef087db\\\"\",\r\n + \ \"type\": \"Microsoft.Network/networkInterfaces/ipConfigurations\",\r\n + \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n + \ \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\": + \"Dynamic\",\r\n \"publicIPAddress\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/publicIPAddresses/vm000003PublicIP\"\r\n + \ },\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/virtualNetworks/vm000003VNET/subnets/vm000003Subnet\"\r\n + \ },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\": + \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n \"dnsServers\": + [],\r\n \"appliedDnsServers\": [],\r\n \"internalDomainNameSuffix\": + \"5mf5erowfgkerl30e2stwfxczg.cbnx.internal.cloudapp.net\"\r\n },\r\n \"macAddress\": + \"00-22-48-71-CD-6B\",\r\n \"vnetEncryptionSupported\": false,\r\n \"enableIPForwarding\": + false,\r\n \"networkSecurityGroup\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/networkSecurityGroups/vm000003NSG\"\r\n + \ },\r\n \"primary\": true,\r\n \"virtualMachine\": {\r\n \"id\": + \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003\"\r\n + \ },\r\n \"hostedWorkloads\": [],\r\n \"tapConfigurations\": [],\r\n + \ \"nicType\": \"Standard\",\r\n \"allowPort25Out\": true\r\n },\r\n + \ \"type\": \"Microsoft.Network/networkInterfaces\",\r\n \"location\": \"eastus2euap\",\r\n + \ \"kind\": \"Regular\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '2602' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:15:05 GMT + etag: + - W/"7e5fcc8b-f158-4299-895c-7d21fef087db" + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-arm-service-request-id: + - fb1a664f-68c1-4c91-994a-bd4ad3dd1308 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm create + Connection: + - keep-alive + ParameterSetName: + - -n -g --image --generate-ssh-keys + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-network/21.0.1 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/publicIPAddresses/vm000003PublicIP?api-version=2022-01-01 + response: + body: + string: "{\r\n \"name\": \"vm000003PublicIP\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/publicIPAddresses/vm000003PublicIP\",\r\n + \ \"etag\": \"W/\\\"729725ca-d32a-477d-a101-6e35ada6e2fe\\\"\",\r\n \"location\": + \"eastus2euap\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": + \"Succeeded\",\r\n \"resourceGuid\": \"3ce600df-6fe2-4ba4-8f3c-924b136f1d0e\",\r\n + \ \"ipAddress\": \"20.47.244.4\",\r\n \"publicIPAddressVersion\": \"IPv4\",\r\n + \ \"publicIPAllocationMethod\": \"Dynamic\",\r\n \"idleTimeoutInMinutes\": + 4,\r\n \"ipTags\": [],\r\n \"ipConfiguration\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Network/networkInterfaces/vm000003VMNic/ipConfigurations/ipconfigvm000003\"\r\n + \ }\r\n },\r\n \"type\": \"Microsoft.Network/publicIPAddresses\",\r\n + \ \"sku\": {\r\n \"name\": \"Basic\",\r\n \"tier\": \"Regional\"\r\n + \ }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '993' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:15:05 GMT + etag: + - W/"729725ca-d32a-477d-a101-6e35ada6e2fe" + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-arm-service-request-id: + - 1ceec6e8-cdb6-4e44-8b92-e53935f863f3 + status: + code: 200 + message: OK +- request: + body: '{"properties": {"configurationProfile": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile-assignment vm create + Connection: + - keep-alive + Content-Length: + - '227' + Content-Type: + - application/json + ParameterSetName: + - -n -g --vm-name --configuration-profile + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003/providers/Microsoft.Automanage/configurationProfileAssignments/default?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003/providers/Microsoft.Automanage/configurationProfileAssignments/default","name":"default","type":"Microsoft.Automanage/configurationProfileAssignments","properties":{"targetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002","status":"New"},"systemData":{"createdAt":"2023-01-20T06:15:06.6110074+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:15:06.6110074+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '1000' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:15:08 GMT + expires: + - '-1' + location: + - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003/providers/Microsoft.Automanage/configurationProfileAssignments/default + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile-assignment vm show + Connection: + - keep-alive + ParameterSetName: + - -n -g --vm-name + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003/providers/Microsoft.Automanage/configurationProfileAssignments/default?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003/providers/Microsoft.Automanage/configurationProfileAssignments/default","name":"default","type":"Microsoft.Automanage/configurationProfileAssignments","properties":{"targetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002","status":"New"},"systemData":{"createdAt":"2023-01-20T06:15:06.6110074+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:15:06.6110074+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '1000' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:15:11 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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: + - automanage configuration-profile-assignment list + Connection: + - keep-alive + ParameterSetName: + - -g + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Automanage/configurationProfileAssignments?api-version=2022-05-04 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003/providers/Microsoft.Automanage/configurationProfileAssignments/default","name":"default","type":"Microsoft.Automanage/configurationProfileAssignments","properties":{"targetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002","status":"New"},"systemData":{"createdAt":"2023-01-20T06:15:06.6110074+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:15:06.6110074+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '1012' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:15:12 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-original-request-ids: + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile create + Connection: + - keep-alive + ParameterSetName: + - -n -g --configuration + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-resource/21.1.0b1 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg.automanage.profileassignment.vm.000001?api-version=2021-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001","name":"clitest.rg.automanage.profileassignment.vm.000001","type":"Microsoft.Resources/resourceGroups","location":"eastus2euap","tags":{"product":"azurecli","cause":"automation","date":"2023-01-20T06:12:49Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '381' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:15:14 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"location": "eastus2euap", "properties": {"configuration": {"Antimalware/Enable": + false}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile create + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + ParameterSetName: + - -n -g --configuration + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Automanage/configurationProfiles/profile000004?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Automanage/configurationProfiles/profile000004","name":"profile000004","type":"Microsoft.Automanage/configurationProfiles","location":"eastus2euap","properties":{"configuration":{"Antimalware/Enable":false}},"systemData":{"createdAt":"2023-01-20T06:15:22.9583536+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:15:22.9583536+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '602' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:15:25 GMT + expires: + - '-1' + location: + - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Automanage/configurationProfiles/profile000004 + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile-assignment vm update + Connection: + - keep-alive + ParameterSetName: + - --n -g --vm-name --configuration-profile + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003/providers/Microsoft.Automanage/configurationProfileAssignments/default?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003/providers/Microsoft.Automanage/configurationProfileAssignments/default","name":"default","type":"Microsoft.Automanage/configurationProfileAssignments","properties":{"targetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002","status":"Conformant"},"systemData":{"createdAt":"2023-01-20T06:15:18.8774666+00:00","createdBy":"d828acde-4b48-47f5-a6e8-52460104a052","createdByType":"Application","lastModifiedAt":"2023-01-20T06:15:18.8774666+00:00","lastModifiedBy":"d828acde-4b48-47f5-a6e8-52460104a052","lastModifiedByType":"Application"}}' + headers: + cache-control: + - no-cache + content-length: + - '1045' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:15:27 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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": {"configurationProfile": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Automanage/configurationProfiles/profile000004"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile-assignment vm update + Connection: + - keep-alive + Content-Length: + - '227' + Content-Type: + - application/json + ParameterSetName: + - --n -g --vm-name --configuration-profile + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003/providers/Microsoft.Automanage/configurationProfileAssignments/default?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003/providers/Microsoft.Automanage/configurationProfileAssignments/default","name":"default","type":"Microsoft.Automanage/configurationProfileAssignments","properties":{"targetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Automanage/configurationProfiles/profile000004","status":"Conformant"},"systemData":{"createdAt":"2023-01-20T06:15:28.5571377+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:15:28.5571377+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '1007' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:15:28 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile-assignment vm report list + Connection: + - keep-alive + ParameterSetName: + - --assignment-name -g --vm-name + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003/providers/Microsoft.Automanage/configurationProfileAssignments/default/reports?api-version=2022-05-04 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003/providers/Microsoft.Automanage/configurationProfileAssignments/default/reports/6180b1db-26f2-46c6-a6d6-b3dd18f41d6f","name":"6180b1db-26f2-46c6-a6d6-b3dd18f41d6f","type":"Microsoft.Automanage/configurationProfileAssignments/reports","properties":{"startTime":"2023-01-20T06:15:14.8254883Z","endTime":"2023-01-20T06:15:18.6210537Z","lastModifiedTime":"2023-01-20T06:15:18.6210534Z","duration":"PT3.7955654S","type":"Initial","status":"Conformant","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002","resources":[],"error":null,"reportFormatVersion":null},"systemData":{"createdAt":"2023-01-20T06:15:19.1274721+00:00","createdBy":"d828acde-4b48-47f5-a6e8-52460104a052","createdByType":"Application","lastModifiedAt":"2023-01-20T06:15:19.1274721+00:00","lastModifiedBy":"d828acde-4b48-47f5-a6e8-52460104a052","lastModifiedByType":"Application"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '1188' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:15:41 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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: + - automanage configuration-profile-assignment vm report show + Connection: + - keep-alive + ParameterSetName: + - -n --assignment-name -g --vm-name + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003/providers/Microsoft.Automanage/configurationProfileAssignments/default/reports/6180b1db-26f2-46c6-a6d6-b3dd18f41d6f?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003/providers/Microsoft.Automanage/configurationProfileAssignments/default/reports/6180b1db-26f2-46c6-a6d6-b3dd18f41d6f","name":"6180b1db-26f2-46c6-a6d6-b3dd18f41d6f","type":"Microsoft.Automanage/configurationProfileAssignments/reports","properties":{"startTime":"2023-01-20T06:15:14.8254883Z","endTime":"2023-01-20T06:15:18.6210537Z","lastModifiedTime":"2023-01-20T06:15:18.6210534Z","duration":"PT3.7955654S","type":"Initial","status":"Conformant","configurationProfile":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002","resources":[],"error":null,"reportFormatVersion":null},"systemData":{"createdAt":"2023-01-20T06:15:19.1274721+00:00","createdBy":"d828acde-4b48-47f5-a6e8-52460104a052","createdByType":"Application","lastModifiedAt":"2023-01-20T06:15:19.1274721+00:00","lastModifiedBy":"d828acde-4b48-47f5-a6e8-52460104a052","lastModifiedByType":"Application"}}' + headers: + cache-control: + - no-cache + content-length: + - '1176' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:15:44 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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: + - automanage configuration-profile-assignment vm delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -n -g --vm-name -y + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Compute/virtualMachines/vm000003/providers/Microsoft.Automanage/configurationProfileAssignments/default?api-version=2022-05-04 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 20 Jan 2023 06:15:45 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile-assignment list + Connection: + - keep-alive + ParameterSetName: + - -g + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.profileassignment.vm.000001/providers/Microsoft.Automanage/configurationProfileAssignments?api-version=2022-05-04 + response: + body: + string: '{"value":[]}' + headers: + cache-control: + - no-cache + content-length: + - '12' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:15:46 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-original-request-ids: + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + status: + code: 200 + message: OK +version: 1 diff --git a/src/automanage/azext_automanage/tests/latest/recordings/test_automanage_configuration_profile_scenarios.yaml b/src/automanage/azext_automanage/tests/latest/recordings/test_automanage_configuration_profile_scenarios.yaml new file mode 100644 index 00000000000..d660d9cfefd --- /dev/null +++ b/src/automanage/azext_automanage/tests/latest/recordings/test_automanage_configuration_profile_scenarios.yaml @@ -0,0 +1,777 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile create + Connection: + - keep-alive + ParameterSetName: + - -n -g --configuration + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-resource/21.1.0b1 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg.automanage.configurationprofile.000001?api-version=2021-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001","name":"clitest.rg.automanage.configurationprofile.000001","type":"Microsoft.Resources/resourceGroups","location":"eastus2euap","tags":{"product":"azurecli","cause":"automation","date":"2023-01-20T06:12:49Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '381' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:12:53 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"location": "eastus2euap", "properties": {"configuration": {"Antimalware/Enable": + false, "Backup/Enable": false, "VMInsights/Enable": true, "AzureSecurityCenter/Enable": + true, "UpdateManagement/Enable": true, "ChangeTrackingAndInventory/Enable": + true, "GuestConfiguration/Enable": true, "LogAnalytics/Enable": true, "BootDiagnostics/Enable": + true}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile create + Connection: + - keep-alive + Content-Length: + - '350' + Content-Type: + - application/json + ParameterSetName: + - -n -g --configuration + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002","name":"profile000002","type":"Microsoft.Automanage/configurationProfiles","location":"eastus2euap","properties":{"configuration":{"Antimalware/Enable":false,"Backup/Enable":false,"VMInsights/Enable":true,"AzureSecurityCenter/Enable":true,"UpdateManagement/Enable":true,"ChangeTrackingAndInventory/Enable":true,"GuestConfiguration/Enable":true,"LogAnalytics/Enable":true,"BootDiagnostics/Enable":true}},"systemData":{"createdAt":"2023-01-20T06:12:56.251165+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:12:56.251165+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '843' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:12:59 GMT + expires: + - '-1' + location: + - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002 + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile show + Connection: + - keep-alive + ParameterSetName: + - -n -g + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002","name":"profile000002","type":"Microsoft.Automanage/configurationProfiles","location":"eastus2euap","properties":{"configuration":{"Antimalware/Enable":false,"Backup/Enable":false,"VMInsights/Enable":true,"AzureSecurityCenter/Enable":true,"UpdateManagement/Enable":true,"ChangeTrackingAndInventory/Enable":true,"GuestConfiguration/Enable":true,"LogAnalytics/Enable":true,"BootDiagnostics/Enable":true}},"systemData":{"createdAt":"2023-01-20T06:12:56.251165+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:12:56.251165+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '843' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:01 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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: + - automanage configuration-profile list + Connection: + - keep-alive + ParameterSetName: + - -g + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles?api-version=2022-05-04 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002","name":"profile000002","type":"Microsoft.Automanage/configurationProfiles","location":"eastus2euap","properties":{"configuration":{"Antimalware/Enable":false,"Backup/Enable":false,"VMInsights/Enable":true,"AzureSecurityCenter/Enable":true,"UpdateManagement/Enable":true,"ChangeTrackingAndInventory/Enable":true,"GuestConfiguration/Enable":true,"LogAnalytics/Enable":true,"BootDiagnostics/Enable":true}},"systemData":{"createdAt":"2023-01-20T06:12:56.251165+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:12:56.251165+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '855' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:04 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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: + - automanage configuration-profile update + Connection: + - keep-alive + ParameterSetName: + - -n -g --configuration + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002","name":"profile000002","type":"Microsoft.Automanage/configurationProfiles","location":"eastus2euap","properties":{"configuration":{"Antimalware/Enable":false,"Backup/Enable":false,"VMInsights/Enable":true,"AzureSecurityCenter/Enable":true,"UpdateManagement/Enable":true,"ChangeTrackingAndInventory/Enable":true,"GuestConfiguration/Enable":true,"LogAnalytics/Enable":true,"BootDiagnostics/Enable":true}},"systemData":{"createdAt":"2023-01-20T06:12:56.251165+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:12:56.251165+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '843' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:06 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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": {"configuration": {"Antimalware/Enable": + true, "VMInsights/Enable": false}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile update + Connection: + - keep-alive + Content-Length: + - '118' + Content-Type: + - application/json + ParameterSetName: + - -n -g --configuration + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002","name":"profile000002","type":"Microsoft.Automanage/configurationProfiles","location":"eastus2euap","properties":{"configuration":{"Antimalware/Enable":true,"VMInsights/Enable":false}},"systemData":{"createdAt":"2023-01-20T06:12:56.251165+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:13:07.0824346+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '626' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:07 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile version create + Connection: + - keep-alive + ParameterSetName: + - --profile-name -g -n --configuration + User-Agent: + - AZURECLI/2.44.1 (PIP) azsdk-python-azure-mgmt-resource/21.1.0b1 Python/3.9.6 + (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg.automanage.configurationprofile.000001?api-version=2021-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001","name":"clitest.rg.automanage.configurationprofile.000001","type":"Microsoft.Resources/resourceGroups","location":"eastus2euap","tags":{"product":"azurecli","cause":"automation","date":"2023-01-20T06:12:49Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '381' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:07 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"location": "eastus2euap", "properties": {"configuration": {"Antimalware/Enable": + false}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile version create + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + ParameterSetName: + - --profile-name -g -n --configuration + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002/versions/version000003?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002/versions/version000003","name":"version000003","type":"Microsoft.Automanage/configurationProfiles/versions","location":"eastus2euap","properties":{"configuration":{"Antimalware/Enable":false}},"systemData":{"createdAt":"2023-01-20T06:13:12.7728436+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:13:12.7728436+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '634' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:15 GMT + expires: + - '-1' + location: + - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002/versions/version000003 + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile version show + Connection: + - keep-alive + ParameterSetName: + - --profile-name -g -n + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002/versions/version000003?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002/versions/version000003","name":"version000003","type":"Microsoft.Automanage/configurationProfiles/versions","location":"eastus2euap","properties":{"configuration":{"Antimalware/Enable":false}},"systemData":{"createdAt":"2023-01-20T06:13:12.7728436+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:13:12.7728436+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '634' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:17 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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: + - automanage configuration-profile version list + Connection: + - keep-alive + ParameterSetName: + - --profile-name -g + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002/versions?api-version=2022-05-04 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002/versions/version000003","name":"version000003","type":"Microsoft.Automanage/configurationProfiles/versions","location":"eastus2euap","properties":{"configuration":{"Antimalware/Enable":false}},"systemData":{"createdAt":"2023-01-20T06:13:12.7728436+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:13:12.7728436+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '646' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:18 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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: + - automanage configuration-profile version update + Connection: + - keep-alive + ParameterSetName: + - --profile-name -g -n --configuration + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002/versions/version000003?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002/versions/version000003","name":"version000003","type":"Microsoft.Automanage/configurationProfiles/versions","location":"eastus2euap","properties":{"configuration":{"Antimalware/Enable":false}},"systemData":{"createdAt":"2023-01-20T06:13:12.7728436+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:13:12.7728436+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '634' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:21 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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": {"configuration": {"Antimalware/Enable": + true}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile version update + Connection: + - keep-alive + Content-Length: + - '90' + Content-Type: + - application/json + ParameterSetName: + - --profile-name -g -n --configuration + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002/versions/version000003?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002/versions/version000003","name":"version000003","type":"Microsoft.Automanage/configurationProfiles/versions","location":"eastus2euap","properties":{"configuration":{"Antimalware/Enable":true}},"systemData":{"createdAt":"2023-01-20T06:13:12.7728436+00:00","createdBy":"zhiyihuang@microsoft.com","createdByType":"User","lastModifiedAt":"2023-01-20T06:13:21.9365566+00:00","lastModifiedBy":"zhiyihuang@microsoft.com","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '633' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:22 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile version delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --profile-name -g -n -y + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002/versions/version000003?api-version=2022-05-04 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 20 Jan 2023 06:13:29 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile version list + Connection: + - keep-alive + ParameterSetName: + - --profile-name -g + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002/versions?api-version=2022-05-04 + response: + body: + string: '{"value":[]}' + headers: + cache-control: + - no-cache + content-length: + - '12' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:31 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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: + - automanage configuration-profile delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -n -g -y + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles/profile000002?api-version=2022-05-04 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 20 Jan 2023 06:13:42 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage configuration-profile list + Connection: + - keep-alive + ParameterSetName: + - -g + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg.automanage.configurationprofile.000001/providers/Microsoft.Automanage/configurationProfiles?api-version=2022-05-04 + response: + body: + string: '{"value":[]}' + headers: + cache-control: + - no-cache + content-length: + - '12' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:43 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +version: 1 diff --git a/src/automanage/azext_automanage/tests/latest/recordings/test_automanage_scenarios.yaml b/src/automanage/azext_automanage/tests/latest/recordings/test_automanage_scenarios.yaml new file mode 100644 index 00000000000..a2b81e44826 --- /dev/null +++ b/src/automanage/azext_automanage/tests/latest/recordings/test_automanage_scenarios.yaml @@ -0,0 +1,284 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - automanage best-practice list + Connection: + - keep-alive + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Automanage/bestPractices?api-version=2022-05-04 + response: + body: + string: '{"value":[{"id":"/providers/Microsoft.Automanage/bestPractices/AzureBestPracticesProduction","name":"AzureBestPracticesProduction","type":"Microsoft.Automanage/bestPractices","properties":{"configuration":{"Antimalware/Enable":true,"Antimalware/EnableRealTimeProtection":true,"Antimalware/RunScheduledScan":true,"Antimalware/ScanType":"Quick","Antimalware/ScanDay":"7","Antimalware/ScanTimeInMinutes":"120","Backup/Enable":true,"Backup/PolicyName":"dailyBackupPolicy","Backup/TimeZone":"UTC","Backup/InstantRpRetentionRangeInDays":"2","Backup/SchedulePolicy/ScheduleRunFrequency":"Daily","Backup/SchedulePolicy/ScheduleRunTimes":["2017-01-26T00:00:00Z"],"Backup/SchedulePolicy/SchedulePolicyType":"SimpleSchedulePolicy","Backup/RetentionPolicy/RetentionPolicyType":"LongTermRetentionPolicy","Backup/RetentionPolicy/DailySchedule/RetentionTimes":["2017-01-26T00:00:00Z"],"Backup/RetentionPolicy/DailySchedule/RetentionDuration/Count":"180","Backup/RetentionPolicy/DailySchedule/RetentionDuration/DurationType":"Days","VMInsights/Enable":true,"AzureSecurityCenter/Enable":true,"UpdateManagement/Enable":true,"ChangeTrackingAndInventory/Enable":true,"GuestConfiguration/Enable":true,"LogAnalytics/Enable":true,"BootDiagnostics/Enable":true,"WindowsAdminCenter/Enable":false}},"systemData":{"createdAt":"2021-06-30T00:00:00+00:00","createdBy":"SYSTEM","createdByType":"User","lastModifiedAt":"2022-10-07T00:00:00+00:00","lastModifiedBy":"SYSTEM","lastModifiedByType":"User"}},{"id":"/providers/Microsoft.Automanage/bestPractices/AzureBestPracticesDevTest","name":"AzureBestPracticesDevTest","type":"Microsoft.Automanage/bestPractices","properties":{"configuration":{"Antimalware/Enable":true,"Antimalware/EnableRealTimeProtection":true,"Antimalware/RunScheduledScan":true,"Antimalware/ScanType":"Quick","Antimalware/ScanDay":"7","Antimalware/ScanTimeInMinutes":"120","Backup/Enable":false,"VMInsights/Enable":false,"AzureSecurityCenter/Enable":true,"UpdateManagement/Enable":true,"ChangeTrackingAndInventory/Enable":true,"GuestConfiguration/Enable":true,"LogAnalytics/Enable":true,"BootDiagnostics/Enable":true,"WindowsAdminCenter/Enable":true}},"systemData":{"createdAt":"2021-06-30T00:00:00+00:00","createdBy":"SYSTEM","createdByType":"User","lastModifiedAt":"2022-10-07T00:00:00+00:00","lastModifiedBy":"SYSTEM","lastModifiedByType":"User"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '2342' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:52 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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: + - automanage best-practice show + Connection: + - keep-alive + ParameterSetName: + - --best-practice-name + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Automanage/bestPractices/AzureBestPracticesDevTest?api-version=2022-05-04 + response: + body: + string: '{"id":"/providers/Microsoft.Automanage/bestPractices/AzureBestPracticesDevTest","name":"AzureBestPracticesDevTest","type":"Microsoft.Automanage/bestPractices","properties":{"configuration":{"Antimalware/Enable":true,"Antimalware/EnableRealTimeProtection":true,"Antimalware/RunScheduledScan":true,"Antimalware/ScanType":"Quick","Antimalware/ScanDay":"7","Antimalware/ScanTimeInMinutes":"120","Backup/Enable":false,"VMInsights/Enable":false,"AzureSecurityCenter/Enable":true,"UpdateManagement/Enable":true,"ChangeTrackingAndInventory/Enable":true,"GuestConfiguration/Enable":true,"LogAnalytics/Enable":true,"BootDiagnostics/Enable":true,"WindowsAdminCenter/Enable":true}},"systemData":{"createdAt":"2021-06-30T00:00:00+00:00","createdBy":"SYSTEM","createdByType":"User","lastModifiedAt":"2022-10-07T00:00:00+00:00","lastModifiedBy":"SYSTEM","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '868' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:53 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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: + - automanage best-practice version list + Connection: + - keep-alive + ParameterSetName: + - --best-practice-name + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Automanage/bestPractices/AzureBestPracticesDevTest/versions?api-version=2022-05-04 + response: + body: + string: '{"value":[{"id":"/providers/Microsoft.Automanage/bestPractices/AzureBestPracticesDevTest/versions/2021-06-30","name":"AzureBestPracticesDevTest/2021-06-30","type":"Microsoft.Automanage/bestPractices/versions","properties":{"configuration":{"Antimalware/Enable":"true","Antimalware/EnableRealTimeProtection":"true","Antimalware/RunScheduledScan":"true","Antimalware/ScanType":"Quick","Antimalware/ScanDay":"7","Antimalware/ScanTimeInMinutes":"120","Backup/Enable":"false","VMInsights/Enable":"false","AzureSecurityCenter/Enable":"true","UpdateManagement/Enable":"true","ChangeTrackingAndInventory/Enable":"true","GuestConfiguration/Enable":"true","LogAnalytics/Enable":"true","BootDiagnostics/Enable":"true"}},"systemData":{"createdAt":"2021-06-30T00:00:00+00:00","createdBy":"SYSTEM","createdByType":"User","lastModifiedAt":"2021-06-30T00:00:00+00:00","lastModifiedBy":"SYSTEM","lastModifiedByType":"User"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '909' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:54 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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: + - automanage best-practice version show + Connection: + - keep-alive + ParameterSetName: + - --best-practice-name --version-name + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/providers/Microsoft.Automanage/bestPractices/AzureBestPracticesDevTest/versions/2021-06-30?api-version=2022-05-04 + response: + body: + string: '{"id":"/providers/Microsoft.Automanage/bestPractices/AzureBestPracticesDevTest/versions/2021-06-30","name":"AzureBestPracticesDevTest/2021-06-30","type":"Microsoft.Automanage/bestPractices/versions","properties":{"configuration":{"Antimalware/Enable":"true","Antimalware/EnableRealTimeProtection":"true","Antimalware/RunScheduledScan":"true","Antimalware/ScanType":"Quick","Antimalware/ScanDay":"7","Antimalware/ScanTimeInMinutes":"120","Backup/Enable":"false","VMInsights/Enable":"false","AzureSecurityCenter/Enable":"true","UpdateManagement/Enable":"true","ChangeTrackingAndInventory/Enable":"true","GuestConfiguration/Enable":"true","LogAnalytics/Enable":"true","BootDiagnostics/Enable":"true"}},"systemData":{"createdAt":"2021-06-30T00:00:00+00:00","createdBy":"SYSTEM","createdByType":"User","lastModifiedAt":"2021-06-30T00:00:00+00:00","lastModifiedBy":"SYSTEM","lastModifiedByType":"User"}}' + headers: + cache-control: + - no-cache + content-length: + - '897' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:54 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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: + - automanage service-principal list + Connection: + - keep-alive + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Automanage/servicePrincipals?api-version=2022-05-04 + response: + body: + string: '{"value":[]}' + headers: + cache-control: + - no-cache + content-length: + - '12' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:55 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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: + - automanage service-principal show-default + Connection: + - keep-alive + User-Agent: + - AZURECLI/2.44.1 (PIP) (AAZ) azsdk-python-core/1.24.0 Python/3.9.6 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Automanage/servicePrincipals/default?api-version=2022-05-04 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Automanage/servicePrincipals/default","name":"default","type":"Microsoft.Automanage/servicePrincipals","properties":{"authorizationSet":true,"servicePrincipalId":"9c649736-fc13-44c4-a4af-9947c6a203e4"}}' + headers: + cache-control: + - no-cache + content-length: + - '281' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Jan 2023 06:13:57 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:a4d240dc-d543-4b4e-a019-0a571290b85d + 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 +version: 1 diff --git a/src/automanage/azext_automanage/tests/latest/test_automanage.py b/src/automanage/azext_automanage/tests/latest/test_automanage.py new file mode 100644 index 00000000000..d25cdba845f --- /dev/null +++ b/src/automanage/azext_automanage/tests/latest/test_automanage.py @@ -0,0 +1,194 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +from azure.cli.testsdk import * +from time import sleep + +class AutomanageScenario(ScenarioTest): + @ResourceGroupPreparer(location='eastus2euap', name_prefix='clitest.rg.automanage.') + def test_automanage_scenarios(self): + # best-practice + best_practice_name = self.cmd('az automanage best-practice list').get_output_in_json() + if best_practice_name and len(best_practice_name) >= 2: + best_practice_name = best_practice_name[1]["name"] + self.cmd('az automanage best-practice show --best-practice-name {}'.format(best_practice_name)) + + version_name = self.cmd('az automanage best-practice version list ' + '--best-practice-name {}'.format(best_practice_name)).get_output_in_json() + if version_name and len(version_name) >= 1: + version_name = version_name[0]["name"].split('/')[1] + + self.cmd('az automanage best-practice version show --best-practice-name {} --version-name ' + '{}'.format(best_practice_name, version_name)) + + # service-principal + self.cmd('az automanage service-principal list') + self.cmd('az automanage service-principal show-default') + + @ResourceGroupPreparer(location='eastus2euap', name_prefix='clitest.rg.automanage.configurationprofile.') + def test_automanage_configuration_profile_scenarios(self): + self.kwargs.update({ + 'profile_name': self.create_random_name(prefix='profile', length=24), + 'version_name': self.create_random_name(prefix='version', length=24) + }) + self.cmd('az automanage configuration-profile create -n {profile_name} -g {rg} --configuration ' + '{{\\\"Antimalware/Enable\\\":false,\\\"Backup/Enable\\\":false,\\\"VMInsights/Enable\\\":true,' + '\\\"AzureSecurityCenter/Enable\\\":true,\\\"UpdateManagement/Enable\\\":true,' + '\\\"ChangeTrackingAndInventory/Enable\\\":true,\\\"GuestConfiguration/Enable\\\":true,' + '\\\"LogAnalytics/Enable\\\":true,\\\"BootDiagnostics/Enable\\\":true}}') + self.cmd('az automanage configuration-profile show -n {profile_name} -g {rg}', + checks=[JMESPathCheck('name', self.kwargs.get('profile_name', '')), + JMESPathCheck('properties.configuration', {"Antimalware/Enable": False, + "AzureSecurityCenter/Enable": True, + "Backup/Enable": False, + "BootDiagnostics/Enable": True, + "ChangeTrackingAndInventory/Enable": True, + "GuestConfiguration/Enable": True, + "LogAnalytics/Enable": True, + "UpdateManagement/Enable": True, + "VMInsights/Enable": True})]) + self.cmd('az automanage configuration-profile list -g {rg}', checks=[JMESPathCheck('length(@)', 1)]) + self.cmd('az automanage configuration-profile update -n {profile_name} -g {rg} --configuration ' + '{{\\\"Antimalware/Enable\\\":true,\\\"VMInsights/Enable\\\":false}}', + checks=[JMESPathCheck('properties.configuration', {"Antimalware/Enable": True, + "VMInsights/Enable": False})]) + + # # version + self.cmd('az automanage configuration-profile version create --profile-name {profile_name} -g {rg} ' + '-n {version_name} --configuration {{\\\"Antimalware/Enable\\\":false}}') + self.cmd('az automanage configuration-profile version show --profile-name {profile_name} -g {rg} ' + '-n {version_name}', + checks=[JMESPathCheck('name', self.kwargs.get('version_name', '')), + JMESPathCheck('properties.configuration', {"Antimalware/Enable": False})]) + self.cmd('az automanage configuration-profile version list --profile-name {profile_name} -g {rg}', + checks=[JMESPathCheck('length(@)', 1)]) + self.cmd('az automanage configuration-profile version update --profile-name {profile_name} -g {rg} ' + '-n {version_name} --configuration {{\\\"Antimalware/Enable\\\":true}}', + checks=[JMESPathCheck('properties.configuration', {"Antimalware/Enable": True})]) + self.cmd('az automanage configuration-profile version delete --profile-name {profile_name} -g {rg} ' + '-n {version_name} -y') + self.cmd('az automanage configuration-profile version list --profile-name {profile_name} -g {rg}', + checks=[JMESPathCheck('length(@)', 0)]) + + self.cmd('az automanage configuration-profile delete -n {profile_name} -g {rg} -y') + self.cmd('az automanage configuration-profile list -g {rg}', checks=[JMESPathCheck('length(@)', 0)]) + + @ResourceGroupPreparer(location='eastus2euap', name_prefix='clitest.rg.automanage.profileassignment.vm.') + def test_automanage_configuration_profile_assignment_vm_scenarios(self): + self.kwargs.update({ + 'profile_name': self.create_random_name(prefix='profile', length=24), + 'vm_name': self.create_random_name(prefix='vm', length=24), + 'profile_name_2': self.create_random_name(prefix='profile', length=24), + }) + profile_id = self.cmd('az automanage configuration-profile create -n {profile_name} -g {rg} ' + '--configuration {{\\\"Antimalware/Enable\\\":true}}').get_output_in_json()["id"] + self.kwargs.update({'profile_id': profile_id}) + vm_id = self.cmd('az vm create -n {vm_name} -g {rg} --image UbuntuLTS --generate-ssh-keys').get_output_in_json()["id"] + self.cmd('az automanage configuration-profile-assignment vm create -n default -g {rg} ' + '--vm-name {vm_name} --configuration-profile {profile_id}') + self.cmd('az automanage configuration-profile-assignment vm show -n default -g {rg} --vm-name {vm_name}', + checks=[JMESPathCheck('name', 'default'), + JMESPathCheck('properties.configurationProfile', profile_id), + JMESPathCheck('properties.targetId', vm_id)]) + self.cmd('az automanage configuration-profile-assignment list -g {rg}', checks=[JMESPathCheck('length(@)', 1)]) + + profile_id_2 = self.cmd('az automanage configuration-profile create -n {profile_name_2} -g {rg} ' + '--configuration {{\\\"Antimalware/Enable\\\":false}}').get_output_in_json()["id"] + self.kwargs.update({'profile_id_2': profile_id_2}) + self.cmd('az automanage configuration-profile-assignment vm update --n default -g {rg} ' + '--vm-name {vm_name} --configuration-profile {profile_id_2}', + checks=[JMESPathCheck('properties.configurationProfile', profile_id_2), + JMESPathCheck('properties.targetId', vm_id)]) + + sleep(10) + report_name = self.cmd('az automanage configuration-profile-assignment vm report list --assignment-name default' + ' -g {rg} --vm-name {vm_name}').get_output_in_json()[0]["name"] + self.kwargs.update({'report_name': report_name}) + self.cmd('az automanage configuration-profile-assignment vm report show -n {report_name} ' + '--assignment-name default -g {rg} --vm-name {vm_name}') + + self.cmd('az automanage configuration-profile-assignment vm delete -n default -g {rg} --vm-name {vm_name} -y') + self.cmd('az automanage configuration-profile-assignment list -g {rg}', checks=[JMESPathCheck('length(@)', 0)]) + + @record_only() + # need to first run: + # az group create -l eastus2euap -g rgtestautomanage + # (run as admin in Powershell) Connect-AzConnectedMachine -ResourceGroupName rgtestautomanage -Name arc1 -Location eastus2euap + def test_automanage_configuration_profile_assignment_arc_scenarios(self): + self.kwargs.update({ + 'profile_name': self.create_random_name(prefix='profile', length=24), + 'rg': 'rgtestautomanage', + 'arc_name': 'arc1', + 'profile_name_2': self.create_random_name(prefix='profile', length=24), + }) + profile_id = self.cmd('az automanage configuration-profile create -n {profile_name} -g {rg} ' + '--configuration {{\\\"Antimalware/Enable\\\":true}}').get_output_in_json()["id"] + self.kwargs.update({'profile_id': profile_id}) + + self.cmd('az automanage configuration-profile-assignment arc create -n default -g {rg} ' + '--machine-name {arc_name} --configuration-profile {profile_id}') + self.cmd('az automanage configuration-profile-assignment arc show -n default -g {rg} --machine-name {arc_name}', + checks=[JMESPathCheck('name', 'default'), + JMESPathCheck('properties.configurationProfile', profile_id)]) + self.cmd('az automanage configuration-profile-assignment list -g {rg}', checks=[JMESPathCheck('length(@)', 1)]) + + profile_id_2 = self.cmd('az automanage configuration-profile create -n {profile_name_2} -g {rg} ' + '--configuration {{\\\"Antimalware/Enable\\\":false}}').get_output_in_json()["id"] + self.kwargs.update({'profile_id_2': profile_id_2}) + self.cmd('az automanage configuration-profile-assignment arc update --n default -g {rg} ' + '--machine-name {arc_name} --configuration-profile {profile_id_2}', + checks=[JMESPathCheck('properties.configurationProfile', profile_id_2)]) + + sleep(20) + report_name = self.cmd('az automanage configuration-profile-assignment arc report list --assignment-name ' + 'default -g {rg} --machine-name {arc_name}').get_output_in_json()[0]["name"] + self.kwargs.update({'report_name': report_name}) + self.cmd('az automanage configuration-profile-assignment arc report show -n {report_name} ' + '--assignment-name default -g {rg} --machine-name {arc_name}') + + self.cmd('az automanage configuration-profile-assignment arc delete -n default -g {rg} --machine-name ' + '{arc_name} -y') + self.cmd('az automanage configuration-profile-assignment list -g {rg}', checks=[JMESPathCheck('length(@)', 0)]) + + @record_only() + # self.cmd('az stack-hci cluster create --cluster-name {cluster_name} -g {rg}') + @ResourceGroupPreparer(location='eastus2euap', name_prefix='clitest.rg.automanage.profileassignment.cluster.') + def test_automanage_configuration_profile_assignment_cluster_scenarios(self): + self.kwargs.update({ + 'profile_name': self.create_random_name(prefix='profile', length=24), + 'cluster_name': 'cluster1', + 'profile_name_2': self.create_random_name(prefix='profile', length=24), + }) + profile_id = self.cmd('az automanage configuration-profile create -n {profile_name} -g {rg} ' + '--configuration {{\\\"Antimalware/Enable\\\":true}}').get_output_in_json()["id"] + self.kwargs.update({'profile_id': profile_id}) + + self.cmd('az automanage configuration-profile-assignment cluster create -n default -g {rg} ' + '--cluster-name {cluster_name} --configuration-profile {profile_id}') + self.cmd('az automanage configuration-profile-assignment cluster show -n default -g {rg} ' + '--cluster-name {cluster_name}', + checks=[JMESPathCheck('name', 'default'), + JMESPathCheck('properties.configurationProfile', profile_id)]) + self.cmd('az automanage configuration-profile-assignment list -g {rg}', checks=[JMESPathCheck('length(@)', 1)]) + + profile_id_2 = self.cmd('az automanage configuration-profile create -n {profile_name_2} -g {rg} ' + '--configuration {{\\\"Antimalware/Enable\\\":false}}').get_output_in_json()["id"] + self.kwargs.update({'profile_id_2': profile_id_2}) + self.cmd('az automanage configuration-profile-assignment cluster update --n default -g {rg} ' + '--cluster-name {cluster_name} --configuration-profile {profile_id_2}', + checks=[JMESPathCheck('properties.configurationProfile', profile_id_2)]) + + sleep(20) + report_name = self.cmd('az automanage configuration-profile-assignment cluster report list --assignment-name ' + 'default -g {rg} --cluster-name {cluster_name}').get_output_in_json()[0]["name"] + self.kwargs.update({'report_name': report_name}) + self.cmd('az automanage configuration-profile-assignment cluster report show -n {report_name} ' + '--assignment-name default -g {rg} --cluster-name {cluster_name}') + + self.cmd('az automanage configuration-profile-assignment cluster delete -n default -g {rg} --cluster-name ' + '{cluster_name} -y') + self.cmd('az automanage configuration-profile-assignment list -g {rg}', checks=[JMESPathCheck('length(@)', 0)]) diff --git a/src/automanage/setup.cfg b/src/automanage/setup.cfg new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/automanage/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/automanage/setup.py b/src/automanage/setup.py new file mode 100644 index 00000000000..6545b51ca73 --- /dev/null +++ b/src/automanage/setup.py @@ -0,0 +1,49 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +from codecs import open +from setuptools import setup, find_packages + + +# HISTORY.rst entry. +VERSION = '0.1.0' + +# The full list of classifiers is available at +# https://pypi.python.org/pypi?%3Aaction=list_classifiers +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', +] + +DEPENDENCIES = [] + +with open('README.md', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + +setup( + name='automanage', + version=VERSION, + description='Microsoft Azure Command-Line Tools Automanage Extension.', + long_description=README + '\n\n' + HISTORY, + license='MIT', + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions/tree/main/src/automanage', + classifiers=CLASSIFIERS, + packages=find_packages(exclude=["tests"]), + package_data={'azext_automanage': ['azext_metadata.json']}, + install_requires=DEPENDENCIES +) diff --git a/src/service_name.json b/src/service_name.json index f7600e667e3..5abca86ef6e 100644 --- a/src/service_name.json +++ b/src/service_name.json @@ -688,5 +688,10 @@ "Command": "az mobile-network", "AzureServiceName": "Mobile Network", "URL": "https://learn.microsoft.com/en-us/azure/private-5g-core/" + }, + { + "Command": "az automanage", + "AzureServiceName": "Azure Automanage", + "URL": "https://learn.microsoft.com/en-us/azure/automanage/" } ]