diff --git a/src/automation/azext_automation/aaz/latest/automation/__cmd_group.py b/src/automation/azext_automation/aaz/latest/automation/__cmd_group.py index c2ac75642d4..336762af7d2 100644 --- a/src/automation/azext_automation/aaz/latest/automation/__cmd_group.py +++ b/src/automation/azext_automation/aaz/latest/automation/__cmd_group.py @@ -1,23 +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( - "automation", -) -class __CMDGroup(AAZCommandGroup): - """Automation Account. - """ - pass - - -__all__ = ["__CMDGroup"] +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the 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( + "automation", +) +class __CMDGroup(AAZCommandGroup): + """Manage Automation Account + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/automation/azext_automation/aaz/latest/automation/__init__.py b/src/automation/azext_automation/aaz/latest/automation/__init__.py index 5a9d61963d6..709a5170d90 100644 --- a/src/automation/azext_automation/aaz/latest/automation/__init__.py +++ b/src/automation/azext_automation/aaz/latest/automation/__init__.py @@ -1,11 +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 * +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the 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/automation/azext_automation/aaz/latest/automation/python3package/__cmd_group.py b/src/automation/azext_automation/aaz/latest/automation/python3package/__cmd_group.py new file mode 100644 index 00000000000..28867eca689 --- /dev/null +++ b/src/automation/azext_automation/aaz/latest/automation/python3package/__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( + "automation python3package", +) +class __CMDGroup(AAZCommandGroup): + """python3package + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/automation/azext_automation/aaz/latest/automation/python3package/__init__.py b/src/automation/azext_automation/aaz/latest/automation/python3package/__init__.py new file mode 100644 index 00000000000..1f78565855b --- /dev/null +++ b/src/automation/azext_automation/aaz/latest/automation/python3package/__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/automation/azext_automation/aaz/latest/automation/python3package/_create.py b/src/automation/azext_automation/aaz/latest/automation/python3package/_create.py new file mode 100644 index 00000000000..bd384996ef6 --- /dev/null +++ b/src/automation/azext_automation/aaz/latest/automation/python3package/_create.py @@ -0,0 +1,305 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automation python3package create", +) +class Create(AAZCommand): + """Create or Update the python 3 package identified by package name. + """ + + _aaz_info = { + "version": "2022-08-08", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.automation/automationaccounts/{}/python3packages/{}", "2022-08-08"], + ] + } + + 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.automation_account_name = AAZStrArg( + options=["--automation-account-name"], + help="The name of the automation account.", + required=True, + id_part="name", + ) + _args_schema.package_name = AAZStrArg( + options=["-n", "--name", "--package-name"], + help="The name of python package.", + required=True, + id_part="child_name_1", + ) + _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="Gets or sets the tags attached to the resource.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.content_link = AAZObjectArg( + options=["--content-link"], + arg_group="Properties", + help="Gets or sets the module content link.", + required=True, + ) + + content_link = cls._args_schema.content_link + content_link.content_hash = AAZObjectArg( + options=["content-hash"], + help="Gets or sets the hash.", + ) + content_link.uri = AAZStrArg( + options=["uri"], + help="Gets or sets the uri of the runbook content.", + ) + content_link.version = AAZStrArg( + options=["version"], + help="Gets or sets the version of the content.", + ) + + content_hash = cls._args_schema.content_link.content_hash + content_hash.algorithm = AAZStrArg( + options=["algorithm"], + help="Gets or sets the content hash algorithm used to hash the content.", + required=True, + ) + content_hash.value = AAZStrArg( + options=["value"], + help="Gets or sets expected hash value of the content.", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.Python3PackageCreateOrUpdate(ctx=self.ctx)() + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class Python3PackageCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *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.Automation/automationAccounts/{automationAccountName}/python3Packages/{packageName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "automationAccountName", self.ctx.args.automation_account_name, + required=True, + ), + **self.serialize_url_param( + "packageName", self.ctx.args.package_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-08-08", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("contentLink", AAZObjectType, ".content_link", typ_kwargs={"flags": {"required": True}}) + + content_link = _builder.get(".properties.contentLink") + if content_link is not None: + content_link.set_prop("contentHash", AAZObjectType, ".content_hash") + content_link.set_prop("uri", AAZStrType, ".uri") + content_link.set_prop("version", AAZStrType, ".version") + + content_hash = _builder.get(".properties.contentLink.contentHash") + if content_hash is not None: + content_hash.set_prop("algorithm", AAZStrType, ".algorithm", typ_kwargs={"flags": {"required": True}}) + content_hash.set_prop("value", AAZStrType, ".value", typ_kwargs={"flags": {"required": True}}) + + 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.etag = AAZStrType() + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType() + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.activity_count = AAZIntType( + serialized_name="activityCount", + ) + properties.content_link = AAZObjectType( + serialized_name="contentLink", + ) + properties.creation_time = AAZStrType( + serialized_name="creationTime", + ) + properties.description = AAZStrType() + properties.error = AAZObjectType() + properties.is_composite = AAZBoolType( + serialized_name="isComposite", + ) + properties.is_global = AAZBoolType( + serialized_name="isGlobal", + ) + properties.last_modified_time = AAZStrType( + serialized_name="lastModifiedTime", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + ) + properties.size_in_bytes = AAZIntType( + serialized_name="sizeInBytes", + ) + properties.version = AAZStrType() + + content_link = cls._schema_on_200_201.properties.content_link + content_link.content_hash = AAZObjectType( + serialized_name="contentHash", + ) + content_link.uri = AAZStrType() + content_link.version = AAZStrType() + + content_hash = cls._schema_on_200_201.properties.content_link.content_hash + content_hash.algorithm = AAZStrType( + flags={"required": True}, + ) + content_hash.value = AAZStrType( + flags={"required": True}, + ) + + error = cls._schema_on_200_201.properties.error + error.code = AAZStrType() + error.message = AAZStrType() + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +__all__ = ["Create"] diff --git a/src/automation/azext_automation/aaz/latest/automation/python3package/_delete.py b/src/automation/azext_automation/aaz/latest/automation/python3package/_delete.py new file mode 100644 index 00000000000..9d7db34c128 --- /dev/null +++ b/src/automation/azext_automation/aaz/latest/automation/python3package/_delete.py @@ -0,0 +1,132 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automation python3package delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the python 3 package by name. + """ + + _aaz_info = { + "version": "2022-08-08", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.automation/automationaccounts/{}/python3packages/{}", "2022-08-08"], + ] + } + + 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.automation_account_name = AAZStrArg( + options=["--automation-account-name"], + help="The name of the automation account.", + required=True, + id_part="name", + ) + _args_schema.package_name = AAZStrArg( + options=["-n", "--name", "--package-name"], + help="The python package name.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.Python3PackageDelete(ctx=self.ctx)() + + class Python3PackageDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_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.Automation/automationAccounts/{automationAccountName}/python3Packages/{packageName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "automationAccountName", self.ctx.args.automation_account_name, + required=True, + ), + **self.serialize_url_param( + "packageName", self.ctx.args.package_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-08-08", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +__all__ = ["Delete"] diff --git a/src/automation/azext_automation/aaz/latest/automation/python3package/_list.py b/src/automation/azext_automation/aaz/latest/automation/python3package/_list.py new file mode 100644 index 00000000000..bac644ba0bd --- /dev/null +++ b/src/automation/azext_automation/aaz/latest/automation/python3package/_list.py @@ -0,0 +1,221 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automation python3package list", +) +class List(AAZCommand): + """Retrieve a list of python 3 packages. + """ + + _aaz_info = { + "version": "2022-08-08", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.automation/automationaccounts/{}/python3packages", "2022-08-08"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.automation_account_name = AAZStrArg( + options=["--automation-account-name"], + help="The name of the automation account.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.Python3PackageListByAutomationAccount(ctx=self.ctx)() + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class Python3PackageListByAutomationAccount(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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.Automation/automationAccounts/{automationAccountName}/python3Packages", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "automationAccountName", self.ctx.args.automation_account_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-08-08", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.etag = AAZStrType() + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType() + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.activity_count = AAZIntType( + serialized_name="activityCount", + ) + properties.content_link = AAZObjectType( + serialized_name="contentLink", + ) + properties.creation_time = AAZStrType( + serialized_name="creationTime", + ) + properties.description = AAZStrType() + properties.error = AAZObjectType() + properties.is_composite = AAZBoolType( + serialized_name="isComposite", + ) + properties.is_global = AAZBoolType( + serialized_name="isGlobal", + ) + properties.last_modified_time = AAZStrType( + serialized_name="lastModifiedTime", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + ) + properties.size_in_bytes = AAZIntType( + serialized_name="sizeInBytes", + ) + properties.version = AAZStrType() + + content_link = cls._schema_on_200.value.Element.properties.content_link + content_link.content_hash = AAZObjectType( + serialized_name="contentHash", + ) + content_link.uri = AAZStrType() + content_link.version = AAZStrType() + + content_hash = cls._schema_on_200.value.Element.properties.content_link.content_hash + content_hash.algorithm = AAZStrType( + flags={"required": True}, + ) + content_hash.value = AAZStrType( + flags={"required": True}, + ) + + error = cls._schema_on_200.value.Element.properties.error + error.code = AAZStrType() + error.message = AAZStrType() + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +__all__ = ["List"] diff --git a/src/automation/azext_automation/aaz/latest/automation/python3package/_show.py b/src/automation/azext_automation/aaz/latest/automation/python3package/_show.py new file mode 100644 index 00000000000..4b7edcf5102 --- /dev/null +++ b/src/automation/azext_automation/aaz/latest/automation/python3package/_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( + "automation python3package show", +) +class Show(AAZCommand): + """Retrieve the python 3 package identified by package name. + """ + + _aaz_info = { + "version": "2022-08-08", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.automation/automationaccounts/{}/python3packages/{}", "2022-08-08"], + ] + } + + 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.automation_account_name = AAZStrArg( + options=["--automation-account-name"], + help="The name of the automation account.", + required=True, + id_part="name", + ) + _args_schema.package_name = AAZStrArg( + options=["-n", "--name", "--package-name"], + help="The python package name.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.Python3PackageGet(ctx=self.ctx)() + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class Python3PackageGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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.Automation/automationAccounts/{automationAccountName}/python3Packages/{packageName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "automationAccountName", self.ctx.args.automation_account_name, + required=True, + ), + **self.serialize_url_param( + "packageName", self.ctx.args.package_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-08-08", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.etag = AAZStrType() + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType() + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.activity_count = AAZIntType( + serialized_name="activityCount", + ) + properties.content_link = AAZObjectType( + serialized_name="contentLink", + ) + properties.creation_time = AAZStrType( + serialized_name="creationTime", + ) + properties.description = AAZStrType() + properties.error = AAZObjectType() + properties.is_composite = AAZBoolType( + serialized_name="isComposite", + ) + properties.is_global = AAZBoolType( + serialized_name="isGlobal", + ) + properties.last_modified_time = AAZStrType( + serialized_name="lastModifiedTime", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + ) + properties.size_in_bytes = AAZIntType( + serialized_name="sizeInBytes", + ) + properties.version = AAZStrType() + + content_link = cls._schema_on_200.properties.content_link + content_link.content_hash = AAZObjectType( + serialized_name="contentHash", + ) + content_link.uri = AAZStrType() + content_link.version = AAZStrType() + + content_hash = cls._schema_on_200.properties.content_link.content_hash + content_hash.algorithm = AAZStrType( + flags={"required": True}, + ) + content_hash.value = AAZStrType( + flags={"required": True}, + ) + + error = cls._schema_on_200.properties.error + error.code = AAZStrType() + error.message = AAZStrType() + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +__all__ = ["Show"] diff --git a/src/automation/azext_automation/aaz/latest/automation/python3package/_update.py b/src/automation/azext_automation/aaz/latest/automation/python3package/_update.py new file mode 100644 index 00000000000..10d5e80c46f --- /dev/null +++ b/src/automation/azext_automation/aaz/latest/automation/python3package/_update.py @@ -0,0 +1,448 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "automation python3package update", +) +class Update(AAZCommand): + """Create or Update the python 3 package identified by package name. + """ + + _aaz_info = { + "version": "2022-08-08", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.automation/automationaccounts/{}/python3packages/{}", "2022-08-08"], + ] + } + + 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.automation_account_name = AAZStrArg( + options=["--automation-account-name"], + help="The name of the automation account.", + required=True, + id_part="name", + ) + _args_schema.package_name = AAZStrArg( + options=["-n", "--name", "--package-name"], + help="The python package name.", + required=True, + id_part="child_name_1", + ) + _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="Gets or sets the tags attached to the resource.", + nullable=True, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg( + nullable=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.content_link = AAZObjectArg( + options=["--content-link"], + arg_group="Properties", + help="Gets or sets the module content link.", + ) + + content_link = cls._args_schema.content_link + content_link.content_hash = AAZObjectArg( + options=["content-hash"], + help="Gets or sets the hash.", + nullable=True, + ) + content_link.uri = AAZStrArg( + options=["uri"], + help="Gets or sets the uri of the runbook content.", + nullable=True, + ) + content_link.version = AAZStrArg( + options=["version"], + help="Gets or sets the version of the content.", + nullable=True, + ) + + content_hash = cls._args_schema.content_link.content_hash + content_hash.algorithm = AAZStrArg( + options=["algorithm"], + help="Gets or sets the content hash algorithm used to hash the content.", + ) + content_hash.value = AAZStrArg( + options=["value"], + help="Gets or sets expected hash value of the content.", + ) + return cls._args_schema + + def _execute_operations(self): + self.Python3PackageGet(ctx=self.ctx)() + self.InstanceUpdateByJson(ctx=self.ctx)() + self.InstanceUpdateByGeneric(ctx=self.ctx)() + self.Python3PackageCreateOrUpdate(ctx=self.ctx)() + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class Python3PackageGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [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.Automation/automationAccounts/{automationAccountName}/python3Packages/{packageName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "automationAccountName", self.ctx.args.automation_account_name, + required=True, + ), + **self.serialize_url_param( + "packageName", self.ctx.args.package_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-08-08", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + _build_schema_module_read(cls._schema_on_200) + + return cls._schema_on_200 + + class Python3PackageCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *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.Automation/automationAccounts/{automationAccountName}/python3Packages/{packageName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "automationAccountName", self.ctx.args.automation_account_name, + required=True, + ), + **self.serialize_url_param( + "packageName", self.ctx.args.package_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-08-08", + 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() + _build_schema_module_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("contentLink", AAZObjectType, ".content_link", typ_kwargs={"flags": {"required": True}}) + + content_link = _builder.get(".properties.contentLink") + if content_link is not None: + content_link.set_prop("contentHash", AAZObjectType, ".content_hash") + content_link.set_prop("uri", AAZStrType, ".uri") + content_link.set_prop("version", AAZStrType, ".version") + + content_hash = _builder.get(".properties.contentLink.contentHash") + if content_hash is not None: + content_hash.set_prop("algorithm", AAZStrType, ".algorithm", typ_kwargs={"flags": {"required": True}}) + content_hash.set_prop("value", AAZStrType, ".value", typ_kwargs={"flags": {"required": True}}) + + 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 + ) + + +_schema_module_read = None + + +def _build_schema_module_read(_schema): + global _schema_module_read + if _schema_module_read is not None: + _schema.etag = _schema_module_read.etag + _schema.id = _schema_module_read.id + _schema.location = _schema_module_read.location + _schema.name = _schema_module_read.name + _schema.properties = _schema_module_read.properties + _schema.tags = _schema_module_read.tags + _schema.type = _schema_module_read.type + return + + _schema_module_read = AAZObjectType() + + module_read = _schema_module_read + module_read.etag = AAZStrType() + module_read.id = AAZStrType( + flags={"read_only": True}, + ) + module_read.location = AAZStrType() + module_read.name = AAZStrType( + flags={"read_only": True}, + ) + module_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + module_read.tags = AAZDictType() + module_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_module_read.properties + properties.activity_count = AAZIntType( + serialized_name="activityCount", + ) + properties.content_link = AAZObjectType( + serialized_name="contentLink", + ) + properties.creation_time = AAZStrType( + serialized_name="creationTime", + ) + properties.description = AAZStrType() + properties.error = AAZObjectType() + properties.is_composite = AAZBoolType( + serialized_name="isComposite", + ) + properties.is_global = AAZBoolType( + serialized_name="isGlobal", + ) + properties.last_modified_time = AAZStrType( + serialized_name="lastModifiedTime", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + ) + properties.size_in_bytes = AAZIntType( + serialized_name="sizeInBytes", + ) + properties.version = AAZStrType() + + content_link = _schema_module_read.properties.content_link + content_link.content_hash = AAZObjectType( + serialized_name="contentHash", + ) + content_link.uri = AAZStrType() + content_link.version = AAZStrType() + + content_hash = _schema_module_read.properties.content_link.content_hash + content_hash.algorithm = AAZStrType( + flags={"required": True}, + ) + content_hash.value = AAZStrType( + flags={"required": True}, + ) + + error = _schema_module_read.properties.error + error.code = AAZStrType() + error.message = AAZStrType() + + tags = _schema_module_read.tags + tags.Element = AAZStrType() + + _schema.etag = _schema_module_read.etag + _schema.id = _schema_module_read.id + _schema.location = _schema_module_read.location + _schema.name = _schema_module_read.name + _schema.properties = _schema_module_read.properties + _schema.tags = _schema_module_read.tags + _schema.type = _schema_module_read.type + + +__all__ = ["Update"] diff --git a/src/automation/azext_automation/azext_metadata.json b/src/automation/azext_automation/azext_metadata.json index a0d4f25e0f3..242f0e4ba54 100644 --- a/src/automation/azext_automation/azext_metadata.json +++ b/src/automation/azext_automation/azext_metadata.json @@ -1,4 +1,4 @@ -{ - "azext.isExperimental": true, - "azext.minCliCoreVersion": "2.39.0" +{ + "azext.isExperimental": true, + "azext.minCliCoreVersion": "2.39.0" } \ No newline at end of file diff --git a/src/automation/linter_exclusions.yml b/src/automation/linter_exclusions.yml index daf01e19db3..b19c0793c0a 100644 --- a/src/automation/linter_exclusions.yml +++ b/src/automation/linter_exclusions.yml @@ -253,3 +253,29 @@ automation software-update-configuration machine-runs list: software_update_configuration_machine_run_id: rule_exclusions: - option_length_too_long +automation python3package create: + parameters: + automation_account_name: + rule_exclusions: + - option_length_too_long +automation python3package delete: + parameters: + automation_account_name: + rule_exclusions: + - option_length_too_long +automation python3package list: + parameters: + automation_account_name: + rule_exclusions: + - option_length_too_long +automation python3package show: + parameters: + automation_account_name: + rule_exclusions: + - option_length_too_long +automation python3package update: + parameters: + automation_account_name: + rule_exclusions: + - option_length_too_long +