From d190373d5d1602cc4848f808ee881a83f26b0ec6 Mon Sep 17 00:00:00 2001 From: Chaoyi Yuan Date: Mon, 18 Mar 2024 15:04:32 +0800 Subject: [PATCH] feat: remove portal commands from apic-extension (#7365) * feat: remove portal commands from apic-extension --- src/apic-extension/HISTORY.rst | 4 + .../aaz/latest/__init__.py | 4 + .../latest/apic/service/portal/__cmd_group.py | 23 - .../latest/apic/service/portal/__init__.py | 11 - .../service/portal/default/__cmd_group.py | 23 - .../apic/service/portal/default/__init__.py | 15 - .../apic/service/portal/default/_create.py | 329 ------------- .../apic/service/portal/default/_delete.py | 143 ------ .../apic/service/portal/default/_show.py | 239 --------- .../apic/service/portal/default/_update.py | 465 ------------------ 10 files changed, 8 insertions(+), 1248 deletions(-) delete mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/__cmd_group.py delete mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/__init__.py delete mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/__cmd_group.py delete mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/__init__.py delete mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/_create.py delete mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/_delete.py delete mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/_show.py delete mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/_update.py diff --git a/src/apic-extension/HISTORY.rst b/src/apic-extension/HISTORY.rst index b363372830d..f66b3701476 100644 --- a/src/apic-extension/HISTORY.rst +++ b/src/apic-extension/HISTORY.rst @@ -3,6 +3,10 @@ Release History =============== +1.0.0b5 ++++++ +* Remove: All portal commands as it should not be exposed to customers. + 1.0.0b4 +++++ * Add: Support for Default Portal configuration and default hostname provisoning deprovisioning commands diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/__init__.py b/src/apic-extension/azext_apic_extension/aaz/latest/__init__.py index 5757aea3175..f6acc11aa4e 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/__init__.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/__init__.py @@ -4,3 +4,7 @@ # # Code generated by aaz-dev-tools # -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/__cmd_group.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/__cmd_group.py deleted file mode 100644 index aefec36e9a6..00000000000 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "apic service portal", -) -class __CMDGroup(AAZCommandGroup): - """Commands to manage API Center Service Portal Configuration in API Center - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/__init__.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/__init__.py deleted file mode 100644 index 5a9d61963d6..00000000000 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/__cmd_group.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/__cmd_group.py deleted file mode 100644 index 418e5b36703..00000000000 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "apic service portal default", -) -class __CMDGroup(AAZCommandGroup): - """Default API Center Portal - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/__init__.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/__init__.py deleted file mode 100644 index a3db3e36481..00000000000 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -# Code generated by aaz-dev-tools -# -------------------------------------------------------------------------------------------- - -# pylint: skip-file -# flake8: noqa - -from .__cmd_group import * -from ._create import * -from ._delete import * -from ._show import * -from ._update import * diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/_create.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/_create.py deleted file mode 100644 index 3d63c618207..00000000000 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/_create.py +++ /dev/null @@ -1,329 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "apic service portal default create", -) -class Create(AAZCommand): - """Create new or updates existing portal configuration. - - :example: Create Default Portal Configuration - az apic service portal default create -g contoso-resources --service-name contoso --title "Contoso" --enabled false --authentication'{"clientId":"00000000-0000-0000-0000-000000000000","tenantId":"00000000-0000-0000-0000-000000000000"}' - """ - - _aaz_info = { - "version": "2024-03-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/portals/default", "2024-03-01"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return self._output() - - _args_schema = None - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - if cls._args_schema is not None: - return cls._args_schema - cls._args_schema = super()._build_arguments_schema(*args, **kwargs) - - # define Arg Group "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.service_name = AAZStrArg( - options=["-s", "--service", "--service-name"], - help="The name of Azure API Center service.", - required=True, - fmt=AAZStrArgFormat( - max_length=90, - min_length=1, - ), - ) - - # define Arg Group "Payload" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="Payload", - help="The geo-location where the resource lives", - required=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Payload", - help="Resource tags.", - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.authentication = AAZObjectArg( - options=["--authentication"], - arg_group="Properties", - help="Authentication configuration.", - ) - _args_schema.enabled = AAZBoolArg( - options=["--enabled"], - arg_group="Properties", - help="Flag indicating whether or not portal is enabled.", - ) - _args_schema.title = AAZStrArg( - options=["--title"], - arg_group="Properties", - help="Portal configuration Title.", - fmt=AAZStrArgFormat( - max_length=50, - ), - ) - - authentication = cls._args_schema.authentication - authentication.client_id = AAZStrArg( - options=["client-id"], - help="The Azure Active Directory application client id.", - required=True, - fmt=AAZStrArgFormat( - max_length=50, - min_length=1, - ), - ) - authentication.tenant_id = AAZStrArg( - options=["tenant-id"], - help="The Azure Active Directory application Tenant id.", - fmt=AAZStrArgFormat( - max_length=50, - ), - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.PortalConfigurationCreateOrUpdate(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 PortalConfigurationCreateOrUpdate(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.ApiCenter/services/{serviceName}/portals/default", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "serviceName", self.ctx.args.service_name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2024-03-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Content-Type", "application/json", - ), - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - @property - def content(self): - _content_value, _builder = self.new_content_builder( - self.ctx.args, - typ=AAZObjectType, - typ_kwargs={"flags": {"required": True, "client_flatten": True}} - ) - _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("authentication", AAZObjectType, ".authentication", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("enabled", AAZBoolType, ".enabled") - properties.set_prop("title", AAZStrType, ".title", typ_kwargs={"flags": {"required": True}}) - - authentication = _builder.get(".properties.authentication") - if authentication is not None: - authentication.set_prop("clientId", AAZStrType, ".client_id", typ_kwargs={"flags": {"required": True}}) - authentication.set_prop("tenantId", AAZStrType, ".tenant_id") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200 - ) - - _schema_on_200 = None - - @classmethod - def _build_schema_on_200(cls): - if cls._schema_on_200 is not None: - return cls._schema_on_200 - - cls._schema_on_200 = AAZObjectType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.system_data = AAZObjectType( - serialized_name="systemData", - flags={"read_only": True}, - ) - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.authentication = AAZObjectType() - properties.created = AAZStrType() - properties.created_by = AAZStrType( - serialized_name="createdBy", - ) - properties.data_api_host_name = AAZStrType( - serialized_name="dataApiHostName", - ) - properties.enabled = AAZBoolType() - properties.portal_default_host_name = AAZStrType( - serialized_name="portalDefaultHostName", - ) - properties.title = AAZStrType() - properties.updated = AAZStrType() - properties.updated_by = AAZStrType( - serialized_name="updatedBy", - ) - - authentication = cls._schema_on_200.properties.authentication - authentication.azure_ad_instance = AAZStrType( - serialized_name="azureAdInstance", - flags={"read_only": True}, - ) - authentication.client_id = AAZStrType( - serialized_name="clientId", - flags={"required": True}, - ) - authentication.scopes = AAZStrType( - flags={"read_only": True}, - ) - authentication.tenant_id = AAZStrType( - serialized_name="tenantId", - ) - - 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 _CreateHelper: - """Helper class for Create""" - - -__all__ = ["Create"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/_delete.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/_delete.py deleted file mode 100644 index f3283064a35..00000000000 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/_delete.py +++ /dev/null @@ -1,143 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "apic service portal default delete", - confirmation="Are you sure you want to perform this operation?", -) -class Delete(AAZCommand): - """Delete specified PortalConfiguration. - - :example: Delete Default Portal Configuration - az apic service portal default delete -g contoso-resources --service-name contoso - """ - - _aaz_info = { - "version": "2024-03-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/portals/default", "2024-03-01"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return None - - _args_schema = None - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - if cls._args_schema is not None: - return cls._args_schema - cls._args_schema = super()._build_arguments_schema(*args, **kwargs) - - # define Arg Group "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.service_name = AAZStrArg( - options=["-s", "--service", "--service-name"], - help="The name of Azure API Center service.", - required=True, - id_part="name", - fmt=AAZStrArgFormat( - max_length=90, - min_length=1, - ), - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.PortalConfigurationDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class PortalConfigurationDelete(AAZHttpOperation): - CLIENT_TYPE = "MgmtClient" - - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [200]: - return self.on_200(session) - if session.http_response.status_code in [204]: - return self.on_204(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/portals/default", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "serviceName", self.ctx.args.service_name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2024-03-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/_show.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/_show.py deleted file mode 100644 index 8db86cbee9e..00000000000 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/_show.py +++ /dev/null @@ -1,239 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "apic service portal default show", -) -class Show(AAZCommand): - """Get portal configuration. - - :example: Show APIC Default Portal Configuration - az apic service portal default show -g contoso-resources --service-name contoso - """ - - _aaz_info = { - "version": "2024-03-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/portals/default", "2024-03-01"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return self._output() - - _args_schema = None - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - if cls._args_schema is not None: - return cls._args_schema - cls._args_schema = super()._build_arguments_schema(*args, **kwargs) - - # define Arg Group "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.service_name = AAZStrArg( - options=["-s", "--service", "--service-name"], - help="The name of Azure API Center service.", - required=True, - id_part="name", - fmt=AAZStrArgFormat( - max_length=90, - min_length=1, - ), - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.PortalConfigurationGet(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 PortalConfigurationGet(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.ApiCenter/services/{serviceName}/portals/default", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "serviceName", self.ctx.args.service_name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2024-03-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - def on_200(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200 - ) - - _schema_on_200 = None - - @classmethod - def _build_schema_on_200(cls): - if cls._schema_on_200 is not None: - return cls._schema_on_200 - - cls._schema_on_200 = AAZObjectType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.system_data = AAZObjectType( - serialized_name="systemData", - flags={"read_only": True}, - ) - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.authentication = AAZObjectType() - properties.created = AAZStrType() - properties.created_by = AAZStrType( - serialized_name="createdBy", - ) - properties.data_api_host_name = AAZStrType( - serialized_name="dataApiHostName", - ) - properties.enabled = AAZBoolType() - properties.portal_default_host_name = AAZStrType( - serialized_name="portalDefaultHostName", - ) - properties.title = AAZStrType() - properties.updated = AAZStrType() - properties.updated_by = AAZStrType( - serialized_name="updatedBy", - ) - - authentication = cls._schema_on_200.properties.authentication - authentication.azure_ad_instance = AAZStrType( - serialized_name="azureAdInstance", - flags={"read_only": True}, - ) - authentication.client_id = AAZStrType( - serialized_name="clientId", - flags={"required": True}, - ) - authentication.scopes = AAZStrType( - flags={"read_only": True}, - ) - authentication.tenant_id = AAZStrType( - serialized_name="tenantId", - ) - - 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/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/_update.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/_update.py deleted file mode 100644 index 90bedf84fb2..00000000000 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/portal/default/_update.py +++ /dev/null @@ -1,465 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "apic service portal default update", -) -class Update(AAZCommand): - """Update new or updates existing portal configuration. - - :example: Update Default Portal Configuration - az apic service portal default update -g contoso-resources --service-name contoso --title "Contoso" --enabled false --authentication'{"clientId":"00000000-0000-0000-0000-000000000000","tenantId":"00000000-0000-0000-0000-000000000000"}' - """ - - _aaz_info = { - "version": "2024-03-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/portals/default", "2024-03-01"], - ] - } - - AZ_SUPPORT_GENERIC_UPDATE = True - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return self._output() - - _args_schema = None - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - if cls._args_schema is not None: - return cls._args_schema - cls._args_schema = super()._build_arguments_schema(*args, **kwargs) - - # define Arg Group "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.service_name = AAZStrArg( - options=["-s", "--service", "--service-name"], - help="The name of Azure API Center service.", - required=True, - id_part="name", - fmt=AAZStrArgFormat( - max_length=90, - min_length=1, - ), - ) - - # define Arg Group "Payload" - - _args_schema = cls._args_schema - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Payload", - help="Resource tags.", - nullable=True, - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.authentication = AAZObjectArg( - options=["--authentication"], - arg_group="Properties", - help="Authentication configuration.", - ) - _args_schema.enabled = AAZBoolArg( - options=["--enabled"], - arg_group="Properties", - help="Flag indicating whether or not portal is enabled.", - nullable=True, - ) - _args_schema.title = AAZStrArg( - options=["--title"], - arg_group="Properties", - help="Portal configuration Title.", - fmt=AAZStrArgFormat( - max_length=50, - ), - ) - - authentication = cls._args_schema.authentication - authentication.client_id = AAZStrArg( - options=["client-id"], - help="The Azure Active Directory application client id.", - fmt=AAZStrArgFormat( - max_length=50, - min_length=1, - ), - ) - authentication.tenant_id = AAZStrArg( - options=["tenant-id"], - help="The Azure Active Directory application Tenant id.", - nullable=True, - fmt=AAZStrArgFormat( - max_length=50, - ), - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.PortalConfigurationGet(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.PortalConfigurationCreateOrUpdate(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 PortalConfigurationGet(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.ApiCenter/services/{serviceName}/portals/default", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "serviceName", self.ctx.args.service_name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2024-03-01", - 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_portal_configuration_response_read(cls._schema_on_200) - - return cls._schema_on_200 - - class PortalConfigurationCreateOrUpdate(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.ApiCenter/services/{serviceName}/portals/default", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "serviceName", self.ctx.args.service_name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2024-03-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Content-Type", "application/json", - ), - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - @property - def content(self): - _content_value, _builder = self.new_content_builder( - self.ctx.args, - value=self.ctx.vars.instance, - ) - - return self.serialize_content(_content_value) - - def on_200(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200 - ) - - _schema_on_200 = None - - @classmethod - def _build_schema_on_200(cls): - if cls._schema_on_200 is not None: - return cls._schema_on_200 - - cls._schema_on_200 = AAZObjectType() - _UpdateHelper._build_schema_portal_configuration_response_read(cls._schema_on_200) - - return cls._schema_on_200 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("authentication", AAZObjectType, ".authentication", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("enabled", AAZBoolType, ".enabled") - properties.set_prop("title", AAZStrType, ".title", typ_kwargs={"flags": {"required": True}}) - - authentication = _builder.get(".properties.authentication") - if authentication is not None: - authentication.set_prop("clientId", AAZStrType, ".client_id", typ_kwargs={"flags": {"required": True}}) - authentication.set_prop("tenantId", AAZStrType, ".tenant_id") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - _schema_portal_configuration_response_read = None - - @classmethod - def _build_schema_portal_configuration_response_read(cls, _schema): - if cls._schema_portal_configuration_response_read is not None: - _schema.id = cls._schema_portal_configuration_response_read.id - _schema.name = cls._schema_portal_configuration_response_read.name - _schema.properties = cls._schema_portal_configuration_response_read.properties - _schema.system_data = cls._schema_portal_configuration_response_read.system_data - _schema.type = cls._schema_portal_configuration_response_read.type - return - - cls._schema_portal_configuration_response_read = _schema_portal_configuration_response_read = AAZObjectType() - - portal_configuration_response_read = _schema_portal_configuration_response_read - portal_configuration_response_read.id = AAZStrType( - flags={"read_only": True}, - ) - portal_configuration_response_read.name = AAZStrType( - flags={"read_only": True}, - ) - portal_configuration_response_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - portal_configuration_response_read.system_data = AAZObjectType( - serialized_name="systemData", - flags={"read_only": True}, - ) - portal_configuration_response_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_portal_configuration_response_read.properties - properties.authentication = AAZObjectType() - properties.created = AAZStrType() - properties.created_by = AAZStrType( - serialized_name="createdBy", - ) - properties.data_api_host_name = AAZStrType( - serialized_name="dataApiHostName", - ) - properties.enabled = AAZBoolType() - properties.portal_default_host_name = AAZStrType( - serialized_name="portalDefaultHostName", - ) - properties.title = AAZStrType() - properties.updated = AAZStrType() - properties.updated_by = AAZStrType( - serialized_name="updatedBy", - ) - - authentication = _schema_portal_configuration_response_read.properties.authentication - authentication.azure_ad_instance = AAZStrType( - serialized_name="azureAdInstance", - flags={"read_only": True}, - ) - authentication.client_id = AAZStrType( - serialized_name="clientId", - flags={"required": True}, - ) - authentication.scopes = AAZStrType( - flags={"read_only": True}, - ) - authentication.tenant_id = AAZStrType( - serialized_name="tenantId", - ) - - system_data = _schema_portal_configuration_response_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_portal_configuration_response_read.id - _schema.name = cls._schema_portal_configuration_response_read.name - _schema.properties = cls._schema_portal_configuration_response_read.properties - _schema.system_data = cls._schema_portal_configuration_response_read.system_data - _schema.type = cls._schema_portal_configuration_response_read.type - - -__all__ = ["Update"]