diff --git a/src/change-safety/HISTORY.rst b/src/change-safety/HISTORY.rst new file mode 100644 index 00000000000..abbff5a61a7 --- /dev/null +++ b/src/change-safety/HISTORY.rst @@ -0,0 +1,8 @@ +.. :changelog: + +Release History +=============== + +1.0.0b1 +++++++ +* Initial release. \ No newline at end of file diff --git a/src/change-safety/README.md b/src/change-safety/README.md new file mode 100644 index 00000000000..766bb2ac456 --- /dev/null +++ b/src/change-safety/README.md @@ -0,0 +1,5 @@ +# Azure CLI ChangeSafety Extension # +This is an extension to Azure CLI to manage ChangeSafety resources. + +## How to use ## +Please add commands usage here. \ No newline at end of file diff --git a/src/change-safety/azext_change_safety/__init__.py b/src/change-safety/azext_change_safety/__init__.py new file mode 100644 index 00000000000..9183bf5f46a --- /dev/null +++ b/src/change-safety/azext_change_safety/__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_change_safety._help import helps # pylint: disable=unused-import + + +class ChangeSafetyCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + custom_command_type = CliCommandType( + operations_tmpl='azext_change_safety.custom#{}') + super().__init__(cli_ctx=cli_ctx, + custom_command_type=custom_command_type) + + def load_command_table(self, args): + from azext_change_safety.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_change_safety._params import load_arguments + load_arguments(self, command) + + +COMMAND_LOADER_CLS = ChangeSafetyCommandsLoader diff --git a/src/change-safety/azext_change_safety/_help.py b/src/change-safety/azext_change_safety/_help.py new file mode 100644 index 00000000000..126d5d00714 --- /dev/null +++ b/src/change-safety/azext_change_safety/_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/change-safety/azext_change_safety/_params.py b/src/change-safety/azext_change_safety/_params.py new file mode 100644 index 00000000000..cfcec717c9c --- /dev/null +++ b/src/change-safety/azext_change_safety/_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/change-safety/azext_change_safety/aaz/__init__.py b/src/change-safety/azext_change_safety/aaz/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/change-safety/azext_change_safety/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/change-safety/azext_change_safety/aaz/latest/__init__.py b/src/change-safety/azext_change_safety/aaz/latest/__init__.py new file mode 100644 index 00000000000..f6acc11aa4e --- /dev/null +++ b/src/change-safety/azext_change_safety/aaz/latest/__init__.py @@ -0,0 +1,10 @@ +# -------------------------------------------------------------------------------------------- +# 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 + diff --git a/src/change-safety/azext_change_safety/aaz/latest/change_safety/__cmd_group.py b/src/change-safety/azext_change_safety/aaz/latest/change_safety/__cmd_group.py new file mode 100644 index 00000000000..c6dd5b296ba --- /dev/null +++ b/src/change-safety/azext_change_safety/aaz/latest/change_safety/__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( + "change-safety", +) +class __CMDGroup(AAZCommandGroup): + """Manage Change Safety + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/change-safety/azext_change_safety/aaz/latest/change_safety/__init__.py b/src/change-safety/azext_change_safety/aaz/latest/change_safety/__init__.py new file mode 100644 index 00000000000..5a9d61963d6 --- /dev/null +++ b/src/change-safety/azext_change_safety/aaz/latest/change_safety/__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/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/__cmd_group.py b/src/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/__cmd_group.py new file mode 100644 index 00000000000..00d6ce9e052 --- /dev/null +++ b/src/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/__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( + "change-safety change-state", +) +class __CMDGroup(AAZCommandGroup): + """Manage Change State + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/__init__.py b/src/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * +from ._wait import * diff --git a/src/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/_create.py b/src/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/_create.py new file mode 100644 index 00000000000..bf55a1876dc --- /dev/null +++ b/src/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/_create.py @@ -0,0 +1,776 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "change-safety change-state create", +) +class Create(AAZCommand): + """Create a ChangeState + """ + + _aaz_info = { + "version": "2025-03-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.changesafety/changestates/{}", "2025-03-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.change_state_name = AAZStrArg( + options=["-n", "--name", "--change-state-name"], + help="The name of the ChangeState resource.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,100}$", + max_length=100, + min_length=3, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "ChangeArtifact" + + _args_schema = cls._args_schema + _args_schema.c_arm_operation = AAZObjectArg( + options=["--c-arm-operation"], + arg_group="ChangeArtifact", + ) + _args_schema.c_external_arm_template = AAZObjectArg( + options=["--c-external-arm-template"], + arg_group="ChangeArtifact", + ) + _args_schema.c_external_bicep = AAZObjectArg( + options=["--c-external-bicep"], + arg_group="ChangeArtifact", + ) + _args_schema.c_inline_arm_template = AAZObjectArg( + options=["--c-inline-arm-template"], + arg_group="ChangeArtifact", + ) + _args_schema.c_inline_bicep = AAZObjectArg( + options=["--c-inline-bicep"], + arg_group="ChangeArtifact", + ) + _args_schema.c_template_spec = AAZObjectArg( + options=["--c-template-spec"], + arg_group="ChangeArtifact", + ) + _args_schema.c_name = AAZStrArg( + options=["--c-name"], + arg_group="ChangeArtifact", + help="Artifact label.", + ) + + c_arm_operation = cls._args_schema.c_arm_operation + c_arm_operation.artifact_payload = AAZObjectArg( + options=["artifact-payload"], + help="The actual payload content.", + required=True, + ) + + artifact_payload = cls._args_schema.c_arm_operation.artifact_payload + artifact_payload.operations = AAZListArg( + options=["operations"], + help="Arm Operation Array.", + required=True, + ) + + operations = cls._args_schema.c_arm_operation.artifact_payload.operations + operations.Element = AAZObjectArg() + + _element = cls._args_schema.c_arm_operation.artifact_payload.operations.Element + _element.content = AAZObjectArg( + options=["content"], + help="The resource operation content.", + ) + _element.http_method = AAZStrArg( + options=["http-method"], + help="The http method of the operation.", + required=True, + enum={"DELETE": "DELETE", "PATCH": "PATCH", "PUT": "PUT"}, + ) + _element.uri = AAZStrArg( + options=["uri"], + help="The uri of the operation.", + required=True, + ) + + content = cls._args_schema.c_arm_operation.artifact_payload.operations.Element.content + content.location = AAZStrArg( + options=["location"], + help="The location of the resource.", + ) + content.name = AAZStrArg( + options=["name"], + help="The name of the resource.", + ) + content.properties = AAZObjectArg( + options=["properties"], + help="The properties of the resource.", + required=True, + blank={}, + ) + + c_external_arm_template = cls._args_schema.c_external_arm_template + c_external_arm_template.artifact_payload = AAZObjectArg( + options=["artifact-payload"], + help="The actual payload content.", + required=True, + ) + + artifact_payload = cls._args_schema.c_external_arm_template.artifact_payload + artifact_payload.external_artifact_uri = AAZStrArg( + options=["external-artifact-uri"], + help="URI for the external ARM template or Bicep file.", + required=True, + ) + + c_external_bicep = cls._args_schema.c_external_bicep + c_external_bicep.artifact_payload = AAZObjectArg( + options=["artifact-payload"], + help="The actual payload content.", + required=True, + ) + + artifact_payload = cls._args_schema.c_external_bicep.artifact_payload + artifact_payload.external_artifact_uri = AAZStrArg( + options=["external-artifact-uri"], + help="URI for the external ARM template or Bicep file.", + required=True, + ) + + c_inline_arm_template = cls._args_schema.c_inline_arm_template + c_inline_arm_template.artifact_payload = AAZObjectArg( + options=["artifact-payload"], + help="The actual payload content.", + required=True, + ) + + artifact_payload = cls._args_schema.c_inline_arm_template.artifact_payload + artifact_payload.inline_script = AAZStrArg( + options=["inline-script"], + help="Inline ArmTemplate string or Bicep content.", + required=True, + ) + + c_inline_bicep = cls._args_schema.c_inline_bicep + c_inline_bicep.artifact_payload = AAZObjectArg( + options=["artifact-payload"], + help="The actual payload content.", + required=True, + ) + + artifact_payload = cls._args_schema.c_inline_bicep.artifact_payload + artifact_payload.inline_script = AAZStrArg( + options=["inline-script"], + help="Inline ArmTemplate string or Bicep content.", + required=True, + ) + + c_template_spec = cls._args_schema.c_template_spec + c_template_spec.artifact_payload = AAZObjectArg( + options=["artifact-payload"], + help="The actual payload content.", + required=True, + ) + + artifact_payload = cls._args_schema.c_template_spec.artifact_payload + artifact_payload.artifact_resource_id = AAZResourceIdArg( + options=["artifact-resource-id"], + help="TemplateSpec artifact resource Id in ARM.", + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.change_type = AAZStrArg( + options=["--change-type"], + arg_group="Properties", + help="Describes the type of the change.", + enum={"Breakglass": "Breakglass", "Emergency": "Emergency", "Normal": "Normal"}, + ) + _args_schema.comments = AAZStrArg( + options=["--comments"], + arg_group="Properties", + help="Comments about the last update to the changeState resource.", + fmt=AAZStrArgFormat( + max_length=2000, + ), + ) + _args_schema.description = AAZStrArg( + options=["--description"], + arg_group="Properties", + help="Brief description about the change.", + fmt=AAZStrArgFormat( + max_length=2000, + ), + ) + _args_schema.expiration_date = AAZDateTimeArg( + options=["--expiration-date"], + arg_group="Properties", + help="Change is expected to be expired by date, in ISO 8601 format.", + ) + _args_schema.service_catalog_reference = AAZStrArg( + options=["--service-catalog-reference"], + arg_group="Properties", + help="URI to the external service catalog reference.", + ) + _args_schema.stage_map_resource_id = AAZResourceIdArg( + options=["--stage-map-resource-id"], + arg_group="Properties", + help="Azure resource Id of the referenced StageMap.", + ) + _args_schema.stage_parameters = AAZDictArg( + options=["--stage-parameters"], + arg_group="Properties", + help="Schema of parameters that will be provided for each stageProgression.", + ) + _args_schema.state = AAZStrArg( + options=["--state"], + arg_group="Properties", + help="Internal status of the changestate resource.", + enum={"Abandoned": "Abandoned", "Completed": "Completed", "Failed": "Failed", "InProgress": "InProgress", "Initialized": "Initialized", "Paused": "Paused"}, + ) + _args_schema.work_item_reference = AAZStrArg( + options=["--work-item-reference"], + arg_group="Properties", + help="URI to the work item related to this change.", + ) + + stage_parameters = cls._args_schema.stage_parameters + stage_parameters.Element = AAZObjectArg() + + _element = cls._args_schema.stage_parameters.Element + _element.metadata = AAZDictArg( + options=["metadata"], + help="user-specified parameter metadata", + ) + _element.number = AAZObjectArg( + options=["number"], + ) + _element.string = AAZObjectArg( + options=["string"], + ) + + metadata = cls._args_schema.stage_parameters.Element.metadata + metadata.Element = AAZStrArg() + + number = cls._args_schema.stage_parameters.Element.number + number.allowed_values = AAZListArg( + options=["allowed-values"], + help="Allowed list of the values for the parameter.", + required=True, + ) + number.default_value = AAZIntArg( + options=["default-value"], + help="Default value for the parameter.", + ) + + allowed_values = cls._args_schema.stage_parameters.Element.number.allowed_values + allowed_values.Element = AAZIntArg() + + string = cls._args_schema.stage_parameters.Element.string + string.allowed_values = AAZListArg( + options=["allowed-values"], + help="Allowed list of the values for the parameter.", + required=True, + ) + string.default_value = AAZStrArg( + options=["default-value"], + help="Default value for the parameter.", + ) + + allowed_values = cls._args_schema.stage_parameters.Element.string.allowed_values + allowed_values.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ChangeStatesCreateOrUpdate(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 ChangeStatesCreateOrUpdate(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.ChangeSafety/changeStates/{changeStateName}", + **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( + "changeStateName", self.ctx.args.change_state_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", "2025-03-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("changeArtifact", AAZObjectType, ".", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("changeType", AAZStrType, ".change_type", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("comments", AAZStrType, ".comments") + properties.set_prop("description", AAZStrType, ".description") + properties.set_prop("expirationDate", AAZStrType, ".expiration_date", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("serviceCatalogReference", AAZStrType, ".service_catalog_reference") + properties.set_prop("stageMapResourceId", AAZStrType, ".stage_map_resource_id", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("stageParameters", AAZDictType, ".stage_parameters", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("state", AAZStrType, ".state", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("workItemReference", AAZStrType, ".work_item_reference") + + change_artifact = _builder.get(".properties.changeArtifact") + if change_artifact is not None: + change_artifact.set_const("artifactType", "ArmOperation", AAZStrType, ".c_arm_operation", typ_kwargs={"flags": {"required": True}}) + change_artifact.set_const("artifactType", "ExternalArmTemplate", AAZStrType, ".c_external_arm_template", typ_kwargs={"flags": {"required": True}}) + change_artifact.set_const("artifactType", "ExternalBicep", AAZStrType, ".c_external_bicep", typ_kwargs={"flags": {"required": True}}) + change_artifact.set_const("artifactType", "InlineArmTemplate", AAZStrType, ".c_inline_arm_template", typ_kwargs={"flags": {"required": True}}) + change_artifact.set_const("artifactType", "InlineBicep", AAZStrType, ".c_inline_bicep", typ_kwargs={"flags": {"required": True}}) + change_artifact.set_const("artifactType", "TemplateSpec", AAZStrType, ".c_template_spec", typ_kwargs={"flags": {"required": True}}) + change_artifact.set_prop("name", AAZStrType, ".c_name", typ_kwargs={"flags": {"required": True}}) + change_artifact.discriminate_by("artifactType", "ArmOperation") + change_artifact.discriminate_by("artifactType", "ExternalArmTemplate") + change_artifact.discriminate_by("artifactType", "ExternalBicep") + change_artifact.discriminate_by("artifactType", "InlineArmTemplate") + change_artifact.discriminate_by("artifactType", "InlineBicep") + change_artifact.discriminate_by("artifactType", "TemplateSpec") + + disc_arm_operation = _builder.get(".properties.changeArtifact{artifactType:ArmOperation}") + if disc_arm_operation is not None: + disc_arm_operation.set_prop("artifactPayload", AAZObjectType, ".c_arm_operation.artifact_payload", typ_kwargs={"flags": {"required": True}}) + + artifact_payload = _builder.get(".properties.changeArtifact{artifactType:ArmOperation}.artifactPayload") + if artifact_payload is not None: + artifact_payload.set_prop("operations", AAZListType, ".operations", typ_kwargs={"flags": {"required": True}}) + + operations = _builder.get(".properties.changeArtifact{artifactType:ArmOperation}.artifactPayload.operations") + if operations is not None: + operations.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.changeArtifact{artifactType:ArmOperation}.artifactPayload.operations[]") + if _elements is not None: + _elements.set_prop("content", AAZObjectType, ".content") + _elements.set_prop("httpMethod", AAZStrType, ".http_method", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("uri", AAZStrType, ".uri", typ_kwargs={"flags": {"required": True}}) + + content = _builder.get(".properties.changeArtifact{artifactType:ArmOperation}.artifactPayload.operations[].content") + if content is not None: + content.set_prop("location", AAZStrType, ".location") + content.set_prop("name", AAZStrType, ".name") + content.set_prop("properties", AAZObjectType, ".properties", typ_kwargs={"flags": {"required": True}}) + + disc_external_arm_template = _builder.get(".properties.changeArtifact{artifactType:ExternalArmTemplate}") + if disc_external_arm_template is not None: + disc_external_arm_template.set_prop("artifactPayload", AAZObjectType, ".c_external_arm_template.artifact_payload", typ_kwargs={"flags": {"required": True}}) + + artifact_payload = _builder.get(".properties.changeArtifact{artifactType:ExternalArmTemplate}.artifactPayload") + if artifact_payload is not None: + artifact_payload.set_prop("externalArtifactUri", AAZStrType, ".external_artifact_uri", typ_kwargs={"flags": {"required": True}}) + + disc_external_bicep = _builder.get(".properties.changeArtifact{artifactType:ExternalBicep}") + if disc_external_bicep is not None: + disc_external_bicep.set_prop("artifactPayload", AAZObjectType, ".c_external_bicep.artifact_payload", typ_kwargs={"flags": {"required": True}}) + + artifact_payload = _builder.get(".properties.changeArtifact{artifactType:ExternalBicep}.artifactPayload") + if artifact_payload is not None: + artifact_payload.set_prop("externalArtifactUri", AAZStrType, ".external_artifact_uri", typ_kwargs={"flags": {"required": True}}) + + disc_inline_arm_template = _builder.get(".properties.changeArtifact{artifactType:InlineArmTemplate}") + if disc_inline_arm_template is not None: + disc_inline_arm_template.set_prop("artifactPayload", AAZObjectType, ".c_inline_arm_template.artifact_payload", typ_kwargs={"flags": {"required": True}}) + + artifact_payload = _builder.get(".properties.changeArtifact{artifactType:InlineArmTemplate}.artifactPayload") + if artifact_payload is not None: + artifact_payload.set_prop("inlineScript", AAZStrType, ".inline_script", typ_kwargs={"flags": {"required": True}}) + + disc_inline_bicep = _builder.get(".properties.changeArtifact{artifactType:InlineBicep}") + if disc_inline_bicep is not None: + disc_inline_bicep.set_prop("artifactPayload", AAZObjectType, ".c_inline_bicep.artifact_payload", typ_kwargs={"flags": {"required": True}}) + + artifact_payload = _builder.get(".properties.changeArtifact{artifactType:InlineBicep}.artifactPayload") + if artifact_payload is not None: + artifact_payload.set_prop("inlineScript", AAZStrType, ".inline_script", typ_kwargs={"flags": {"required": True}}) + + disc_template_spec = _builder.get(".properties.changeArtifact{artifactType:TemplateSpec}") + if disc_template_spec is not None: + disc_template_spec.set_prop("artifactPayload", AAZObjectType, ".c_template_spec.artifact_payload", typ_kwargs={"flags": {"required": True}}) + + artifact_payload = _builder.get(".properties.changeArtifact{artifactType:TemplateSpec}.artifactPayload") + if artifact_payload is not None: + artifact_payload.set_prop("artifactResourceId", AAZStrType, ".artifact_resource_id", typ_kwargs={"flags": {"required": True}}) + + stage_parameters = _builder.get(".properties.stageParameters") + if stage_parameters is not None: + stage_parameters.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.stageParameters{}") + if _elements is not None: + _elements.set_prop("metadata", AAZDictType, ".metadata") + _elements.set_const("type", "number", AAZStrType, ".number", typ_kwargs={"flags": {"required": True}}) + _elements.set_const("type", "string", AAZStrType, ".string", typ_kwargs={"flags": {"required": True}}) + _elements.discriminate_by("type", "number") + _elements.discriminate_by("type", "string") + + metadata = _builder.get(".properties.stageParameters{}.metadata") + if metadata is not None: + metadata.set_elements(AAZStrType, ".") + + disc_number = _builder.get(".properties.stageParameters{}{type:number}") + if disc_number is not None: + disc_number.set_prop("allowedValues", AAZListType, ".number.allowed_values", typ_kwargs={"flags": {"required": True}}) + disc_number.set_prop("defaultValue", AAZIntType, ".number.default_value") + + allowed_values = _builder.get(".properties.stageParameters{}{type:number}.allowedValues") + if allowed_values is not None: + allowed_values.set_elements(AAZIntType, ".") + + disc_string = _builder.get(".properties.stageParameters{}{type:string}") + if disc_string is not None: + disc_string.set_prop("allowedValues", AAZListType, ".string.allowed_values", typ_kwargs={"flags": {"required": True}}) + disc_string.set_prop("defaultValue", AAZStrType, ".string.default_value") + + allowed_values = _builder.get(".properties.stageParameters{}{type:string}.allowedValues") + if allowed_values is not None: + allowed_values.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.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.change_artifact = AAZObjectType( + serialized_name="changeArtifact", + flags={"required": True}, + ) + properties.change_type = AAZStrType( + serialized_name="changeType", + flags={"required": True}, + ) + properties.comments = AAZStrType() + properties.description = AAZStrType() + properties.expiration_date = AAZStrType( + serialized_name="expirationDate", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.service_catalog_reference = AAZStrType( + serialized_name="serviceCatalogReference", + ) + properties.stage_map_resource_id = AAZStrType( + serialized_name="stageMapResourceId", + flags={"required": True}, + ) + properties.stage_map_snapshot = AAZListType( + serialized_name="stageMapSnapshot", + flags={"read_only": True}, + ) + properties.stage_parameters = AAZDictType( + serialized_name="stageParameters", + flags={"required": True}, + ) + properties.state = AAZStrType( + flags={"required": True}, + ) + properties.work_item_reference = AAZStrType( + serialized_name="workItemReference", + ) + + change_artifact = cls._schema_on_200_201.properties.change_artifact + change_artifact.artifact_type = AAZStrType( + serialized_name="artifactType", + flags={"required": True}, + ) + change_artifact.name = AAZStrType( + flags={"required": True}, + ) + + disc_arm_operation = cls._schema_on_200_201.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation") + disc_arm_operation.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200_201.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation").artifact_payload + artifact_payload.operations = AAZListType( + flags={"required": True}, + ) + + operations = cls._schema_on_200_201.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation").artifact_payload.operations + operations.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation").artifact_payload.operations.Element + _element.content = AAZObjectType() + _element.http_method = AAZStrType( + serialized_name="httpMethod", + flags={"required": True}, + ) + _element.uri = AAZStrType( + flags={"required": True}, + ) + + content = cls._schema_on_200_201.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation").artifact_payload.operations.Element.content + content.location = AAZStrType() + content.name = AAZStrType() + content.properties = AAZObjectType( + flags={"required": True}, + ) + + disc_external_arm_template = cls._schema_on_200_201.properties.change_artifact.discriminate_by("artifact_type", "ExternalArmTemplate") + disc_external_arm_template.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200_201.properties.change_artifact.discriminate_by("artifact_type", "ExternalArmTemplate").artifact_payload + artifact_payload.external_artifact_uri = AAZStrType( + serialized_name="externalArtifactUri", + flags={"required": True}, + ) + + disc_external_bicep = cls._schema_on_200_201.properties.change_artifact.discriminate_by("artifact_type", "ExternalBicep") + disc_external_bicep.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200_201.properties.change_artifact.discriminate_by("artifact_type", "ExternalBicep").artifact_payload + artifact_payload.external_artifact_uri = AAZStrType( + serialized_name="externalArtifactUri", + flags={"required": True}, + ) + + disc_inline_arm_template = cls._schema_on_200_201.properties.change_artifact.discriminate_by("artifact_type", "InlineArmTemplate") + disc_inline_arm_template.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200_201.properties.change_artifact.discriminate_by("artifact_type", "InlineArmTemplate").artifact_payload + artifact_payload.inline_script = AAZStrType( + serialized_name="inlineScript", + flags={"required": True}, + ) + + disc_inline_bicep = cls._schema_on_200_201.properties.change_artifact.discriminate_by("artifact_type", "InlineBicep") + disc_inline_bicep.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200_201.properties.change_artifact.discriminate_by("artifact_type", "InlineBicep").artifact_payload + artifact_payload.inline_script = AAZStrType( + serialized_name="inlineScript", + flags={"required": True}, + ) + + disc_template_spec = cls._schema_on_200_201.properties.change_artifact.discriminate_by("artifact_type", "TemplateSpec") + disc_template_spec.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200_201.properties.change_artifact.discriminate_by("artifact_type", "TemplateSpec").artifact_payload + artifact_payload.artifact_resource_id = AAZStrType( + serialized_name="artifactResourceId", + flags={"required": True}, + ) + + stage_map_snapshot = cls._schema_on_200_201.properties.stage_map_snapshot + stage_map_snapshot.Element = AAZAnyType() + + stage_parameters = cls._schema_on_200_201.properties.stage_parameters + stage_parameters.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.stage_parameters.Element + _element.metadata = AAZDictType() + _element.type = AAZStrType( + flags={"required": True}, + ) + + metadata = cls._schema_on_200_201.properties.stage_parameters.Element.metadata + metadata.Element = AAZStrType() + + disc_number = cls._schema_on_200_201.properties.stage_parameters.Element.discriminate_by("type", "number") + disc_number.allowed_values = AAZListType( + serialized_name="allowedValues", + flags={"required": True}, + ) + disc_number.default_value = AAZIntType( + serialized_name="defaultValue", + ) + + allowed_values = cls._schema_on_200_201.properties.stage_parameters.Element.discriminate_by("type", "number").allowed_values + allowed_values.Element = AAZIntType() + + disc_string = cls._schema_on_200_201.properties.stage_parameters.Element.discriminate_by("type", "string") + disc_string.allowed_values = AAZListType( + serialized_name="allowedValues", + flags={"required": True}, + ) + disc_string.default_value = AAZStrType( + serialized_name="defaultValue", + ) + + allowed_values = cls._schema_on_200_201.properties.stage_parameters.Element.discriminate_by("type", "string").allowed_values + allowed_values.Element = AAZStrType() + + 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/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/_delete.py b/src/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/_delete.py new file mode 100644 index 00000000000..b886a4fe679 --- /dev/null +++ b/src/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/_delete.py @@ -0,0 +1,165 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "change-safety change-state delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete a ChangeState + """ + + _aaz_info = { + "version": "2025-03-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.changesafety/changestates/{}", "2025-03-01-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.change_state_name = AAZStrArg( + options=["-n", "--name", "--change-state-name"], + help="The name of the ChangeState resource.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,100}$", + max_length=100, + min_length=3, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ChangeStatesDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class ChangeStatesDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ChangeSafety/changeStates/{changeStateName}", + **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( + "changeStateName", self.ctx.args.change_state_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", "2025-03-01-preview", + required=True, + ), + } + return parameters + + def on_204(self, session): + pass + + def on_200_201(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/_list.py b/src/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/_list.py new file mode 100644 index 00000000000..e8c2591f615 --- /dev/null +++ b/src/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/_list.py @@ -0,0 +1,378 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "change-safety change-state list", +) +class List(AAZCommand): + """List ChangeState resources by resource group + """ + + _aaz_info = { + "version": "2025-03-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.changesafety/changestates", "2025-03-01-preview"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ChangeStatesListByResourceGroup(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class ChangeStatesListByResourceGroup(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.ChangeSafety/changeStates", + **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", "2025-03-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.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.change_artifact = AAZObjectType( + serialized_name="changeArtifact", + flags={"required": True}, + ) + properties.change_type = AAZStrType( + serialized_name="changeType", + flags={"required": True}, + ) + properties.comments = AAZStrType() + properties.description = AAZStrType() + properties.expiration_date = AAZStrType( + serialized_name="expirationDate", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.service_catalog_reference = AAZStrType( + serialized_name="serviceCatalogReference", + ) + properties.stage_map_resource_id = AAZStrType( + serialized_name="stageMapResourceId", + flags={"required": True}, + ) + properties.stage_map_snapshot = AAZListType( + serialized_name="stageMapSnapshot", + flags={"read_only": True}, + ) + properties.stage_parameters = AAZDictType( + serialized_name="stageParameters", + flags={"required": True}, + ) + properties.state = AAZStrType( + flags={"required": True}, + ) + properties.work_item_reference = AAZStrType( + serialized_name="workItemReference", + ) + + change_artifact = cls._schema_on_200.value.Element.properties.change_artifact + change_artifact.artifact_type = AAZStrType( + serialized_name="artifactType", + flags={"required": True}, + ) + change_artifact.name = AAZStrType( + flags={"required": True}, + ) + + disc_arm_operation = cls._schema_on_200.value.Element.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation") + disc_arm_operation.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200.value.Element.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation").artifact_payload + artifact_payload.operations = AAZListType( + flags={"required": True}, + ) + + operations = cls._schema_on_200.value.Element.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation").artifact_payload.operations + operations.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation").artifact_payload.operations.Element + _element.content = AAZObjectType() + _element.http_method = AAZStrType( + serialized_name="httpMethod", + flags={"required": True}, + ) + _element.uri = AAZStrType( + flags={"required": True}, + ) + + content = cls._schema_on_200.value.Element.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation").artifact_payload.operations.Element.content + content.location = AAZStrType() + content.name = AAZStrType() + content.properties = AAZObjectType( + flags={"required": True}, + ) + + disc_external_arm_template = cls._schema_on_200.value.Element.properties.change_artifact.discriminate_by("artifact_type", "ExternalArmTemplate") + disc_external_arm_template.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200.value.Element.properties.change_artifact.discriminate_by("artifact_type", "ExternalArmTemplate").artifact_payload + artifact_payload.external_artifact_uri = AAZStrType( + serialized_name="externalArtifactUri", + flags={"required": True}, + ) + + disc_external_bicep = cls._schema_on_200.value.Element.properties.change_artifact.discriminate_by("artifact_type", "ExternalBicep") + disc_external_bicep.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200.value.Element.properties.change_artifact.discriminate_by("artifact_type", "ExternalBicep").artifact_payload + artifact_payload.external_artifact_uri = AAZStrType( + serialized_name="externalArtifactUri", + flags={"required": True}, + ) + + disc_inline_arm_template = cls._schema_on_200.value.Element.properties.change_artifact.discriminate_by("artifact_type", "InlineArmTemplate") + disc_inline_arm_template.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200.value.Element.properties.change_artifact.discriminate_by("artifact_type", "InlineArmTemplate").artifact_payload + artifact_payload.inline_script = AAZStrType( + serialized_name="inlineScript", + flags={"required": True}, + ) + + disc_inline_bicep = cls._schema_on_200.value.Element.properties.change_artifact.discriminate_by("artifact_type", "InlineBicep") + disc_inline_bicep.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200.value.Element.properties.change_artifact.discriminate_by("artifact_type", "InlineBicep").artifact_payload + artifact_payload.inline_script = AAZStrType( + serialized_name="inlineScript", + flags={"required": True}, + ) + + disc_template_spec = cls._schema_on_200.value.Element.properties.change_artifact.discriminate_by("artifact_type", "TemplateSpec") + disc_template_spec.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200.value.Element.properties.change_artifact.discriminate_by("artifact_type", "TemplateSpec").artifact_payload + artifact_payload.artifact_resource_id = AAZStrType( + serialized_name="artifactResourceId", + flags={"required": True}, + ) + + stage_map_snapshot = cls._schema_on_200.value.Element.properties.stage_map_snapshot + stage_map_snapshot.Element = AAZAnyType() + + stage_parameters = cls._schema_on_200.value.Element.properties.stage_parameters + stage_parameters.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.stage_parameters.Element + _element.metadata = AAZDictType() + _element.type = AAZStrType( + flags={"required": True}, + ) + + metadata = cls._schema_on_200.value.Element.properties.stage_parameters.Element.metadata + metadata.Element = AAZStrType() + + disc_number = cls._schema_on_200.value.Element.properties.stage_parameters.Element.discriminate_by("type", "number") + disc_number.allowed_values = AAZListType( + serialized_name="allowedValues", + flags={"required": True}, + ) + disc_number.default_value = AAZIntType( + serialized_name="defaultValue", + ) + + allowed_values = cls._schema_on_200.value.Element.properties.stage_parameters.Element.discriminate_by("type", "number").allowed_values + allowed_values.Element = AAZIntType() + + disc_string = cls._schema_on_200.value.Element.properties.stage_parameters.Element.discriminate_by("type", "string") + disc_string.allowed_values = AAZListType( + serialized_name="allowedValues", + flags={"required": True}, + ) + disc_string.default_value = AAZStrType( + serialized_name="defaultValue", + ) + + allowed_values = cls._schema_on_200.value.Element.properties.stage_parameters.Element.discriminate_by("type", "string").allowed_values + allowed_values.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/_show.py b/src/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/_show.py new file mode 100644 index 00000000000..4a6abe71df5 --- /dev/null +++ b/src/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/_show.py @@ -0,0 +1,380 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "change-safety change-state show", +) +class Show(AAZCommand): + """Get a ChangeState + """ + + _aaz_info = { + "version": "2025-03-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.changesafety/changestates/{}", "2025-03-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.change_state_name = AAZStrArg( + options=["-n", "--name", "--change-state-name"], + help="The name of the ChangeState resource.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,100}$", + max_length=100, + min_length=3, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ChangeStatesGet(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 ChangeStatesGet(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.ChangeSafety/changeStates/{changeStateName}", + **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( + "changeStateName", self.ctx.args.change_state_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", "2025-03-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _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.change_artifact = AAZObjectType( + serialized_name="changeArtifact", + flags={"required": True}, + ) + properties.change_type = AAZStrType( + serialized_name="changeType", + flags={"required": True}, + ) + properties.comments = AAZStrType() + properties.description = AAZStrType() + properties.expiration_date = AAZStrType( + serialized_name="expirationDate", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.service_catalog_reference = AAZStrType( + serialized_name="serviceCatalogReference", + ) + properties.stage_map_resource_id = AAZStrType( + serialized_name="stageMapResourceId", + flags={"required": True}, + ) + properties.stage_map_snapshot = AAZListType( + serialized_name="stageMapSnapshot", + flags={"read_only": True}, + ) + properties.stage_parameters = AAZDictType( + serialized_name="stageParameters", + flags={"required": True}, + ) + properties.state = AAZStrType( + flags={"required": True}, + ) + properties.work_item_reference = AAZStrType( + serialized_name="workItemReference", + ) + + change_artifact = cls._schema_on_200.properties.change_artifact + change_artifact.artifact_type = AAZStrType( + serialized_name="artifactType", + flags={"required": True}, + ) + change_artifact.name = AAZStrType( + flags={"required": True}, + ) + + disc_arm_operation = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation") + disc_arm_operation.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation").artifact_payload + artifact_payload.operations = AAZListType( + flags={"required": True}, + ) + + operations = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation").artifact_payload.operations + operations.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation").artifact_payload.operations.Element + _element.content = AAZObjectType() + _element.http_method = AAZStrType( + serialized_name="httpMethod", + flags={"required": True}, + ) + _element.uri = AAZStrType( + flags={"required": True}, + ) + + content = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation").artifact_payload.operations.Element.content + content.location = AAZStrType() + content.name = AAZStrType() + content.properties = AAZObjectType( + flags={"required": True}, + ) + + disc_external_arm_template = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "ExternalArmTemplate") + disc_external_arm_template.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "ExternalArmTemplate").artifact_payload + artifact_payload.external_artifact_uri = AAZStrType( + serialized_name="externalArtifactUri", + flags={"required": True}, + ) + + disc_external_bicep = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "ExternalBicep") + disc_external_bicep.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "ExternalBicep").artifact_payload + artifact_payload.external_artifact_uri = AAZStrType( + serialized_name="externalArtifactUri", + flags={"required": True}, + ) + + disc_inline_arm_template = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "InlineArmTemplate") + disc_inline_arm_template.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "InlineArmTemplate").artifact_payload + artifact_payload.inline_script = AAZStrType( + serialized_name="inlineScript", + flags={"required": True}, + ) + + disc_inline_bicep = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "InlineBicep") + disc_inline_bicep.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "InlineBicep").artifact_payload + artifact_payload.inline_script = AAZStrType( + serialized_name="inlineScript", + flags={"required": True}, + ) + + disc_template_spec = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "TemplateSpec") + disc_template_spec.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "TemplateSpec").artifact_payload + artifact_payload.artifact_resource_id = AAZStrType( + serialized_name="artifactResourceId", + flags={"required": True}, + ) + + stage_map_snapshot = cls._schema_on_200.properties.stage_map_snapshot + stage_map_snapshot.Element = AAZAnyType() + + stage_parameters = cls._schema_on_200.properties.stage_parameters + stage_parameters.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.stage_parameters.Element + _element.metadata = AAZDictType() + _element.type = AAZStrType( + flags={"required": True}, + ) + + metadata = cls._schema_on_200.properties.stage_parameters.Element.metadata + metadata.Element = AAZStrType() + + disc_number = cls._schema_on_200.properties.stage_parameters.Element.discriminate_by("type", "number") + disc_number.allowed_values = AAZListType( + serialized_name="allowedValues", + flags={"required": True}, + ) + disc_number.default_value = AAZIntType( + serialized_name="defaultValue", + ) + + allowed_values = cls._schema_on_200.properties.stage_parameters.Element.discriminate_by("type", "number").allowed_values + allowed_values.Element = AAZIntType() + + disc_string = cls._schema_on_200.properties.stage_parameters.Element.discriminate_by("type", "string") + disc_string.allowed_values = AAZListType( + serialized_name="allowedValues", + flags={"required": True}, + ) + disc_string.default_value = AAZStrType( + serialized_name="defaultValue", + ) + + allowed_values = cls._schema_on_200.properties.stage_parameters.Element.discriminate_by("type", "string").allowed_values + allowed_values.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/_update.py b/src/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/_update.py new file mode 100644 index 00000000000..bb694f49dd2 --- /dev/null +++ b/src/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/_update.py @@ -0,0 +1,582 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "change-safety change-state update", +) +class Update(AAZCommand): + """Update a ChangeState + """ + + _aaz_info = { + "version": "2025-03-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.changesafety/changestates/{}", "2025-03-01-preview"], + ] + } + + 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.change_state_name = AAZStrArg( + options=["-n", "--name", "--change-state-name"], + help="The name of the ChangeState resource.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,100}$", + max_length=100, + min_length=3, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.comments = AAZStrArg( + options=["--comments"], + arg_group="Properties", + help="Comments about the last update to the changeState resource.", + nullable=True, + fmt=AAZStrArgFormat( + max_length=2000, + ), + ) + _args_schema.description = AAZStrArg( + options=["--description"], + arg_group="Properties", + help="Brief description about the change.", + nullable=True, + fmt=AAZStrArgFormat( + max_length=2000, + ), + ) + _args_schema.service_catalog_reference = AAZStrArg( + options=["--service-catalog-reference"], + arg_group="Properties", + help="URI to the external service catalog reference.", + nullable=True, + ) + _args_schema.state = AAZStrArg( + options=["--state"], + arg_group="Properties", + help="Internal status of the changestate resource.", + enum={"Abandoned": "Abandoned", "Completed": "Completed", "Failed": "Failed", "InProgress": "InProgress", "Initialized": "Initialized", "Paused": "Paused"}, + ) + _args_schema.work_item_reference = AAZStrArg( + options=["--work-item-reference"], + arg_group="Properties", + help="URI to the work item related to this change.", + nullable=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ChangeStatesGet(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.ChangeStatesCreateOrUpdate(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 ChangeStatesGet(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.ChangeSafety/changeStates/{changeStateName}", + **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( + "changeStateName", self.ctx.args.change_state_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", "2025-03-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + _UpdateHelper._build_schema_change_state_read(cls._schema_on_200) + + return cls._schema_on_200 + + class ChangeStatesCreateOrUpdate(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.ChangeSafety/changeStates/{changeStateName}", + **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( + "changeStateName", self.ctx.args.change_state_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", "2025-03-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + value=self.ctx.vars.instance, + ) + + return self.serialize_content(_content_value) + + def on_200_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_change_state_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("comments", AAZStrType, ".comments") + properties.set_prop("description", AAZStrType, ".description") + properties.set_prop("serviceCatalogReference", AAZStrType, ".service_catalog_reference") + properties.set_prop("state", AAZStrType, ".state", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("workItemReference", AAZStrType, ".work_item_reference") + + 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_change_state_read = None + + @classmethod + def _build_schema_change_state_read(cls, _schema): + if cls._schema_change_state_read is not None: + _schema.id = cls._schema_change_state_read.id + _schema.name = cls._schema_change_state_read.name + _schema.properties = cls._schema_change_state_read.properties + _schema.system_data = cls._schema_change_state_read.system_data + _schema.type = cls._schema_change_state_read.type + return + + cls._schema_change_state_read = _schema_change_state_read = AAZObjectType() + + change_state_read = _schema_change_state_read + change_state_read.id = AAZStrType( + flags={"read_only": True}, + ) + change_state_read.name = AAZStrType( + flags={"read_only": True}, + ) + change_state_read.properties = AAZObjectType() + change_state_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + change_state_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_change_state_read.properties + properties.change_artifact = AAZObjectType( + serialized_name="changeArtifact", + flags={"required": True}, + ) + properties.change_type = AAZStrType( + serialized_name="changeType", + flags={"required": True}, + ) + properties.comments = AAZStrType() + properties.description = AAZStrType() + properties.expiration_date = AAZStrType( + serialized_name="expirationDate", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.service_catalog_reference = AAZStrType( + serialized_name="serviceCatalogReference", + ) + properties.stage_map_resource_id = AAZStrType( + serialized_name="stageMapResourceId", + flags={"required": True}, + ) + properties.stage_map_snapshot = AAZListType( + serialized_name="stageMapSnapshot", + flags={"read_only": True}, + ) + properties.stage_parameters = AAZDictType( + serialized_name="stageParameters", + flags={"required": True}, + ) + properties.state = AAZStrType( + flags={"required": True}, + ) + properties.work_item_reference = AAZStrType( + serialized_name="workItemReference", + ) + + change_artifact = _schema_change_state_read.properties.change_artifact + change_artifact.artifact_type = AAZStrType( + serialized_name="artifactType", + flags={"required": True}, + ) + change_artifact.name = AAZStrType( + flags={"required": True}, + ) + + disc_arm_operation = _schema_change_state_read.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation") + disc_arm_operation.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = _schema_change_state_read.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation").artifact_payload + artifact_payload.operations = AAZListType( + flags={"required": True}, + ) + + operations = _schema_change_state_read.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation").artifact_payload.operations + operations.Element = AAZObjectType() + + _element = _schema_change_state_read.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation").artifact_payload.operations.Element + _element.content = AAZObjectType() + _element.http_method = AAZStrType( + serialized_name="httpMethod", + flags={"required": True}, + ) + _element.uri = AAZStrType( + flags={"required": True}, + ) + + content = _schema_change_state_read.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation").artifact_payload.operations.Element.content + content.location = AAZStrType() + content.name = AAZStrType() + content.properties = AAZObjectType( + flags={"required": True}, + ) + + disc_external_arm_template = _schema_change_state_read.properties.change_artifact.discriminate_by("artifact_type", "ExternalArmTemplate") + disc_external_arm_template.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = _schema_change_state_read.properties.change_artifact.discriminate_by("artifact_type", "ExternalArmTemplate").artifact_payload + artifact_payload.external_artifact_uri = AAZStrType( + serialized_name="externalArtifactUri", + flags={"required": True}, + ) + + disc_external_bicep = _schema_change_state_read.properties.change_artifact.discriminate_by("artifact_type", "ExternalBicep") + disc_external_bicep.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = _schema_change_state_read.properties.change_artifact.discriminate_by("artifact_type", "ExternalBicep").artifact_payload + artifact_payload.external_artifact_uri = AAZStrType( + serialized_name="externalArtifactUri", + flags={"required": True}, + ) + + disc_inline_arm_template = _schema_change_state_read.properties.change_artifact.discriminate_by("artifact_type", "InlineArmTemplate") + disc_inline_arm_template.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = _schema_change_state_read.properties.change_artifact.discriminate_by("artifact_type", "InlineArmTemplate").artifact_payload + artifact_payload.inline_script = AAZStrType( + serialized_name="inlineScript", + flags={"required": True}, + ) + + disc_inline_bicep = _schema_change_state_read.properties.change_artifact.discriminate_by("artifact_type", "InlineBicep") + disc_inline_bicep.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = _schema_change_state_read.properties.change_artifact.discriminate_by("artifact_type", "InlineBicep").artifact_payload + artifact_payload.inline_script = AAZStrType( + serialized_name="inlineScript", + flags={"required": True}, + ) + + disc_template_spec = _schema_change_state_read.properties.change_artifact.discriminate_by("artifact_type", "TemplateSpec") + disc_template_spec.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = _schema_change_state_read.properties.change_artifact.discriminate_by("artifact_type", "TemplateSpec").artifact_payload + artifact_payload.artifact_resource_id = AAZStrType( + serialized_name="artifactResourceId", + flags={"required": True}, + ) + + stage_map_snapshot = _schema_change_state_read.properties.stage_map_snapshot + stage_map_snapshot.Element = AAZAnyType() + + stage_parameters = _schema_change_state_read.properties.stage_parameters + stage_parameters.Element = AAZObjectType() + + _element = _schema_change_state_read.properties.stage_parameters.Element + _element.metadata = AAZDictType() + _element.type = AAZStrType( + flags={"required": True}, + ) + + metadata = _schema_change_state_read.properties.stage_parameters.Element.metadata + metadata.Element = AAZStrType() + + disc_number = _schema_change_state_read.properties.stage_parameters.Element.discriminate_by("type", "number") + disc_number.allowed_values = AAZListType( + serialized_name="allowedValues", + flags={"required": True}, + ) + disc_number.default_value = AAZIntType( + serialized_name="defaultValue", + ) + + allowed_values = _schema_change_state_read.properties.stage_parameters.Element.discriminate_by("type", "number").allowed_values + allowed_values.Element = AAZIntType() + + disc_string = _schema_change_state_read.properties.stage_parameters.Element.discriminate_by("type", "string") + disc_string.allowed_values = AAZListType( + serialized_name="allowedValues", + flags={"required": True}, + ) + disc_string.default_value = AAZStrType( + serialized_name="defaultValue", + ) + + allowed_values = _schema_change_state_read.properties.stage_parameters.Element.discriminate_by("type", "string").allowed_values + allowed_values.Element = AAZStrType() + + system_data = _schema_change_state_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_change_state_read.id + _schema.name = cls._schema_change_state_read.name + _schema.properties = cls._schema_change_state_read.properties + _schema.system_data = cls._schema_change_state_read.system_data + _schema.type = cls._schema_change_state_read.type + + +__all__ = ["Update"] diff --git a/src/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/_wait.py b/src/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/_wait.py new file mode 100644 index 00000000000..2d56b2b5d16 --- /dev/null +++ b/src/change-safety/azext_change_safety/aaz/latest/change_safety/change_state/_wait.py @@ -0,0 +1,379 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "change-safety change-state wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.changesafety/changestates/{}", "2025-03-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.change_state_name = AAZStrArg( + options=["-n", "--name", "--change-state-name"], + help="The name of the ChangeState resource.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9-]{3,100}$", + max_length=100, + min_length=3, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ChangeStatesGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class ChangeStatesGet(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.ChangeSafety/changeStates/{changeStateName}", + **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( + "changeStateName", self.ctx.args.change_state_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", "2025-03-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _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.change_artifact = AAZObjectType( + serialized_name="changeArtifact", + flags={"required": True}, + ) + properties.change_type = AAZStrType( + serialized_name="changeType", + flags={"required": True}, + ) + properties.comments = AAZStrType() + properties.description = AAZStrType() + properties.expiration_date = AAZStrType( + serialized_name="expirationDate", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.service_catalog_reference = AAZStrType( + serialized_name="serviceCatalogReference", + ) + properties.stage_map_resource_id = AAZStrType( + serialized_name="stageMapResourceId", + flags={"required": True}, + ) + properties.stage_map_snapshot = AAZListType( + serialized_name="stageMapSnapshot", + flags={"read_only": True}, + ) + properties.stage_parameters = AAZDictType( + serialized_name="stageParameters", + flags={"required": True}, + ) + properties.state = AAZStrType( + flags={"required": True}, + ) + properties.work_item_reference = AAZStrType( + serialized_name="workItemReference", + ) + + change_artifact = cls._schema_on_200.properties.change_artifact + change_artifact.artifact_type = AAZStrType( + serialized_name="artifactType", + flags={"required": True}, + ) + change_artifact.name = AAZStrType( + flags={"required": True}, + ) + + disc_arm_operation = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation") + disc_arm_operation.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation").artifact_payload + artifact_payload.operations = AAZListType( + flags={"required": True}, + ) + + operations = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation").artifact_payload.operations + operations.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation").artifact_payload.operations.Element + _element.content = AAZObjectType() + _element.http_method = AAZStrType( + serialized_name="httpMethod", + flags={"required": True}, + ) + _element.uri = AAZStrType( + flags={"required": True}, + ) + + content = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "ArmOperation").artifact_payload.operations.Element.content + content.location = AAZStrType() + content.name = AAZStrType() + content.properties = AAZObjectType( + flags={"required": True}, + ) + + disc_external_arm_template = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "ExternalArmTemplate") + disc_external_arm_template.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "ExternalArmTemplate").artifact_payload + artifact_payload.external_artifact_uri = AAZStrType( + serialized_name="externalArtifactUri", + flags={"required": True}, + ) + + disc_external_bicep = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "ExternalBicep") + disc_external_bicep.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "ExternalBicep").artifact_payload + artifact_payload.external_artifact_uri = AAZStrType( + serialized_name="externalArtifactUri", + flags={"required": True}, + ) + + disc_inline_arm_template = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "InlineArmTemplate") + disc_inline_arm_template.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "InlineArmTemplate").artifact_payload + artifact_payload.inline_script = AAZStrType( + serialized_name="inlineScript", + flags={"required": True}, + ) + + disc_inline_bicep = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "InlineBicep") + disc_inline_bicep.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "InlineBicep").artifact_payload + artifact_payload.inline_script = AAZStrType( + serialized_name="inlineScript", + flags={"required": True}, + ) + + disc_template_spec = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "TemplateSpec") + disc_template_spec.artifact_payload = AAZObjectType( + serialized_name="artifactPayload", + flags={"required": True}, + ) + + artifact_payload = cls._schema_on_200.properties.change_artifact.discriminate_by("artifact_type", "TemplateSpec").artifact_payload + artifact_payload.artifact_resource_id = AAZStrType( + serialized_name="artifactResourceId", + flags={"required": True}, + ) + + stage_map_snapshot = cls._schema_on_200.properties.stage_map_snapshot + stage_map_snapshot.Element = AAZAnyType() + + stage_parameters = cls._schema_on_200.properties.stage_parameters + stage_parameters.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.stage_parameters.Element + _element.metadata = AAZDictType() + _element.type = AAZStrType( + flags={"required": True}, + ) + + metadata = cls._schema_on_200.properties.stage_parameters.Element.metadata + metadata.Element = AAZStrType() + + disc_number = cls._schema_on_200.properties.stage_parameters.Element.discriminate_by("type", "number") + disc_number.allowed_values = AAZListType( + serialized_name="allowedValues", + flags={"required": True}, + ) + disc_number.default_value = AAZIntType( + serialized_name="defaultValue", + ) + + allowed_values = cls._schema_on_200.properties.stage_parameters.Element.discriminate_by("type", "number").allowed_values + allowed_values.Element = AAZIntType() + + disc_string = cls._schema_on_200.properties.stage_parameters.Element.discriminate_by("type", "string") + disc_string.allowed_values = AAZListType( + serialized_name="allowedValues", + flags={"required": True}, + ) + disc_string.default_value = AAZStrType( + serialized_name="defaultValue", + ) + + allowed_values = cls._schema_on_200.properties.stage_parameters.Element.discriminate_by("type", "string").allowed_values + allowed_values.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/change-safety/azext_change_safety/azext_metadata.json b/src/change-safety/azext_change_safety/azext_metadata.json new file mode 100644 index 00000000000..e506328978c --- /dev/null +++ b/src/change-safety/azext_change_safety/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isPreview": true, + "azext.minCliCoreVersion": "2.70.0" +} \ No newline at end of file diff --git a/src/change-safety/azext_change_safety/commands.py b/src/change-safety/azext_change_safety/commands.py new file mode 100644 index 00000000000..b0d842e4993 --- /dev/null +++ b/src/change-safety/azext_change_safety/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/change-safety/azext_change_safety/custom.py b/src/change-safety/azext_change_safety/custom.py new file mode 100644 index 00000000000..86df1e48ef5 --- /dev/null +++ b/src/change-safety/azext_change_safety/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/change-safety/azext_change_safety/tests/__init__.py b/src/change-safety/azext_change_safety/tests/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/change-safety/azext_change_safety/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/change-safety/azext_change_safety/tests/latest/__init__.py b/src/change-safety/azext_change_safety/tests/latest/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/change-safety/azext_change_safety/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/change-safety/azext_change_safety/tests/latest/test_change_safety.py b/src/change-safety/azext_change_safety/tests/latest/test_change_safety.py new file mode 100644 index 00000000000..a38df64a28c --- /dev/null +++ b/src/change-safety/azext_change_safety/tests/latest/test_change_safety.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 +# -------------------------------------------------------------------------------------------- + +from azure.cli.testsdk import * + + +class ChangeSafetyScenario(ScenarioTest): + # TODO: add tests here + pass diff --git a/src/change-safety/setup.cfg b/src/change-safety/setup.cfg new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/change-safety/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/change-safety/setup.py b/src/change-safety/setup.py new file mode 100644 index 00000000000..a10c153c7ab --- /dev/null +++ b/src/change-safety/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 = '1.0.0b1' + +# 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='change-safety', + version=VERSION, + description='Microsoft Azure Command-Line Tools ChangeSafety 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/change-safety', + classifiers=CLASSIFIERS, + packages=find_packages(exclude=["tests"]), + package_data={'azext_change_safety': ['azext_metadata.json']}, + install_requires=DEPENDENCIES +)