diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/__init__.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/__init__.py new file mode 100644 index 00000000000..6a5f26b81d7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/__init__.py @@ -0,0 +1,44 @@ +# -------------------------------------------------------------------------------------------- +# 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 azure.cli.command_modules.cli_new_extension._help import helps # pylint: disable=unused-import +# from azure.cli.core.profiles import ResourceType # required when using python sdk + + +class CliNewExtensionCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + custom_command_type = CliCommandType( + operations_tmpl='azure.cli.command_modules.cli_new_extension.custom#{}') + super().__init__(cli_ctx=cli_ctx, + # resource_type=ResourceType.XXX # required when using python sdk + custom_command_type=custom_command_type) + + def load_command_table(self, args): + from azure.cli.command_modules.cli_new_extension.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 azure.cli.command_modules.cli_new_extension._params import load_arguments + load_arguments(self, command) + + +COMMAND_LOADER_CLS = CliNewExtensionCommandsLoader diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/_help.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/_help.py new file mode 100644 index 00000000000..126d5d00714 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/_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/azure-cli/azure/cli/command_modules/cli_new_extension/_params.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/_params.py new file mode 100644 index 00000000000..cfcec717c9c --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/_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/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/__init__.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/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/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/__init__.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/__init__.py new file mode 100644 index 00000000000..f6acc11aa4e --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/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/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/__cmd_group.py new file mode 100644 index 00000000000..2569335f970 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/__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( + "confluent", +) +class __CMDGroup(AAZCommandGroup): + """Manage confluent organization + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/__init__.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/__init__.py new file mode 100644 index 00000000000..5a9d61963d6 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/__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/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/agreement/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/agreement/__cmd_group.py new file mode 100644 index 00000000000..c66527096c8 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/agreement/__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( + "confluent agreement", +) +class __CMDGroup(AAZCommandGroup): + """Manage Agreement + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/agreement/__init__.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/agreement/__init__.py new file mode 100644 index 00000000000..d63ae5a6fc9 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/agreement/__init__.py @@ -0,0 +1,12 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._list import * diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/agreement/_list.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/agreement/_list.py new file mode 100644 index 00000000000..8536c5c4504 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/agreement/_list.py @@ -0,0 +1,205 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent agreement list", +) +class List(AAZCommand): + """List Confluent marketplace agreements in the subscription. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.confluent/agreements", "2024-02-13"], + ] + } + + 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 "" + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MarketplaceAgreementsList(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 MarketplaceAgreementsList(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-02-13", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.accepted = AAZBoolType() + properties.license_text_link = AAZStrType( + serialized_name="licenseTextLink", + ) + properties.plan = AAZStrType() + properties.privacy_policy_link = AAZStrType( + serialized_name="privacyPolicyLink", + ) + properties.product = AAZStrType() + properties.publisher = AAZStrType() + properties.retrieve_datetime = AAZStrType( + serialized_name="retrieveDatetime", + ) + properties.signature = 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/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/agreement/default/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/agreement/default/__cmd_group.py new file mode 100644 index 00000000000..a2bb8e6ad78 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/agreement/default/__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( + "confluent agreement default", +) +class __CMDGroup(AAZCommandGroup): + """Manage Default + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/agreement/default/__init__.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/agreement/default/__init__.py new file mode 100644 index 00000000000..a6df9f5a835 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/agreement/default/__init__.py @@ -0,0 +1,12 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/agreement/default/_create.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/agreement/default/_create.py new file mode 100644 index 00000000000..06446f58bbc --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/agreement/default/_create.py @@ -0,0 +1,263 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent agreement default create", +) +class Create(AAZCommand): + """Create Confluent Marketplace agreement in the subscription. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.confluent/agreements/default", "2024-02-13"], + ] + } + + 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 "" + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.accepted = AAZBoolArg( + options=["--accepted"], + arg_group="Properties", + help="If any version of the terms have been accepted, otherwise false.", + ) + _args_schema.license_text_link = AAZStrArg( + options=["--license-text-link"], + arg_group="Properties", + help="Link to HTML with Microsoft and Publisher terms.", + ) + _args_schema.plan = AAZStrArg( + options=["--plan"], + arg_group="Properties", + help="Plan identifier string.", + ) + _args_schema.privacy_policy_link = AAZStrArg( + options=["--privacy-policy-link"], + arg_group="Properties", + help="Link to the privacy policy of the publisher.", + ) + _args_schema.product = AAZStrArg( + options=["--product"], + arg_group="Properties", + help="Product identifier string.", + ) + _args_schema.publisher = AAZStrArg( + options=["--publisher"], + arg_group="Properties", + help="Publisher identifier string.", + ) + _args_schema.retrieve_datetime = AAZDateTimeArg( + options=["--retrieve-datetime"], + arg_group="Properties", + help="Date and time in UTC of when the terms were accepted. This is empty if Accepted is false.", + ) + _args_schema.signature = AAZStrArg( + options=["--signature"], + arg_group="Properties", + help="Terms signature.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MarketplaceAgreementsCreate(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 MarketplaceAgreementsCreate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements/default", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-02-13", + 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": {"client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("accepted", AAZBoolType, ".accepted") + properties.set_prop("licenseTextLink", AAZStrType, ".license_text_link") + properties.set_prop("plan", AAZStrType, ".plan") + properties.set_prop("privacyPolicyLink", AAZStrType, ".privacy_policy_link") + properties.set_prop("product", AAZStrType, ".product") + properties.set_prop("publisher", AAZStrType, ".publisher") + properties.set_prop("retrieveDatetime", AAZStrType, ".retrieve_datetime") + properties.set_prop("signature", AAZStrType, ".signature") + + 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.accepted = AAZBoolType() + properties.license_text_link = AAZStrType( + serialized_name="licenseTextLink", + ) + properties.plan = AAZStrType() + properties.privacy_policy_link = AAZStrType( + serialized_name="privacyPolicyLink", + ) + properties.product = AAZStrType() + properties.publisher = AAZStrType() + properties.retrieve_datetime = AAZStrType( + serialized_name="retrieveDatetime", + ) + properties.signature = 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 _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/__cmd_group.py new file mode 100644 index 00000000000..25f422eb0f8 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/__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( + "confluent organization", +) +class __CMDGroup(AAZCommandGroup): + """Perform administrative operations on Confluent organization entities via Azure. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/__init__.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/__init__.py new file mode 100644 index 00000000000..814a032383d --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/__init__.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 .__cmd_group import * +from ._create import * +from ._create_role_binding import * +from ._create_user import * +from ._delete import * +from ._list import * +from ._list_region import * +from ._list_role_binding import * +from ._list_service_accounts import * +from ._list_users import * +from ._show import * +from ._update import * +from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_create.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_create.py new file mode 100644 index 00000000000..95598c43f50 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_create.py @@ -0,0 +1,495 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization create", +) +class Create(AAZCommand): + """Create a new Confluent organization entity through Azure integration. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}", "2024-02-13"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.organization_name = AAZStrArg( + options=["-n", "--name", "--organization-name"], + help="Organization resource name", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Body" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Body", + help="Location of Organization resource", + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Body", + help="Organization resource tags", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.link_organization = AAZObjectArg( + options=["--link-organization"], + arg_group="Properties", + help="Link an existing Confluent organization", + ) + _args_schema.offer_detail = AAZObjectArg( + options=["--offer-detail"], + arg_group="Properties", + help="Confluent offer detail", + ) + _args_schema.user_detail = AAZObjectArg( + options=["--user-detail"], + arg_group="Properties", + help="Subscriber detail", + ) + + link_organization = cls._args_schema.link_organization + link_organization.token = AAZStrArg( + options=["token"], + help="User auth token", + required=True, + ) + + offer_detail = cls._args_schema.offer_detail + offer_detail.id = AAZStrArg( + options=["id"], + help="Offer Id", + required=True, + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + offer_detail.plan_id = AAZStrArg( + options=["plan-id"], + help="Offer Plan Id", + required=True, + fmt=AAZStrArgFormat( + max_length=200, + ), + ) + offer_detail.plan_name = AAZStrArg( + options=["plan-name"], + help="Offer Plan Name", + required=True, + fmt=AAZStrArgFormat( + max_length=200, + ), + ) + offer_detail.private_offer_id = AAZStrArg( + options=["private-offer-id"], + help="Private Offer Id", + fmt=AAZStrArgFormat( + max_length=255, + ), + ) + offer_detail.private_offer_ids = AAZListArg( + options=["private-offer-ids"], + help="Array of Private Offer Ids", + ) + offer_detail.publisher_id = AAZStrArg( + options=["publisher-id"], + help="Publisher Id", + required=True, + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + offer_detail.status = AAZStrArg( + options=["status"], + help="SaaS Offer Status", + enum={"Failed": "Failed", "InProgress": "InProgress", "PendingFulfillmentStart": "PendingFulfillmentStart", "Reinstated": "Reinstated", "Started": "Started", "Subscribed": "Subscribed", "Succeeded": "Succeeded", "Suspended": "Suspended", "Unsubscribed": "Unsubscribed", "Updating": "Updating"}, + ) + offer_detail.term_id = AAZStrArg( + options=["term-id"], + help="Offer Plan Term Id", + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + offer_detail.term_unit = AAZStrArg( + options=["term-unit"], + help="Offer Plan Term unit", + required=True, + fmt=AAZStrArgFormat( + max_length=25, + ), + ) + + private_offer_ids = cls._args_schema.offer_detail.private_offer_ids + private_offer_ids.Element = AAZStrArg() + + user_detail = cls._args_schema.user_detail + user_detail.aad_email = AAZStrArg( + options=["aad-email"], + help="AAD email address", + ) + user_detail.email_address = AAZStrArg( + options=["email-address"], + help="Email address", + required=True, + fmt=AAZStrArgFormat( + pattern="^\\S+@\\S+\\.\\S+$", + ), + ) + user_detail.first_name = AAZStrArg( + options=["first-name"], + help="First name", + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + user_detail.last_name = AAZStrArg( + options=["last-name"], + help="Last name", + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + user_detail.user_principal_name = AAZStrArg( + options=["user-principal-name"], + help="User principal name", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.OrganizationCreate(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 OrganizationCreate(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": "azure-async-operation"}, + 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": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + 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": {"client_flatten": True}} + ) + _builder.set_prop("location", AAZStrType, ".location") + _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("linkOrganization", AAZObjectType, ".link_organization") + properties.set_prop("offerDetail", AAZObjectType, ".offer_detail", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("userDetail", AAZObjectType, ".user_detail", typ_kwargs={"flags": {"required": True}}) + + link_organization = _builder.get(".properties.linkOrganization") + if link_organization is not None: + link_organization.set_prop("token", AAZStrType, ".token", typ_kwargs={"flags": {"secret": True}}) + + offer_detail = _builder.get(".properties.offerDetail") + if offer_detail is not None: + offer_detail.set_prop("id", AAZStrType, ".id", typ_kwargs={"flags": {"required": True}}) + offer_detail.set_prop("planId", AAZStrType, ".plan_id", typ_kwargs={"flags": {"required": True}}) + offer_detail.set_prop("planName", AAZStrType, ".plan_name", typ_kwargs={"flags": {"required": True}}) + offer_detail.set_prop("privateOfferId", AAZStrType, ".private_offer_id") + offer_detail.set_prop("privateOfferIds", AAZListType, ".private_offer_ids") + offer_detail.set_prop("publisherId", AAZStrType, ".publisher_id", typ_kwargs={"flags": {"required": True}}) + offer_detail.set_prop("status", AAZStrType, ".status") + offer_detail.set_prop("termId", AAZStrType, ".term_id") + offer_detail.set_prop("termUnit", AAZStrType, ".term_unit", typ_kwargs={"flags": {"required": True}}) + + private_offer_ids = _builder.get(".properties.offerDetail.privateOfferIds") + if private_offer_ids is not None: + private_offer_ids.set_elements(AAZStrType, ".") + + user_detail = _builder.get(".properties.userDetail") + if user_detail is not None: + user_detail.set_prop("aadEmail", AAZStrType, ".aad_email") + user_detail.set_prop("emailAddress", AAZStrType, ".email_address", typ_kwargs={"flags": {"required": True}}) + user_detail.set_prop("firstName", AAZStrType, ".first_name") + user_detail.set_prop("lastName", AAZStrType, ".last_name") + user_detail.set_prop("userPrincipalName", AAZStrType, ".user_principal_name") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType() + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.created_time = AAZStrType( + serialized_name="createdTime", + flags={"read_only": True}, + ) + properties.offer_detail = AAZObjectType( + serialized_name="offerDetail", + flags={"required": True}, + ) + properties.organization_id = AAZStrType( + serialized_name="organizationId", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.sso_url = AAZStrType( + serialized_name="ssoUrl", + flags={"read_only": True}, + ) + properties.user_detail = AAZObjectType( + serialized_name="userDetail", + flags={"required": True}, + ) + + offer_detail = cls._schema_on_200_201.properties.offer_detail + offer_detail.id = AAZStrType( + flags={"required": True}, + ) + offer_detail.plan_id = AAZStrType( + serialized_name="planId", + flags={"required": True}, + ) + offer_detail.plan_name = AAZStrType( + serialized_name="planName", + flags={"required": True}, + ) + offer_detail.private_offer_id = AAZStrType( + serialized_name="privateOfferId", + ) + offer_detail.private_offer_ids = AAZListType( + serialized_name="privateOfferIds", + ) + offer_detail.publisher_id = AAZStrType( + serialized_name="publisherId", + flags={"required": True}, + ) + offer_detail.status = AAZStrType() + offer_detail.term_id = AAZStrType( + serialized_name="termId", + ) + offer_detail.term_unit = AAZStrType( + serialized_name="termUnit", + flags={"required": True}, + ) + + private_offer_ids = cls._schema_on_200_201.properties.offer_detail.private_offer_ids + private_offer_ids.Element = AAZStrType() + + user_detail = cls._schema_on_200_201.properties.user_detail + user_detail.aad_email = AAZStrType( + serialized_name="aadEmail", + ) + user_detail.email_address = AAZStrType( + serialized_name="emailAddress", + flags={"required": True}, + ) + user_detail.first_name = AAZStrType( + serialized_name="firstName", + ) + user_detail.last_name = AAZStrType( + serialized_name="lastName", + ) + user_detail.user_principal_name = AAZStrType( + serialized_name="userPrincipalName", + ) + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_create_role_binding.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_create_role_binding.py new file mode 100644 index 00000000000..ded32b55416 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_create_role_binding.py @@ -0,0 +1,209 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization create-role-binding", +) +class CreateRoleBinding(AAZCommand): + """Assign roles to users or groups within a Confluent organization. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/access/default/createrolebinding", "2024-02-13"], + ] + } + + 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.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Body" + + _args_schema = cls._args_schema + _args_schema.crn_pattern = AAZStrArg( + options=["--crn-pattern"], + arg_group="Body", + help="A CRN that specifies the scope and resource patterns necessary for the role to bind", + ) + _args_schema.principal = AAZStrArg( + options=["--principal"], + arg_group="Body", + help="The principal User or Group to bind the role to", + ) + _args_schema.role_name = AAZStrArg( + options=["--role-name"], + arg_group="Body", + help="The name of the role to bind to the principal", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AccessCreateRoleBinding(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 AccessCreateRoleBinding(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.Confluent/organizations/{organizationName}/access/default/createRoleBinding", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + 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("crn_pattern", AAZStrType, ".crn_pattern") + _builder.set_prop("principal", AAZStrType, ".principal") + _builder.set_prop("role_name", AAZStrType, ".role_name") + + 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.crn_pattern = AAZStrType() + _schema_on_200.id = AAZStrType() + _schema_on_200.kind = AAZStrType() + _schema_on_200.metadata = AAZObjectType() + _schema_on_200.principal = AAZStrType() + _schema_on_200.role_name = AAZStrType() + + metadata = cls._schema_on_200.metadata + metadata.created_at = AAZStrType() + metadata.deleted_at = AAZStrType() + metadata.resource_name = AAZStrType() + metadata.self = AAZStrType() + metadata.updated_at = AAZStrType() + + return cls._schema_on_200 + + +class _CreateRoleBindingHelper: + """Helper class for CreateRoleBinding""" + + +__all__ = ["CreateRoleBinding"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_create_user.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_create_user.py new file mode 100644 index 00000000000..01d2c922cc8 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_create_user.py @@ -0,0 +1,231 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization create-user", +) +class CreateUser(AAZCommand): + """Invite a new user to join the Confluent organization. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/access/default/createinvitation", "2024-02-13"], + ] + } + + 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.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Body" + + _args_schema = cls._args_schema + _args_schema.email = AAZStrArg( + options=["--email"], + arg_group="Body", + help="Email of the logged in user", + ) + _args_schema.organization_id = AAZStrArg( + options=["--organization-id"], + arg_group="Body", + help="Id of the organization", + ) + _args_schema.upn = AAZStrArg( + options=["--upn"], + arg_group="Body", + help="Upn of the logged in user", + ) + + # define Arg Group "InvitedUserDetails" + + _args_schema = cls._args_schema + _args_schema.auth_type = AAZStrArg( + options=["--auth-type"], + arg_group="InvitedUserDetails", + help="Auth type of the user", + ) + _args_schema.invited_email = AAZStrArg( + options=["--invited-email"], + arg_group="InvitedUserDetails", + help="UPN/Email of the user who is being invited", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AccessInviteUser(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 AccessInviteUser(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.Confluent/organizations/{organizationName}/access/default/createInvitation", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + 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("email", AAZStrType, ".email") + _builder.set_prop("invitedUserDetails", AAZObjectType) + _builder.set_prop("organizationId", AAZStrType, ".organization_id") + _builder.set_prop("upn", AAZStrType, ".upn") + + invited_user_details = _builder.get(".invitedUserDetails") + if invited_user_details is not None: + invited_user_details.set_prop("auth_type", AAZStrType, ".auth_type") + invited_user_details.set_prop("invitedEmail", AAZStrType, ".invited_email") + + 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.accepted_at = AAZStrType() + _schema_on_200.auth_type = AAZStrType() + _schema_on_200.email = AAZStrType() + _schema_on_200.expires_at = AAZStrType() + _schema_on_200.id = AAZStrType() + _schema_on_200.kind = AAZStrType() + _schema_on_200.metadata = AAZObjectType() + _schema_on_200.status = AAZStrType() + + metadata = cls._schema_on_200.metadata + metadata.created_at = AAZStrType() + metadata.deleted_at = AAZStrType() + metadata.resource_name = AAZStrType() + metadata.self = AAZStrType() + metadata.updated_at = AAZStrType() + + return cls._schema_on_200 + + +class _CreateUserHelper: + """Helper class for CreateUser""" + + +__all__ = ["CreateUser"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_delete.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_delete.py new file mode 100644 index 00000000000..10ba73ca83a --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_delete.py @@ -0,0 +1,160 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete an existing Confluent organization entity via Azure. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}", "2024-02-13"], + ] + } + + 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.organization_name = AAZStrArg( + options=["-n", "--name", "--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.OrganizationDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class OrganizationDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + 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, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + 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/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_list.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_list.py new file mode 100644 index 00000000000..baa2bef4058 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_list.py @@ -0,0 +1,489 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization list", +) +class List(AAZCommand): + """List all Confluent organizations under the specified resource group or subscription. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.confluent/organizations", "2024-02-13"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations", "2024-02-13"], + ] + } + + 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() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + if condition_0: + self.OrganizationListBySubscription(ctx=self.ctx)() + if condition_1: + self.OrganizationListByResourceGroup(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 OrganizationListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/organizations", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-02-13", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType() + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.created_time = AAZStrType( + serialized_name="createdTime", + flags={"read_only": True}, + ) + properties.offer_detail = AAZObjectType( + serialized_name="offerDetail", + flags={"required": True}, + ) + properties.organization_id = AAZStrType( + serialized_name="organizationId", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.sso_url = AAZStrType( + serialized_name="ssoUrl", + flags={"read_only": True}, + ) + properties.user_detail = AAZObjectType( + serialized_name="userDetail", + flags={"required": True}, + ) + + offer_detail = cls._schema_on_200.value.Element.properties.offer_detail + offer_detail.id = AAZStrType( + flags={"required": True}, + ) + offer_detail.plan_id = AAZStrType( + serialized_name="planId", + flags={"required": True}, + ) + offer_detail.plan_name = AAZStrType( + serialized_name="planName", + flags={"required": True}, + ) + offer_detail.private_offer_id = AAZStrType( + serialized_name="privateOfferId", + ) + offer_detail.private_offer_ids = AAZListType( + serialized_name="privateOfferIds", + ) + offer_detail.publisher_id = AAZStrType( + serialized_name="publisherId", + flags={"required": True}, + ) + offer_detail.status = AAZStrType() + offer_detail.term_id = AAZStrType( + serialized_name="termId", + ) + offer_detail.term_unit = AAZStrType( + serialized_name="termUnit", + flags={"required": True}, + ) + + private_offer_ids = cls._schema_on_200.value.Element.properties.offer_detail.private_offer_ids + private_offer_ids.Element = AAZStrType() + + user_detail = cls._schema_on_200.value.Element.properties.user_detail + user_detail.aad_email = AAZStrType( + serialized_name="aadEmail", + ) + user_detail.email_address = AAZStrType( + serialized_name="emailAddress", + flags={"required": True}, + ) + user_detail.first_name = AAZStrType( + serialized_name="firstName", + ) + user_detail.last_name = AAZStrType( + serialized_name="lastName", + ) + user_detail.user_principal_name = AAZStrType( + serialized_name="userPrincipalName", + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class OrganizationListByResourceGroup(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.Confluent/organizations", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "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", "2024-02-13", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType() + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.created_time = AAZStrType( + serialized_name="createdTime", + flags={"read_only": True}, + ) + properties.offer_detail = AAZObjectType( + serialized_name="offerDetail", + flags={"required": True}, + ) + properties.organization_id = AAZStrType( + serialized_name="organizationId", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.sso_url = AAZStrType( + serialized_name="ssoUrl", + flags={"read_only": True}, + ) + properties.user_detail = AAZObjectType( + serialized_name="userDetail", + flags={"required": True}, + ) + + offer_detail = cls._schema_on_200.value.Element.properties.offer_detail + offer_detail.id = AAZStrType( + flags={"required": True}, + ) + offer_detail.plan_id = AAZStrType( + serialized_name="planId", + flags={"required": True}, + ) + offer_detail.plan_name = AAZStrType( + serialized_name="planName", + flags={"required": True}, + ) + offer_detail.private_offer_id = AAZStrType( + serialized_name="privateOfferId", + ) + offer_detail.private_offer_ids = AAZListType( + serialized_name="privateOfferIds", + ) + offer_detail.publisher_id = AAZStrType( + serialized_name="publisherId", + flags={"required": True}, + ) + offer_detail.status = AAZStrType() + offer_detail.term_id = AAZStrType( + serialized_name="termId", + ) + offer_detail.term_unit = AAZStrType( + serialized_name="termUnit", + flags={"required": True}, + ) + + private_offer_ids = cls._schema_on_200.value.Element.properties.offer_detail.private_offer_ids + private_offer_ids.Element = AAZStrType() + + user_detail = cls._schema_on_200.value.Element.properties.user_detail + user_detail.aad_email = AAZStrType( + serialized_name="aadEmail", + ) + user_detail.email_address = AAZStrType( + serialized_name="emailAddress", + flags={"required": True}, + ) + user_detail.first_name = AAZStrType( + serialized_name="firstName", + ) + user_detail.last_name = AAZStrType( + serialized_name="lastName", + ) + user_detail.user_principal_name = AAZStrType( + serialized_name="userPrincipalName", + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_list_region.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_list_region.py new file mode 100644 index 00000000000..ab2b852d5f0 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_list_region.py @@ -0,0 +1,232 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization list-region", +) +class ListRegion(AAZCommand): + """List all the supported regions within a Confluent organization. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/listregions", "2024-02-13"], + ] + } + + 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.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Body" + + _args_schema = cls._args_schema + _args_schema.search_filters = AAZDictArg( + options=["--search-filters"], + arg_group="Body", + help="Search filters for the request", + ) + + search_filters = cls._args_schema.search_filters + search_filters.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.OrganizationListRegions(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 OrganizationListRegions(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.Confluent/organizations/{organizationName}/listRegions", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + 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("searchFilters", AAZDictType, ".search_filters") + + search_filters = _builder.get(".searchFilters") + if search_filters is not None: + search_filters.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.data = AAZListType() + + data = cls._schema_on_200.data + data.Element = AAZObjectType() + + _element = cls._schema_on_200.data.Element + _element.id = AAZStrType() + _element.kind = AAZStrType() + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + + properties = cls._schema_on_200.data.Element.properties + properties.metadata = AAZObjectType() + properties.spec = AAZObjectType() + + metadata = cls._schema_on_200.data.Element.properties.metadata + metadata.created_timestamp = AAZStrType( + serialized_name="createdTimestamp", + ) + metadata.deleted_timestamp = AAZStrType( + serialized_name="deletedTimestamp", + ) + metadata.resource_name = AAZStrType( + serialized_name="resourceName", + ) + metadata.self = AAZStrType() + metadata.updated_timestamp = AAZStrType( + serialized_name="updatedTimestamp", + ) + + spec = cls._schema_on_200.data.Element.properties.spec + spec.cloud = AAZStrType() + spec.name = AAZStrType() + spec.packages = AAZListType() + spec.region_name = AAZStrType( + serialized_name="regionName", + ) + + packages = cls._schema_on_200.data.Element.properties.spec.packages + packages.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListRegionHelper: + """Helper class for ListRegion""" + + +__all__ = ["ListRegion"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_list_role_binding.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_list_role_binding.py new file mode 100644 index 00000000000..d34aa819174 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_list_role_binding.py @@ -0,0 +1,219 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization list-role-binding", +) +class ListRoleBinding(AAZCommand): + """List all the role bindings within a Confluent organization. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/access/default/listrolebindings", "2024-02-13"], + ] + } + + 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.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Body" + + _args_schema = cls._args_schema + _args_schema.search_filters = AAZDictArg( + options=["--search-filters"], + arg_group="Body", + help="Search filters for the request", + ) + + search_filters = cls._args_schema.search_filters + search_filters.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AccessListRoleBindings(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 AccessListRoleBindings(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.Confluent/organizations/{organizationName}/access/default/listRoleBindings", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + 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("searchFilters", AAZDictType, ".search_filters") + + search_filters = _builder.get(".searchFilters") + if search_filters is not None: + search_filters.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.data = AAZListType() + _schema_on_200.kind = AAZStrType() + _schema_on_200.metadata = AAZObjectType() + + data = cls._schema_on_200.data + data.Element = AAZObjectType() + + _element = cls._schema_on_200.data.Element + _element.crn_pattern = AAZStrType() + _element.id = AAZStrType() + _element.kind = AAZStrType() + _element.metadata = AAZObjectType() + _element.principal = AAZStrType() + _element.role_name = AAZStrType() + + metadata = cls._schema_on_200.data.Element.metadata + metadata.created_at = AAZStrType() + metadata.deleted_at = AAZStrType() + metadata.resource_name = AAZStrType() + metadata.self = AAZStrType() + metadata.updated_at = AAZStrType() + + metadata = cls._schema_on_200.metadata + metadata.first = AAZStrType() + metadata.last = AAZStrType() + metadata.next = AAZStrType() + metadata.prev = AAZStrType() + metadata.total_size = AAZIntType() + + return cls._schema_on_200 + + +class _ListRoleBindingHelper: + """Helper class for ListRoleBinding""" + + +__all__ = ["ListRoleBinding"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_list_service_accounts.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_list_service_accounts.py new file mode 100644 index 00000000000..a85047e4d4b --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_list_service_accounts.py @@ -0,0 +1,218 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "confluent organization list-service-accounts", +) +class ListServiceAccounts(AAZCommand): + """List all the details of service accounts within a Confluent organization. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/access/default/listserviceaccounts", "2024-02-13"], + ] + } + + 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.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Body" + + _args_schema = cls._args_schema + _args_schema.search_filters = AAZDictArg( + options=["--search-filters"], + arg_group="Body", + help="Search filters for the request", + ) + + search_filters = cls._args_schema.search_filters + search_filters.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AccessListServiceAccounts(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 AccessListServiceAccounts(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.Confluent/organizations/{organizationName}/access/default/listServiceAccounts", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + 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("searchFilters", AAZDictType, ".search_filters") + + search_filters = _builder.get(".searchFilters") + if search_filters is not None: + search_filters.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.data = AAZListType() + _schema_on_200.kind = AAZStrType() + _schema_on_200.metadata = AAZObjectType() + + data = cls._schema_on_200.data + data.Element = AAZObjectType() + + _element = cls._schema_on_200.data.Element + _element.description = AAZStrType() + _element.display_name = AAZStrType() + _element.id = AAZStrType() + _element.kind = AAZStrType() + _element.metadata = AAZObjectType() + + metadata = cls._schema_on_200.data.Element.metadata + metadata.created_at = AAZStrType() + metadata.deleted_at = AAZStrType() + metadata.resource_name = AAZStrType() + metadata.self = AAZStrType() + metadata.updated_at = AAZStrType() + + metadata = cls._schema_on_200.metadata + metadata.first = AAZStrType() + metadata.last = AAZStrType() + metadata.next = AAZStrType() + metadata.prev = AAZStrType() + metadata.total_size = AAZIntType() + + return cls._schema_on_200 + + +class _ListServiceAccountsHelper: + """Helper class for ListServiceAccounts""" + + +__all__ = ["ListServiceAccounts"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_list_users.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_list_users.py new file mode 100644 index 00000000000..3174cc60112 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_list_users.py @@ -0,0 +1,219 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization list-users", +) +class ListUsers(AAZCommand): + """List all the details of users within a Confluent organization. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/access/default/listusers", "2024-02-13"], + ] + } + + 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.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Body" + + _args_schema = cls._args_schema + _args_schema.search_filters = AAZDictArg( + options=["--search-filters"], + arg_group="Body", + help="Search filters for the request", + ) + + search_filters = cls._args_schema.search_filters + search_filters.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AccessListUsers(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 AccessListUsers(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.Confluent/organizations/{organizationName}/access/default/listUsers", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + 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("searchFilters", AAZDictType, ".search_filters") + + search_filters = _builder.get(".searchFilters") + if search_filters is not None: + search_filters.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.data = AAZListType() + _schema_on_200.kind = AAZStrType() + _schema_on_200.metadata = AAZObjectType() + + data = cls._schema_on_200.data + data.Element = AAZObjectType() + + _element = cls._schema_on_200.data.Element + _element.auth_type = AAZStrType() + _element.email = AAZStrType() + _element.full_name = AAZStrType() + _element.id = AAZStrType() + _element.kind = AAZStrType() + _element.metadata = AAZObjectType() + + metadata = cls._schema_on_200.data.Element.metadata + metadata.created_at = AAZStrType() + metadata.deleted_at = AAZStrType() + metadata.resource_name = AAZStrType() + metadata.self = AAZStrType() + metadata.updated_at = AAZStrType() + + metadata = cls._schema_on_200.metadata + metadata.first = AAZStrType() + metadata.last = AAZStrType() + metadata.next = AAZStrType() + metadata.prev = AAZStrType() + metadata.total_size = AAZIntType() + + return cls._schema_on_200 + + +class _ListUsersHelper: + """Helper class for ListUsers""" + + +__all__ = ["ListUsers"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_show.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_show.py new file mode 100644 index 00000000000..0a1ad28e217 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_show.py @@ -0,0 +1,280 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization show", +) +class Show(AAZCommand): + """Retrieve properties of a specific Confluent organization resource. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}", "2024-02-13"], + ] + } + + 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.organization_name = AAZStrArg( + options=["-n", "--name", "--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.OrganizationGet(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 OrganizationGet(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.Confluent/organizations/{organizationName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType() + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.created_time = AAZStrType( + serialized_name="createdTime", + flags={"read_only": True}, + ) + properties.offer_detail = AAZObjectType( + serialized_name="offerDetail", + flags={"required": True}, + ) + properties.organization_id = AAZStrType( + serialized_name="organizationId", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.sso_url = AAZStrType( + serialized_name="ssoUrl", + flags={"read_only": True}, + ) + properties.user_detail = AAZObjectType( + serialized_name="userDetail", + flags={"required": True}, + ) + + offer_detail = cls._schema_on_200.properties.offer_detail + offer_detail.id = AAZStrType( + flags={"required": True}, + ) + offer_detail.plan_id = AAZStrType( + serialized_name="planId", + flags={"required": True}, + ) + offer_detail.plan_name = AAZStrType( + serialized_name="planName", + flags={"required": True}, + ) + offer_detail.private_offer_id = AAZStrType( + serialized_name="privateOfferId", + ) + offer_detail.private_offer_ids = AAZListType( + serialized_name="privateOfferIds", + ) + offer_detail.publisher_id = AAZStrType( + serialized_name="publisherId", + flags={"required": True}, + ) + offer_detail.status = AAZStrType() + offer_detail.term_id = AAZStrType( + serialized_name="termId", + ) + offer_detail.term_unit = AAZStrType( + serialized_name="termUnit", + flags={"required": True}, + ) + + private_offer_ids = cls._schema_on_200.properties.offer_detail.private_offer_ids + private_offer_ids.Element = AAZStrType() + + user_detail = cls._schema_on_200.properties.user_detail + user_detail.aad_email = AAZStrType( + serialized_name="aadEmail", + ) + user_detail.email_address = AAZStrType( + serialized_name="emailAddress", + flags={"required": True}, + ) + user_detail.first_name = AAZStrType( + serialized_name="firstName", + ) + user_detail.last_name = AAZStrType( + serialized_name="lastName", + ) + user_detail.user_principal_name = AAZStrType( + serialized_name="userPrincipalName", + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_update.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_update.py new file mode 100644 index 00000000000..f184a43d5b3 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_update.py @@ -0,0 +1,628 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization update", +) +class Update(AAZCommand): + """Update properties of an existing Confluent organization resource. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}", "2024-02-13"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + AZ_SUPPORT_GENERIC_UPDATE = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.organization_name = AAZStrArg( + options=["-n", "--name", "--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Body" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Body", + help="Location of Organization resource", + nullable=True, + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Body", + help="Organization 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.offer_detail = AAZObjectArg( + options=["--offer-detail"], + arg_group="Properties", + help="Confluent offer detail", + ) + _args_schema.user_detail = AAZObjectArg( + options=["--user-detail"], + arg_group="Properties", + help="Subscriber detail", + ) + + offer_detail = cls._args_schema.offer_detail + offer_detail.id = AAZStrArg( + options=["id"], + help="Offer Id", + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + offer_detail.plan_id = AAZStrArg( + options=["plan-id"], + help="Offer Plan Id", + fmt=AAZStrArgFormat( + max_length=200, + ), + ) + offer_detail.plan_name = AAZStrArg( + options=["plan-name"], + help="Offer Plan Name", + fmt=AAZStrArgFormat( + max_length=200, + ), + ) + offer_detail.private_offer_id = AAZStrArg( + options=["private-offer-id"], + help="Private Offer Id", + nullable=True, + fmt=AAZStrArgFormat( + max_length=255, + ), + ) + offer_detail.private_offer_ids = AAZListArg( + options=["private-offer-ids"], + help="Array of Private Offer Ids", + nullable=True, + ) + offer_detail.publisher_id = AAZStrArg( + options=["publisher-id"], + help="Publisher Id", + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + offer_detail.status = AAZStrArg( + options=["status"], + help="SaaS Offer Status", + nullable=True, + enum={"Failed": "Failed", "InProgress": "InProgress", "PendingFulfillmentStart": "PendingFulfillmentStart", "Reinstated": "Reinstated", "Started": "Started", "Subscribed": "Subscribed", "Succeeded": "Succeeded", "Suspended": "Suspended", "Unsubscribed": "Unsubscribed", "Updating": "Updating"}, + ) + offer_detail.term_id = AAZStrArg( + options=["term-id"], + help="Offer Plan Term Id", + nullable=True, + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + offer_detail.term_unit = AAZStrArg( + options=["term-unit"], + help="Offer Plan Term unit", + fmt=AAZStrArgFormat( + max_length=25, + ), + ) + + private_offer_ids = cls._args_schema.offer_detail.private_offer_ids + private_offer_ids.Element = AAZStrArg( + nullable=True, + ) + + user_detail = cls._args_schema.user_detail + user_detail.aad_email = AAZStrArg( + options=["aad-email"], + help="AAD email address", + nullable=True, + ) + user_detail.email_address = AAZStrArg( + options=["email-address"], + help="Email address", + fmt=AAZStrArgFormat( + pattern="^\\S+@\\S+\\.\\S+$", + ), + ) + user_detail.first_name = AAZStrArg( + options=["first-name"], + help="First name", + nullable=True, + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + user_detail.last_name = AAZStrArg( + options=["last-name"], + help="Last name", + nullable=True, + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + user_detail.user_principal_name = AAZStrArg( + options=["user-principal-name"], + help="User principal name", + nullable=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.OrganizationGet(ctx=self.ctx)() + self.pre_instance_update(self.ctx.vars.instance) + self.InstanceUpdateByJson(ctx=self.ctx)() + self.InstanceUpdateByGeneric(ctx=self.ctx)() + self.post_instance_update(self.ctx.vars.instance) + yield self.OrganizationCreate(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 OrganizationGet(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.Confluent/organizations/{organizationName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + 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_organization_resource_read(cls._schema_on_200) + + return cls._schema_on_200 + + class OrganizationCreate(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": "azure-async-operation"}, + 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": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + 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_organization_resource_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("location", AAZStrType, ".location") + _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("offerDetail", AAZObjectType, ".offer_detail", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("userDetail", AAZObjectType, ".user_detail", typ_kwargs={"flags": {"required": True}}) + + offer_detail = _builder.get(".properties.offerDetail") + if offer_detail is not None: + offer_detail.set_prop("id", AAZStrType, ".id", typ_kwargs={"flags": {"required": True}}) + offer_detail.set_prop("planId", AAZStrType, ".plan_id", typ_kwargs={"flags": {"required": True}}) + offer_detail.set_prop("planName", AAZStrType, ".plan_name", typ_kwargs={"flags": {"required": True}}) + offer_detail.set_prop("privateOfferId", AAZStrType, ".private_offer_id") + offer_detail.set_prop("privateOfferIds", AAZListType, ".private_offer_ids") + offer_detail.set_prop("publisherId", AAZStrType, ".publisher_id", typ_kwargs={"flags": {"required": True}}) + offer_detail.set_prop("status", AAZStrType, ".status") + offer_detail.set_prop("termId", AAZStrType, ".term_id") + offer_detail.set_prop("termUnit", AAZStrType, ".term_unit", typ_kwargs={"flags": {"required": True}}) + + private_offer_ids = _builder.get(".properties.offerDetail.privateOfferIds") + if private_offer_ids is not None: + private_offer_ids.set_elements(AAZStrType, ".") + + user_detail = _builder.get(".properties.userDetail") + if user_detail is not None: + user_detail.set_prop("aadEmail", AAZStrType, ".aad_email") + user_detail.set_prop("emailAddress", AAZStrType, ".email_address", typ_kwargs={"flags": {"required": True}}) + user_detail.set_prop("firstName", AAZStrType, ".first_name") + user_detail.set_prop("lastName", AAZStrType, ".last_name") + user_detail.set_prop("userPrincipalName", AAZStrType, ".user_principal_name") + + 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_organization_resource_read = None + + @classmethod + def _build_schema_organization_resource_read(cls, _schema): + if cls._schema_organization_resource_read is not None: + _schema.id = cls._schema_organization_resource_read.id + _schema.location = cls._schema_organization_resource_read.location + _schema.name = cls._schema_organization_resource_read.name + _schema.properties = cls._schema_organization_resource_read.properties + _schema.system_data = cls._schema_organization_resource_read.system_data + _schema.tags = cls._schema_organization_resource_read.tags + _schema.type = cls._schema_organization_resource_read.type + return + + cls._schema_organization_resource_read = _schema_organization_resource_read = AAZObjectType() + + organization_resource_read = _schema_organization_resource_read + organization_resource_read.id = AAZStrType( + flags={"read_only": True}, + ) + organization_resource_read.location = AAZStrType() + organization_resource_read.name = AAZStrType( + flags={"read_only": True}, + ) + organization_resource_read.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + organization_resource_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + organization_resource_read.tags = AAZDictType() + organization_resource_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_organization_resource_read.properties + properties.created_time = AAZStrType( + serialized_name="createdTime", + flags={"read_only": True}, + ) + properties.offer_detail = AAZObjectType( + serialized_name="offerDetail", + flags={"required": True}, + ) + properties.organization_id = AAZStrType( + serialized_name="organizationId", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.sso_url = AAZStrType( + serialized_name="ssoUrl", + flags={"read_only": True}, + ) + properties.user_detail = AAZObjectType( + serialized_name="userDetail", + flags={"required": True}, + ) + + offer_detail = _schema_organization_resource_read.properties.offer_detail + offer_detail.id = AAZStrType( + flags={"required": True}, + ) + offer_detail.plan_id = AAZStrType( + serialized_name="planId", + flags={"required": True}, + ) + offer_detail.plan_name = AAZStrType( + serialized_name="planName", + flags={"required": True}, + ) + offer_detail.private_offer_id = AAZStrType( + serialized_name="privateOfferId", + ) + offer_detail.private_offer_ids = AAZListType( + serialized_name="privateOfferIds", + ) + offer_detail.publisher_id = AAZStrType( + serialized_name="publisherId", + flags={"required": True}, + ) + offer_detail.status = AAZStrType() + offer_detail.term_id = AAZStrType( + serialized_name="termId", + ) + offer_detail.term_unit = AAZStrType( + serialized_name="termUnit", + flags={"required": True}, + ) + + private_offer_ids = _schema_organization_resource_read.properties.offer_detail.private_offer_ids + private_offer_ids.Element = AAZStrType() + + user_detail = _schema_organization_resource_read.properties.user_detail + user_detail.aad_email = AAZStrType( + serialized_name="aadEmail", + ) + user_detail.email_address = AAZStrType( + serialized_name="emailAddress", + flags={"required": True}, + ) + user_detail.first_name = AAZStrType( + serialized_name="firstName", + ) + user_detail.last_name = AAZStrType( + serialized_name="lastName", + ) + user_detail.user_principal_name = AAZStrType( + serialized_name="userPrincipalName", + ) + + system_data = _schema_organization_resource_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = _schema_organization_resource_read.tags + tags.Element = AAZStrType() + + _schema.id = cls._schema_organization_resource_read.id + _schema.location = cls._schema_organization_resource_read.location + _schema.name = cls._schema_organization_resource_read.name + _schema.properties = cls._schema_organization_resource_read.properties + _schema.system_data = cls._schema_organization_resource_read.system_data + _schema.tags = cls._schema_organization_resource_read.tags + _schema.type = cls._schema_organization_resource_read.type + + +__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_wait.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_wait.py new file mode 100644 index 00000000000..c4d42e86612 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/_wait.py @@ -0,0 +1,279 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization 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.confluent/organizations/{}", "2024-02-13"], + ] + } + + 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.organization_name = AAZStrArg( + options=["-n", "--name", "--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.OrganizationGet(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 OrganizationGet(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.Confluent/organizations/{organizationName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType() + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.created_time = AAZStrType( + serialized_name="createdTime", + flags={"read_only": True}, + ) + properties.offer_detail = AAZObjectType( + serialized_name="offerDetail", + flags={"required": True}, + ) + properties.organization_id = AAZStrType( + serialized_name="organizationId", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.sso_url = AAZStrType( + serialized_name="ssoUrl", + flags={"read_only": True}, + ) + properties.user_detail = AAZObjectType( + serialized_name="userDetail", + flags={"required": True}, + ) + + offer_detail = cls._schema_on_200.properties.offer_detail + offer_detail.id = AAZStrType( + flags={"required": True}, + ) + offer_detail.plan_id = AAZStrType( + serialized_name="planId", + flags={"required": True}, + ) + offer_detail.plan_name = AAZStrType( + serialized_name="planName", + flags={"required": True}, + ) + offer_detail.private_offer_id = AAZStrType( + serialized_name="privateOfferId", + ) + offer_detail.private_offer_ids = AAZListType( + serialized_name="privateOfferIds", + ) + offer_detail.publisher_id = AAZStrType( + serialized_name="publisherId", + flags={"required": True}, + ) + offer_detail.status = AAZStrType() + offer_detail.term_id = AAZStrType( + serialized_name="termId", + ) + offer_detail.term_unit = AAZStrType( + serialized_name="termUnit", + flags={"required": True}, + ) + + private_offer_ids = cls._schema_on_200.properties.offer_detail.private_offer_ids + private_offer_ids.Element = AAZStrType() + + user_detail = cls._schema_on_200.properties.user_detail + user_detail.aad_email = AAZStrType( + serialized_name="aadEmail", + ) + user_detail.email_address = AAZStrType( + serialized_name="emailAddress", + flags={"required": True}, + ) + user_detail.first_name = AAZStrType( + serialized_name="firstName", + ) + user_detail.last_name = AAZStrType( + serialized_name="lastName", + ) + user_detail.user_principal_name = AAZStrType( + serialized_name="userPrincipalName", + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/__cmd_group.py new file mode 100644 index 00000000000..06e544367c8 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/__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( + "confluent organization access", +) +class __CMDGroup(AAZCommandGroup): + """Manage Access for List Cluster, Environment, Invitation, Role Binding Names with in the Confluent organization. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/__init__.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/__init__.py new file mode 100644 index 00000000000..5a9d61963d6 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/__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/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/default/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/default/__cmd_group.py new file mode 100644 index 00000000000..785605273b3 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/default/__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( + "confluent organization access default", +) +class __CMDGroup(AAZCommandGroup): + """Manage Default + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/default/__init__.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/default/__init__.py new file mode 100644 index 00000000000..34b1247c968 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/default/__init__.py @@ -0,0 +1,15 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._list_cluster import * +from ._list_environment import * +from ._list_invitation import * +from ._list_role_binding_name_list import * diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/default/_list_cluster.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/default/_list_cluster.py new file mode 100644 index 00000000000..e87b9f2d2a0 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/default/_list_cluster.py @@ -0,0 +1,257 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization access default list-cluster", +) +class ListCluster(AAZCommand): + """List all Confluent cluster within an environment in an organization + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/access/default/listclusters", "2024-02-13"], + ] + } + + 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.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Body" + + _args_schema = cls._args_schema + _args_schema.search_filters = AAZDictArg( + options=["--search-filters"], + arg_group="Body", + help="Search filters for the request", + ) + + search_filters = cls._args_schema.search_filters + search_filters.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AccessListClusters(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 AccessListClusters(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.Confluent/organizations/{organizationName}/access/default/listClusters", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + 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("searchFilters", AAZDictType, ".search_filters") + + search_filters = _builder.get(".searchFilters") + if search_filters is not None: + search_filters.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.data = AAZListType() + _schema_on_200.kind = AAZStrType() + _schema_on_200.metadata = AAZObjectType() + + data = cls._schema_on_200.data + data.Element = AAZObjectType() + + _element = cls._schema_on_200.data.Element + _element.display_name = AAZStrType() + _element.id = AAZStrType() + _element.kind = AAZStrType() + _element.metadata = AAZObjectType() + _element.spec = AAZObjectType() + _element.status = AAZObjectType() + + metadata = cls._schema_on_200.data.Element.metadata + metadata.created_at = AAZStrType() + metadata.deleted_at = AAZStrType() + metadata.resource_name = AAZStrType() + metadata.self = AAZStrType() + metadata.updated_at = AAZStrType() + + spec = cls._schema_on_200.data.Element.spec + spec.api_endpoint = AAZStrType() + spec.availability = AAZStrType() + spec.byok = AAZObjectType() + spec.cloud = AAZStrType() + spec.config = AAZObjectType() + spec.display_name = AAZStrType() + spec.environment = AAZObjectType() + spec.http_endpoint = AAZStrType() + spec.kafka_bootstrap_endpoint = AAZStrType() + spec.network = AAZObjectType() + spec.region = AAZStrType() + spec.zone = AAZStrType() + + byok = cls._schema_on_200.data.Element.spec.byok + byok.id = AAZStrType() + byok.related = AAZStrType() + byok.resource_name = AAZStrType() + + config = cls._schema_on_200.data.Element.spec.config + config.kind = AAZStrType() + + environment = cls._schema_on_200.data.Element.spec.environment + environment.environment = AAZStrType() + environment.id = AAZStrType() + environment.related = AAZStrType() + environment.resource_name = AAZStrType() + + network = cls._schema_on_200.data.Element.spec.network + network.environment = AAZStrType() + network.id = AAZStrType() + network.related = AAZStrType() + network.resource_name = AAZStrType() + + status = cls._schema_on_200.data.Element.status + status.cku = AAZIntType() + status.phase = AAZStrType() + + metadata = cls._schema_on_200.metadata + metadata.first = AAZStrType() + metadata.last = AAZStrType() + metadata.next = AAZStrType() + metadata.prev = AAZStrType() + metadata.total_size = AAZIntType() + + return cls._schema_on_200 + + +class _ListClusterHelper: + """Helper class for ListCluster""" + + +__all__ = ["ListCluster"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/default/_list_environment.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/default/_list_environment.py new file mode 100644 index 00000000000..a1ad35affa1 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/default/_list_environment.py @@ -0,0 +1,217 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization access default list-environment", +) +class ListEnvironment(AAZCommand): + """List all Confluent environment in an organization. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/access/default/listenvironments", "2024-02-13"], + ] + } + + 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.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Body" + + _args_schema = cls._args_schema + _args_schema.search_filters = AAZDictArg( + options=["--search-filters"], + arg_group="Body", + help="Search filters for the request", + ) + + search_filters = cls._args_schema.search_filters + search_filters.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AccessListEnvironments(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 AccessListEnvironments(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.Confluent/organizations/{organizationName}/access/default/listEnvironments", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + 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("searchFilters", AAZDictType, ".search_filters") + + search_filters = _builder.get(".searchFilters") + if search_filters is not None: + search_filters.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.data = AAZListType() + _schema_on_200.kind = AAZStrType() + _schema_on_200.metadata = AAZObjectType() + + data = cls._schema_on_200.data + data.Element = AAZObjectType() + + _element = cls._schema_on_200.data.Element + _element.display_name = AAZStrType() + _element.id = AAZStrType() + _element.kind = AAZStrType() + _element.metadata = AAZObjectType() + + metadata = cls._schema_on_200.data.Element.metadata + metadata.created_at = AAZStrType() + metadata.deleted_at = AAZStrType() + metadata.resource_name = AAZStrType() + metadata.self = AAZStrType() + metadata.updated_at = AAZStrType() + + metadata = cls._schema_on_200.metadata + metadata.first = AAZStrType() + metadata.last = AAZStrType() + metadata.next = AAZStrType() + metadata.prev = AAZStrType() + metadata.total_size = AAZIntType() + + return cls._schema_on_200 + + +class _ListEnvironmentHelper: + """Helper class for ListEnvironment""" + + +__all__ = ["ListEnvironment"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/default/_list_invitation.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/default/_list_invitation.py new file mode 100644 index 00000000000..24c86404747 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/default/_list_invitation.py @@ -0,0 +1,221 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "confluent organization access default list-invitation", +) +class ListInvitation(AAZCommand): + """List all Confluent invitation in an organization. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/access/default/listinvitations", "2024-02-13"], + ] + } + + 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.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Body" + + _args_schema = cls._args_schema + _args_schema.search_filters = AAZDictArg( + options=["--search-filters"], + arg_group="Body", + help="Search filters for the request", + ) + + search_filters = cls._args_schema.search_filters + search_filters.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AccessListInvitations(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 AccessListInvitations(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.Confluent/organizations/{organizationName}/access/default/listInvitations", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + 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("searchFilters", AAZDictType, ".search_filters") + + search_filters = _builder.get(".searchFilters") + if search_filters is not None: + search_filters.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.data = AAZListType() + _schema_on_200.kind = AAZStrType() + _schema_on_200.metadata = AAZObjectType() + + data = cls._schema_on_200.data + data.Element = AAZObjectType() + + _element = cls._schema_on_200.data.Element + _element.accepted_at = AAZStrType() + _element.auth_type = AAZStrType() + _element.email = AAZStrType() + _element.expires_at = AAZStrType() + _element.id = AAZStrType() + _element.kind = AAZStrType() + _element.metadata = AAZObjectType() + _element.status = AAZStrType() + + metadata = cls._schema_on_200.data.Element.metadata + metadata.created_at = AAZStrType() + metadata.deleted_at = AAZStrType() + metadata.resource_name = AAZStrType() + metadata.self = AAZStrType() + metadata.updated_at = AAZStrType() + + metadata = cls._schema_on_200.metadata + metadata.first = AAZStrType() + metadata.last = AAZStrType() + metadata.next = AAZStrType() + metadata.prev = AAZStrType() + metadata.total_size = AAZIntType() + + return cls._schema_on_200 + + +class _ListInvitationHelper: + """Helper class for ListInvitation""" + + +__all__ = ["ListInvitation"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/default/_list_role_binding_name_list.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/default/_list_role_binding_name_list.py new file mode 100644 index 00000000000..af5baf70222 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/access/default/_list_role_binding_name_list.py @@ -0,0 +1,204 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization access default list-role-binding-name-list", +) +class ListRoleBindingNameList(AAZCommand): + """List all Confluent role bindings names in an organization. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/access/default/listrolebindingnamelist", "2024-02-13"], + ] + } + + 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.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Body" + + _args_schema = cls._args_schema + _args_schema.search_filters = AAZDictArg( + options=["--search-filters"], + arg_group="Body", + help="Search filters for the request", + ) + + search_filters = cls._args_schema.search_filters + search_filters.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AccessListRoleBindingNameList(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 AccessListRoleBindingNameList(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.Confluent/organizations/{organizationName}/access/default/listRoleBindingNameList", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + 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("searchFilters", AAZDictType, ".search_filters") + + search_filters = _builder.get(".searchFilters") + if search_filters is not None: + search_filters.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.data = AAZListType() + _schema_on_200.kind = AAZStrType() + _schema_on_200.metadata = AAZObjectType() + + data = cls._schema_on_200.data + data.Element = AAZStrType() + + metadata = cls._schema_on_200.metadata + metadata.first = AAZStrType() + metadata.last = AAZStrType() + metadata.next = AAZStrType() + metadata.prev = AAZStrType() + metadata.total_size = AAZIntType() + + return cls._schema_on_200 + + +class _ListRoleBindingNameListHelper: + """Helper class for ListRoleBindingNameList""" + + +__all__ = ["ListRoleBindingNameList"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/api_key/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/api_key/__cmd_group.py new file mode 100644 index 00000000000..ec760ddcf04 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/api_key/__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( + "confluent organization api-key", +) +class __CMDGroup(AAZCommandGroup): + """Manage API keys for Kafka or Schema Registry clusters in Confluent. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/api_key/__init__.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/api_key/__init__.py new file mode 100644 index 00000000000..4aef6adc020 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/api_key/__init__.py @@ -0,0 +1,13 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._delete import * +from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/api_key/_delete.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/api_key/_delete.py new file mode 100644 index 00000000000..85ac1fa5c4b --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/api_key/_delete.py @@ -0,0 +1,146 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization api-key delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Remove an API key from a Kafka or Schema Registry cluster in Confluent. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/apikeys/{}", "2024-02-13"], + ] + } + + 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.api_key_id = AAZStrArg( + options=["--api-key-id"], + help="Confluent API Key id", + required=True, + id_part="child_name_1", + ) + _args_schema.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.OrganizationDeleteClusterAPIKey(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class OrganizationDeleteClusterAPIKey(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.Confluent/organizations/{organizationName}/apiKeys/{apiKeyId}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiKeyId", self.ctx.args.api_key_id, + required=True, + ), + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + 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/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/api_key/_show.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/api_key/_show.py new file mode 100644 index 00000000000..c21b99dfd8e --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/api_key/_show.py @@ -0,0 +1,218 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "confluent organization api-key show", +) +class Show(AAZCommand): + """Show a API key from a Kafka or Schema Registry cluster in Confluent. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/apikeys/{}", "2024-02-13"], + ] + } + + 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.api_key_id = AAZStrArg( + options=["--api-key-id"], + help="Confluent API Key id", + required=True, + id_part="child_name_1", + ) + _args_schema.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.OrganizationGetClusterAPIKey(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 OrganizationGetClusterAPIKey(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.Confluent/organizations/{organizationName}/apiKeys/{apiKeyId}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiKeyId", self.ctx.args.api_key_id, + required=True, + ), + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + 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() + _schema_on_200.kind = AAZStrType() + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + + properties = cls._schema_on_200.properties + properties.metadata = AAZObjectType() + properties.spec = AAZObjectType() + + metadata = cls._schema_on_200.properties.metadata + metadata.created_timestamp = AAZStrType( + serialized_name="createdTimestamp", + ) + metadata.deleted_timestamp = AAZStrType( + serialized_name="deletedTimestamp", + ) + metadata.resource_name = AAZStrType( + serialized_name="resourceName", + ) + metadata.self = AAZStrType() + metadata.updated_timestamp = AAZStrType( + serialized_name="updatedTimestamp", + ) + + spec = cls._schema_on_200.properties.spec + spec.description = AAZStrType() + spec.name = AAZStrType() + spec.owner = AAZObjectType() + spec.resource = AAZObjectType() + + owner = cls._schema_on_200.properties.spec.owner + owner.id = AAZStrType() + owner.kind = AAZStrType() + owner.related = AAZStrType() + owner.resource_name = AAZStrType( + serialized_name="resourceName", + ) + + resource = cls._schema_on_200.properties.spec.resource + resource.environment = AAZStrType() + resource.id = AAZStrType() + resource.kind = AAZStrType() + resource.related = AAZStrType() + resource.resource_name = AAZStrType( + serialized_name="resourceName", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/__cmd_group.py new file mode 100644 index 00000000000..326c70d44e2 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/__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( + "confluent organization environment", +) +class __CMDGroup(AAZCommandGroup): + """Commands to get the confluent environments in the organization + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/__init__.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/__init__.py new file mode 100644 index 00000000000..2df85698253 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/__init__.py @@ -0,0 +1,13 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._list import * +from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/_list.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/_list.py new file mode 100644 index 00000000000..818313cc004 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/_list.py @@ -0,0 +1,209 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization environment list", +) +class List(AAZCommand): + """List all Confluent environments within a specific organization. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/environments", "2024-02-13"], + ] + } + + 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.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.page_size = AAZIntArg( + options=["--page-size"], + help="Pagination size", + ) + _args_schema.page_token = AAZStrArg( + options=["--page-token"], + help="An opaque pagination token to fetch the next set of records", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.OrganizationListEnvironments(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 OrganizationListEnvironments(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.Confluent/organizations/{organizationName}/environments", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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( + "pageSize", self.ctx.args.page_size, + ), + **self.serialize_query_param( + "pageToken", self.ctx.args.page_token, + ), + **self.serialize_query_param( + "api-version", "2024-02-13", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType() + _element.kind = AAZStrType() + _element.name = AAZStrType() + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.metadata = AAZObjectType() + + metadata = cls._schema_on_200.value.Element.properties.metadata + metadata.created_timestamp = AAZStrType( + serialized_name="createdTimestamp", + ) + metadata.deleted_timestamp = AAZStrType( + serialized_name="deletedTimestamp", + ) + metadata.resource_name = AAZStrType( + serialized_name="resourceName", + ) + metadata.self = AAZStrType() + metadata.updated_timestamp = AAZStrType( + serialized_name="updatedTimestamp", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/_show.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/_show.py new file mode 100644 index 00000000000..96e38e7942a --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/_show.py @@ -0,0 +1,195 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "confluent organization environment show", +) +class Show(AAZCommand): + """Display details of a specific Confluent environment within an organization. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/environments/{}", "2024-02-13"], + ] + } + + 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.environment_id = AAZStrArg( + options=["-n", "--name", "--environment-id"], + help="Confluent environment id", + required=True, + id_part="child_name_1", + ) + _args_schema.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.OrganizationGetEnvironmentById(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 OrganizationGetEnvironmentById(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.Confluent/organizations/{organizationName}/environments/{environmentId}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "environmentId", self.ctx.args.environment_id, + required=True, + ), + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + 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() + _schema_on_200.kind = AAZStrType() + _schema_on_200.name = AAZStrType() + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + + properties = cls._schema_on_200.properties + properties.metadata = AAZObjectType() + + metadata = cls._schema_on_200.properties.metadata + metadata.created_timestamp = AAZStrType( + serialized_name="createdTimestamp", + ) + metadata.deleted_timestamp = AAZStrType( + serialized_name="deletedTimestamp", + ) + metadata.resource_name = AAZStrType( + serialized_name="resourceName", + ) + metadata.self = AAZStrType() + metadata.updated_timestamp = AAZStrType( + serialized_name="updatedTimestamp", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/__cmd_group.py new file mode 100644 index 00000000000..7fdd3561fc6 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "confluent organization environment cluster", +) +class __CMDGroup(AAZCommandGroup): + """Command to get the confluent cluster details in a environment + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/__init__.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/__init__.py new file mode 100644 index 00000000000..e02e05398d8 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/__init__.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: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create_api_key import * +from ._list import * +from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/_create_api_key.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/_create_api_key.py new file mode 100644 index 00000000000..62e9a5f6a1a --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/_create_api_key.py @@ -0,0 +1,257 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization environment cluster create-api-key", +) +class CreateApiKey(AAZCommand): + """Create API keys for Schema Registry or Kafka clusters within an environment. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/environments/{}/clusters/{}/createapikey", "2024-02-13"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cluster_id = AAZStrArg( + options=["--cluster-id"], + help="Confluent kafka or schema registry cluster id", + required=True, + id_part="child_name_2", + ) + _args_schema.environment_id = AAZStrArg( + options=["--environment-id"], + help="Confluent environment id", + required=True, + id_part="child_name_1", + ) + _args_schema.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Body" + + _args_schema = cls._args_schema + _args_schema.description = AAZStrArg( + options=["--description"], + arg_group="Body", + help="Description of the API Key", + ) + _args_schema.name = AAZStrArg( + options=["--name"], + arg_group="Body", + help="Name of the API Key", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.OrganizationCreateAPIKey(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 OrganizationCreateAPIKey(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.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/createAPIKey", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterId", self.ctx.args.cluster_id, + required=True, + ), + **self.serialize_url_param( + "environmentId", self.ctx.args.environment_id, + required=True, + ), + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + 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("description", AAZStrType, ".description") + _builder.set_prop("name", AAZStrType, ".name") + + 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() + _schema_on_200.kind = AAZStrType() + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + + properties = cls._schema_on_200.properties + properties.metadata = AAZObjectType() + properties.spec = AAZObjectType() + + metadata = cls._schema_on_200.properties.metadata + metadata.created_timestamp = AAZStrType( + serialized_name="createdTimestamp", + ) + metadata.deleted_timestamp = AAZStrType( + serialized_name="deletedTimestamp", + ) + metadata.resource_name = AAZStrType( + serialized_name="resourceName", + ) + metadata.self = AAZStrType() + metadata.updated_timestamp = AAZStrType( + serialized_name="updatedTimestamp", + ) + + spec = cls._schema_on_200.properties.spec + spec.description = AAZStrType() + spec.name = AAZStrType() + spec.owner = AAZObjectType() + spec.resource = AAZObjectType() + + owner = cls._schema_on_200.properties.spec.owner + owner.id = AAZStrType() + owner.kind = AAZStrType() + owner.related = AAZStrType() + owner.resource_name = AAZStrType( + serialized_name="resourceName", + ) + + resource = cls._schema_on_200.properties.spec.resource + resource.environment = AAZStrType() + resource.id = AAZStrType() + resource.kind = AAZStrType() + resource.related = AAZStrType() + resource.resource_name = AAZStrType( + serialized_name="resourceName", + ) + + return cls._schema_on_200 + + +class _CreateApiKeyHelper: + """Helper class for CreateApiKey""" + + +__all__ = ["CreateApiKey"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/_list.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/_list.py new file mode 100644 index 00000000000..545b8cde8ae --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/_list.py @@ -0,0 +1,282 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization environment cluster list", +) +class List(AAZCommand): + """List all clusters within a specific Confluent environment. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/environments/{}/clusters", "2024-02-13"], + ] + } + + 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.environment_id = AAZStrArg( + options=["--environment-id"], + help="Confluent environment id", + required=True, + ) + _args_schema.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.page_size = AAZIntArg( + options=["--page-size"], + help="Pagination size", + ) + _args_schema.page_token = AAZStrArg( + options=["--page-token"], + help="An opaque pagination token to fetch the next set of records", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.OrganizationListClusters(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 OrganizationListClusters(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.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "environmentId", self.ctx.args.environment_id, + required=True, + ), + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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( + "pageSize", self.ctx.args.page_size, + ), + **self.serialize_query_param( + "pageToken", self.ctx.args.page_token, + ), + **self.serialize_query_param( + "api-version", "2024-02-13", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType() + _element.kind = AAZStrType() + _element.name = AAZStrType() + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.metadata = AAZObjectType() + properties.spec = AAZObjectType() + properties.status = AAZObjectType() + + metadata = cls._schema_on_200.value.Element.properties.metadata + metadata.created_timestamp = AAZStrType( + serialized_name="createdTimestamp", + ) + metadata.deleted_timestamp = AAZStrType( + serialized_name="deletedTimestamp", + ) + metadata.resource_name = AAZStrType( + serialized_name="resourceName", + ) + metadata.self = AAZStrType() + metadata.updated_timestamp = AAZStrType( + serialized_name="updatedTimestamp", + ) + + spec = cls._schema_on_200.value.Element.properties.spec + spec.api_endpoint = AAZStrType( + serialized_name="apiEndpoint", + ) + spec.availability = AAZStrType() + spec.byok = AAZObjectType() + spec.cloud = AAZStrType() + spec.config = AAZObjectType() + spec.environment = AAZObjectType() + _ListHelper._build_schema_sc_cluster_network_environment_entity_read(spec.environment) + spec.http_endpoint = AAZStrType( + serialized_name="httpEndpoint", + ) + spec.kafka_bootstrap_endpoint = AAZStrType( + serialized_name="kafkaBootstrapEndpoint", + ) + spec.name = AAZStrType() + spec.network = AAZObjectType() + _ListHelper._build_schema_sc_cluster_network_environment_entity_read(spec.network) + spec.region = AAZStrType() + spec.zone = AAZStrType() + + byok = cls._schema_on_200.value.Element.properties.spec.byok + byok.id = AAZStrType() + byok.related = AAZStrType() + byok.resource_name = AAZStrType( + serialized_name="resourceName", + ) + + config = cls._schema_on_200.value.Element.properties.spec.config + config.kind = AAZStrType() + + status = cls._schema_on_200.value.Element.properties.status + status.cku = AAZIntType() + status.phase = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + _schema_sc_cluster_network_environment_entity_read = None + + @classmethod + def _build_schema_sc_cluster_network_environment_entity_read(cls, _schema): + if cls._schema_sc_cluster_network_environment_entity_read is not None: + _schema.environment = cls._schema_sc_cluster_network_environment_entity_read.environment + _schema.id = cls._schema_sc_cluster_network_environment_entity_read.id + _schema.related = cls._schema_sc_cluster_network_environment_entity_read.related + _schema.resource_name = cls._schema_sc_cluster_network_environment_entity_read.resource_name + return + + cls._schema_sc_cluster_network_environment_entity_read = _schema_sc_cluster_network_environment_entity_read = AAZObjectType() + + sc_cluster_network_environment_entity_read = _schema_sc_cluster_network_environment_entity_read + sc_cluster_network_environment_entity_read.environment = AAZStrType() + sc_cluster_network_environment_entity_read.id = AAZStrType() + sc_cluster_network_environment_entity_read.related = AAZStrType() + sc_cluster_network_environment_entity_read.resource_name = AAZStrType( + serialized_name="resourceName", + ) + + _schema.environment = cls._schema_sc_cluster_network_environment_entity_read.environment + _schema.id = cls._schema_sc_cluster_network_environment_entity_read.id + _schema.related = cls._schema_sc_cluster_network_environment_entity_read.related + _schema.resource_name = cls._schema_sc_cluster_network_environment_entity_read.resource_name + + +__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/_show.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/_show.py new file mode 100644 index 00000000000..8065acebd64 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/_show.py @@ -0,0 +1,269 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "confluent organization environment cluster show", +) +class Show(AAZCommand): + """Retrieve details of a specific Confluent cluster by its ID. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/environments/{}/clusters/{}", "2024-02-13"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cluster_id = AAZStrArg( + options=["--cluster-id"], + help="Confluent kafka or schema registry cluster id prefixed with lkc or lks", + required=True, + id_part="child_name_2", + ) + _args_schema.environment_id = AAZStrArg( + options=["--environment-id"], + help="Confluent environment id", + required=True, + id_part="child_name_1", + ) + _args_schema.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.OrganizationGetClusterById(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 OrganizationGetClusterById(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.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterId", self.ctx.args.cluster_id, + required=True, + ), + **self.serialize_url_param( + "environmentId", self.ctx.args.environment_id, + required=True, + ), + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + 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() + _schema_on_200.kind = AAZStrType() + _schema_on_200.name = AAZStrType() + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + + properties = cls._schema_on_200.properties + properties.metadata = AAZObjectType() + properties.spec = AAZObjectType() + properties.status = AAZObjectType() + + metadata = cls._schema_on_200.properties.metadata + metadata.created_timestamp = AAZStrType( + serialized_name="createdTimestamp", + ) + metadata.deleted_timestamp = AAZStrType( + serialized_name="deletedTimestamp", + ) + metadata.resource_name = AAZStrType( + serialized_name="resourceName", + ) + metadata.self = AAZStrType() + metadata.updated_timestamp = AAZStrType( + serialized_name="updatedTimestamp", + ) + + spec = cls._schema_on_200.properties.spec + spec.api_endpoint = AAZStrType( + serialized_name="apiEndpoint", + ) + spec.availability = AAZStrType() + spec.byok = AAZObjectType() + spec.cloud = AAZStrType() + spec.config = AAZObjectType() + spec.environment = AAZObjectType() + _ShowHelper._build_schema_sc_cluster_network_environment_entity_read(spec.environment) + spec.http_endpoint = AAZStrType( + serialized_name="httpEndpoint", + ) + spec.kafka_bootstrap_endpoint = AAZStrType( + serialized_name="kafkaBootstrapEndpoint", + ) + spec.name = AAZStrType() + spec.network = AAZObjectType() + _ShowHelper._build_schema_sc_cluster_network_environment_entity_read(spec.network) + spec.region = AAZStrType() + spec.zone = AAZStrType() + + byok = cls._schema_on_200.properties.spec.byok + byok.id = AAZStrType() + byok.related = AAZStrType() + byok.resource_name = AAZStrType( + serialized_name="resourceName", + ) + + config = cls._schema_on_200.properties.spec.config + config.kind = AAZStrType() + + status = cls._schema_on_200.properties.status + status.cku = AAZIntType() + status.phase = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + _schema_sc_cluster_network_environment_entity_read = None + + @classmethod + def _build_schema_sc_cluster_network_environment_entity_read(cls, _schema): + if cls._schema_sc_cluster_network_environment_entity_read is not None: + _schema.environment = cls._schema_sc_cluster_network_environment_entity_read.environment + _schema.id = cls._schema_sc_cluster_network_environment_entity_read.id + _schema.related = cls._schema_sc_cluster_network_environment_entity_read.related + _schema.resource_name = cls._schema_sc_cluster_network_environment_entity_read.resource_name + return + + cls._schema_sc_cluster_network_environment_entity_read = _schema_sc_cluster_network_environment_entity_read = AAZObjectType() + + sc_cluster_network_environment_entity_read = _schema_sc_cluster_network_environment_entity_read + sc_cluster_network_environment_entity_read.environment = AAZStrType() + sc_cluster_network_environment_entity_read.id = AAZStrType() + sc_cluster_network_environment_entity_read.related = AAZStrType() + sc_cluster_network_environment_entity_read.resource_name = AAZStrType( + serialized_name="resourceName", + ) + + _schema.environment = cls._schema_sc_cluster_network_environment_entity_read.environment + _schema.id = cls._schema_sc_cluster_network_environment_entity_read.id + _schema.related = cls._schema_sc_cluster_network_environment_entity_read.related + _schema.resource_name = cls._schema_sc_cluster_network_environment_entity_read.resource_name + + +__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/connector/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/connector/__cmd_group.py new file mode 100644 index 00000000000..1561045402f --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/connector/__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( + "confluent organization environment cluster connector", +) +class __CMDGroup(AAZCommandGroup): + """Manage Connector + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/connector/__init__.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/connector/__init__.py new file mode 100644 index 00000000000..c401f439385 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/connector/__init__.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/connector/_create.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/connector/_create.py new file mode 100644 index 00000000000..f13b5d24d90 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/connector/_create.py @@ -0,0 +1,1083 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization environment cluster connector create", +) +class Create(AAZCommand): + """Create confluent connector by Name + """ + + _aaz_info = { + "version": "2024-07-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/environments/{}/clusters/{}/connectors/{}", "2024-07-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.cluster_id = AAZStrArg( + options=["--cluster-id"], + help="Confluent kafka or schema registry cluster id", + required=True, + ) + _args_schema.connector_name = AAZStrArg( + options=["-n", "--name", "--connector-name"], + help="Confluent connector name", + required=True, + ) + _args_schema.environment_id = AAZStrArg( + options=["--environment-id"], + help="Confluent environment id", + required=True, + ) + _args_schema.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.connector_basic_info = AAZObjectArg( + options=["--connector-basic-info"], + arg_group="Properties", + help="Connector Info Base", + ) + _args_schema.connector_service_type_info = AAZObjectArg( + options=["--connector-service-type-info"], + arg_group="Properties", + help="Connector Service type info base properties.", + ) + _args_schema.partner_connector_info = AAZObjectArg( + options=["--partner-connector-info"], + arg_group="Properties", + help="The connection information consumed by applications.", + ) + + connector_basic_info = cls._args_schema.connector_basic_info + connector_basic_info.connector_class = AAZStrArg( + options=["connector-class"], + help="Connector Class", + enum={"AZUREBLOBSINK": "AZUREBLOBSINK", "AZUREBLOBSOURCE": "AZUREBLOBSOURCE"}, + ) + connector_basic_info.connector_id = AAZStrArg( + options=["connector-id"], + help="Connector Id", + ) + connector_basic_info.connector_name = AAZStrArg( + options=["connector-name"], + help="Connector Name", + ) + connector_basic_info.connector_state = AAZStrArg( + options=["connector-state"], + help="Connector Status", + enum={"FAILED": "FAILED", "PAUSED": "PAUSED", "PROVISIONING": "PROVISIONING", "RUNNING": "RUNNING"}, + ) + connector_basic_info.connector_type = AAZStrArg( + options=["connector-type"], + help="Connector Type", + enum={"SINK": "SINK", "SOURCE": "SOURCE"}, + ) + + connector_service_type_info = cls._args_schema.connector_service_type_info + connector_service_type_info.azure_blob_storage_sink_connector = AAZObjectArg( + options=["azure-blob-storage-sink-connector"], + ) + connector_service_type_info.azure_blob_storage_source_connector = AAZObjectArg( + options=["azure-blob-storage-source-connector"], + ) + connector_service_type_info.azure_cosmos_db_sink_connector = AAZObjectArg( + options=["azure-cosmos-db-sink-connector"], + ) + connector_service_type_info.azure_cosmos_db_source_connector = AAZObjectArg( + options=["azure-cosmos-db-source-connector"], + ) + connector_service_type_info.azure_synapse_analytics_sink_connector = AAZObjectArg( + options=["azure-synapse-analytics-sink-connector"], + ) + + azure_blob_storage_sink_connector = cls._args_schema.connector_service_type_info.azure_blob_storage_sink_connector + azure_blob_storage_sink_connector.storage_account_key = AAZStrArg( + options=["storage-account-key"], + help="Azure Blob Storage Account Key", + ) + azure_blob_storage_sink_connector.storage_account_name = AAZStrArg( + options=["storage-account-name"], + help="Azure Blob Storage Account Name", + ) + azure_blob_storage_sink_connector.storage_container_name = AAZStrArg( + options=["storage-container-name"], + help="Azure Blob Storage Account Container Name", + ) + + azure_blob_storage_source_connector = cls._args_schema.connector_service_type_info.azure_blob_storage_source_connector + azure_blob_storage_source_connector.storage_account_key = AAZStrArg( + options=["storage-account-key"], + help="Azure Blob Storage Account Key", + ) + azure_blob_storage_source_connector.storage_account_name = AAZStrArg( + options=["storage-account-name"], + help="Azure Blob Storage Account Name", + ) + azure_blob_storage_source_connector.storage_container_name = AAZStrArg( + options=["storage-container-name"], + help="Azure Blob Storage Account Container Name", + ) + + azure_cosmos_db_sink_connector = cls._args_schema.connector_service_type_info.azure_cosmos_db_sink_connector + azure_cosmos_db_sink_connector.cosmos_connection_endpoint = AAZStrArg( + options=["cosmos-connection-endpoint"], + help="Azure Cosmos Database Connection Endpoint", + ) + azure_cosmos_db_sink_connector.cosmos_containers_topic_mapping = AAZStrArg( + options=["cosmos-containers-topic-mapping"], + help="Azure Cosmos Database Containers Topic Mapping", + ) + azure_cosmos_db_sink_connector.cosmos_database_name = AAZStrArg( + options=["cosmos-database-name"], + help="Azure Cosmos Database Name", + ) + azure_cosmos_db_sink_connector.cosmos_id_strategy = AAZStrArg( + options=["cosmos-id-strategy"], + help="Azure Cosmos Database Id Strategy", + ) + azure_cosmos_db_sink_connector.cosmos_master_key = AAZStrArg( + options=["cosmos-master-key"], + help="Azure Cosmos Database Master Key", + ) + + azure_cosmos_db_source_connector = cls._args_schema.connector_service_type_info.azure_cosmos_db_source_connector + azure_cosmos_db_source_connector.cosmos_connection_endpoint = AAZStrArg( + options=["cosmos-connection-endpoint"], + help="Azure Cosmos Database Connection Endpoint", + ) + azure_cosmos_db_source_connector.cosmos_containers_topic_mapping = AAZStrArg( + options=["cosmos-containers-topic-mapping"], + help="Azure Cosmos Database Containers Topic Mapping", + ) + azure_cosmos_db_source_connector.cosmos_database_name = AAZStrArg( + options=["cosmos-database-name"], + help="Azure Cosmos Database Name", + ) + azure_cosmos_db_source_connector.cosmos_master_key = AAZStrArg( + options=["cosmos-master-key"], + help="Azure Cosmos Database Master Key", + ) + azure_cosmos_db_source_connector.cosmos_message_key_enabled = AAZBoolArg( + options=["cosmos-message-key-enabled"], + help="Azure Cosmos Database Message Key Enabled", + ) + azure_cosmos_db_source_connector.cosmos_message_key_field = AAZStrArg( + options=["cosmos-message-key-field"], + help="Azure Cosmos Database Message Key Field", + ) + + azure_synapse_analytics_sink_connector = cls._args_schema.connector_service_type_info.azure_synapse_analytics_sink_connector + azure_synapse_analytics_sink_connector.synapse_sql_database_name = AAZStrArg( + options=["synapse-sql-database-name"], + help="Azure Synapse Dedicated SQL Pool Database Name", + ) + azure_synapse_analytics_sink_connector.synapse_sql_password = AAZStrArg( + options=["synapse-sql-password"], + help="Azure Synapse SQL login details", + ) + azure_synapse_analytics_sink_connector.synapse_sql_server_name = AAZStrArg( + options=["synapse-sql-server-name"], + help="Azure Synapse Analytics SQL Server Name", + ) + azure_synapse_analytics_sink_connector.synapse_sql_user = AAZStrArg( + options=["synapse-sql-user"], + help="Azure Synapse SQL login details", + ) + + partner_connector_info = cls._args_schema.partner_connector_info + partner_connector_info.kafka_azure_blob_storage_sink = AAZObjectArg( + options=["kafka-azure-blob-storage-sink"], + ) + partner_connector_info.kafka_azure_blob_storage_source = AAZObjectArg( + options=["kafka-azure-blob-storage-source"], + ) + partner_connector_info.kafka_azure_cosmos_db_sink = AAZObjectArg( + options=["kafka-azure-cosmos-db-sink"], + ) + partner_connector_info.kafka_azure_cosmos_db_source = AAZObjectArg( + options=["kafka-azure-cosmos-db-source"], + ) + partner_connector_info.kafka_azure_synapse_analytics_sink = AAZObjectArg( + options=["kafka-azure-synapse-analytics-sink"], + ) + + kafka_azure_blob_storage_sink = cls._args_schema.partner_connector_info.kafka_azure_blob_storage_sink + kafka_azure_blob_storage_sink.api_key = AAZStrArg( + options=["api-key"], + help="Kafka API Key", + ) + kafka_azure_blob_storage_sink.api_secret = AAZStrArg( + options=["api-secret"], + help="Kafka API Key Secret", + ) + kafka_azure_blob_storage_sink.auth_type = AAZStrArg( + options=["auth-type"], + help="Kafka Auth Type", + enum={"KAFKA_API_KEY": "KAFKA_API_KEY", "SERVICE_ACCOUNT": "SERVICE_ACCOUNT"}, + ) + kafka_azure_blob_storage_sink.flush_size = AAZStrArg( + options=["flush-size"], + help="Flush size", + ) + kafka_azure_blob_storage_sink.input_format = AAZStrArg( + options=["input-format"], + help="Kafka Input Data Format Type", + enum={"AVRO": "AVRO", "BYTES": "BYTES", "JSON": "JSON", "PROTOBUF": "PROTOBUF", "STRING": "STRING"}, + ) + kafka_azure_blob_storage_sink.max_tasks = AAZStrArg( + options=["max-tasks"], + help="Maximum Tasks", + ) + kafka_azure_blob_storage_sink.output_format = AAZStrArg( + options=["output-format"], + help="Kafka Output Data Format Type", + enum={"AVRO": "AVRO", "BYTES": "BYTES", "JSON": "JSON", "PROTOBUF": "PROTOBUF", "STRING": "STRING"}, + ) + kafka_azure_blob_storage_sink.service_account_id = AAZStrArg( + options=["service-account-id"], + help="Kafka Service Account Id", + ) + kafka_azure_blob_storage_sink.time_interval = AAZStrArg( + options=["time-interval"], + help="Time Interval", + ) + kafka_azure_blob_storage_sink.topics = AAZListArg( + options=["topics"], + help="Kafka topics list", + ) + kafka_azure_blob_storage_sink.topics_dir = AAZStrArg( + options=["topics-dir"], + help="Kafka topics directory", + ) + + topics = cls._args_schema.partner_connector_info.kafka_azure_blob_storage_sink.topics + topics.Element = AAZStrArg() + + kafka_azure_blob_storage_source = cls._args_schema.partner_connector_info.kafka_azure_blob_storage_source + kafka_azure_blob_storage_source.api_key = AAZStrArg( + options=["api-key"], + help="Kafka API Key", + ) + kafka_azure_blob_storage_source.api_secret = AAZStrArg( + options=["api-secret"], + help="Kafka API Secret", + ) + kafka_azure_blob_storage_source.auth_type = AAZStrArg( + options=["auth-type"], + help="Kafka Auth Type", + enum={"KAFKA_API_KEY": "KAFKA_API_KEY", "SERVICE_ACCOUNT": "SERVICE_ACCOUNT"}, + ) + kafka_azure_blob_storage_source.input_format = AAZStrArg( + options=["input-format"], + help="Kafka Input Data Format Type", + enum={"AVRO": "AVRO", "BYTES": "BYTES", "JSON": "JSON", "PROTOBUF": "PROTOBUF", "STRING": "STRING"}, + ) + kafka_azure_blob_storage_source.max_tasks = AAZStrArg( + options=["max-tasks"], + help="Maximum Tasks", + ) + kafka_azure_blob_storage_source.output_format = AAZStrArg( + options=["output-format"], + help="Kafka Output Data Format Type", + enum={"AVRO": "AVRO", "BYTES": "BYTES", "JSON": "JSON", "PROTOBUF": "PROTOBUF", "STRING": "STRING"}, + ) + kafka_azure_blob_storage_source.service_account_id = AAZStrArg( + options=["service-account-id"], + help="Kafka Service Account Id", + ) + kafka_azure_blob_storage_source.topic_regex = AAZStrArg( + options=["topic-regex"], + help="Kafka topics Regex pattern", + ) + kafka_azure_blob_storage_source.topics_dir = AAZStrArg( + options=["topics-dir"], + help="Kafka topics directory", + ) + + kafka_azure_cosmos_db_sink = cls._args_schema.partner_connector_info.kafka_azure_cosmos_db_sink + kafka_azure_cosmos_db_sink.api_key = AAZStrArg( + options=["api-key"], + help="Kafka API Key", + ) + kafka_azure_cosmos_db_sink.api_secret = AAZStrArg( + options=["api-secret"], + help="Kafka API Key Secret", + ) + kafka_azure_cosmos_db_sink.auth_type = AAZStrArg( + options=["auth-type"], + help="Kafka Auth Type", + enum={"KAFKA_API_KEY": "KAFKA_API_KEY", "SERVICE_ACCOUNT": "SERVICE_ACCOUNT"}, + ) + kafka_azure_cosmos_db_sink.flush_size = AAZStrArg( + options=["flush-size"], + help="Flush size", + ) + kafka_azure_cosmos_db_sink.input_format = AAZStrArg( + options=["input-format"], + help="Kafka Input Data Format Type", + enum={"AVRO": "AVRO", "BYTES": "BYTES", "JSON": "JSON", "PROTOBUF": "PROTOBUF", "STRING": "STRING"}, + ) + kafka_azure_cosmos_db_sink.max_tasks = AAZStrArg( + options=["max-tasks"], + help="Maximum Tasks", + ) + kafka_azure_cosmos_db_sink.output_format = AAZStrArg( + options=["output-format"], + help="Kafka Output Data Format Type", + enum={"AVRO": "AVRO", "BYTES": "BYTES", "JSON": "JSON", "PROTOBUF": "PROTOBUF", "STRING": "STRING"}, + ) + kafka_azure_cosmos_db_sink.service_account_id = AAZStrArg( + options=["service-account-id"], + help="Kafka Service Account Id", + ) + kafka_azure_cosmos_db_sink.time_interval = AAZStrArg( + options=["time-interval"], + help="Time Interval", + ) + kafka_azure_cosmos_db_sink.topics = AAZListArg( + options=["topics"], + help="Kafka topics list", + ) + kafka_azure_cosmos_db_sink.topics_dir = AAZStrArg( + options=["topics-dir"], + help="Kafka topics directory", + ) + + topics = cls._args_schema.partner_connector_info.kafka_azure_cosmos_db_sink.topics + topics.Element = AAZStrArg() + + kafka_azure_cosmos_db_source = cls._args_schema.partner_connector_info.kafka_azure_cosmos_db_source + kafka_azure_cosmos_db_source.api_key = AAZStrArg( + options=["api-key"], + help="Kafka API Key", + ) + kafka_azure_cosmos_db_source.api_secret = AAZStrArg( + options=["api-secret"], + help="Kafka API Secret", + ) + kafka_azure_cosmos_db_source.auth_type = AAZStrArg( + options=["auth-type"], + help="Kafka Auth Type", + enum={"KAFKA_API_KEY": "KAFKA_API_KEY", "SERVICE_ACCOUNT": "SERVICE_ACCOUNT"}, + ) + kafka_azure_cosmos_db_source.input_format = AAZStrArg( + options=["input-format"], + help="Kafka Input Data Format Type", + enum={"AVRO": "AVRO", "BYTES": "BYTES", "JSON": "JSON", "PROTOBUF": "PROTOBUF", "STRING": "STRING"}, + ) + kafka_azure_cosmos_db_source.max_tasks = AAZStrArg( + options=["max-tasks"], + help="Maximum Tasks", + ) + kafka_azure_cosmos_db_source.output_format = AAZStrArg( + options=["output-format"], + help="Kafka Output Data Format Type", + enum={"AVRO": "AVRO", "BYTES": "BYTES", "JSON": "JSON", "PROTOBUF": "PROTOBUF", "STRING": "STRING"}, + ) + kafka_azure_cosmos_db_source.service_account_id = AAZStrArg( + options=["service-account-id"], + help="Kafka Service Account Id", + ) + kafka_azure_cosmos_db_source.topic_regex = AAZStrArg( + options=["topic-regex"], + help="Kafka topics Regex pattern", + ) + kafka_azure_cosmos_db_source.topics_dir = AAZStrArg( + options=["topics-dir"], + help="Kafka topics directory", + ) + + kafka_azure_synapse_analytics_sink = cls._args_schema.partner_connector_info.kafka_azure_synapse_analytics_sink + kafka_azure_synapse_analytics_sink.api_key = AAZStrArg( + options=["api-key"], + help="Kafka API Key", + ) + kafka_azure_synapse_analytics_sink.api_secret = AAZStrArg( + options=["api-secret"], + help="Kafka API Key Secret", + ) + kafka_azure_synapse_analytics_sink.auth_type = AAZStrArg( + options=["auth-type"], + help="Kafka Auth Type", + enum={"KAFKA_API_KEY": "KAFKA_API_KEY", "SERVICE_ACCOUNT": "SERVICE_ACCOUNT"}, + ) + kafka_azure_synapse_analytics_sink.flush_size = AAZStrArg( + options=["flush-size"], + help="Flush size", + ) + kafka_azure_synapse_analytics_sink.input_format = AAZStrArg( + options=["input-format"], + help="Kafka Input Data Format Type", + enum={"AVRO": "AVRO", "BYTES": "BYTES", "JSON": "JSON", "PROTOBUF": "PROTOBUF", "STRING": "STRING"}, + ) + kafka_azure_synapse_analytics_sink.max_tasks = AAZStrArg( + options=["max-tasks"], + help="Maximum Tasks", + ) + kafka_azure_synapse_analytics_sink.output_format = AAZStrArg( + options=["output-format"], + help="Kafka Output Data Format Type", + enum={"AVRO": "AVRO", "BYTES": "BYTES", "JSON": "JSON", "PROTOBUF": "PROTOBUF", "STRING": "STRING"}, + ) + kafka_azure_synapse_analytics_sink.service_account_id = AAZStrArg( + options=["service-account-id"], + help="Kafka Service Account Id", + ) + kafka_azure_synapse_analytics_sink.time_interval = AAZStrArg( + options=["time-interval"], + help="Time Interval", + ) + kafka_azure_synapse_analytics_sink.topics = AAZListArg( + options=["topics"], + help="Kafka topics list", + ) + kafka_azure_synapse_analytics_sink.topics_dir = AAZStrArg( + options=["topics-dir"], + help="Kafka topics directory", + ) + + topics = cls._args_schema.partner_connector_info.kafka_azure_synapse_analytics_sink.topics + topics.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConnectorCreateOrUpdate(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 ConnectorCreateOrUpdate(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.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/connectors/{connectorName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterId", self.ctx.args.cluster_id, + required=True, + ), + **self.serialize_url_param( + "connectorName", self.ctx.args.connector_name, + required=True, + ), + **self.serialize_url_param( + "environmentId", self.ctx.args.environment_id, + required=True, + ), + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-07-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": {"client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("connectorBasicInfo", AAZObjectType, ".connector_basic_info") + properties.set_prop("connectorServiceTypeInfo", AAZObjectType, ".connector_service_type_info") + properties.set_prop("partnerConnectorInfo", AAZObjectType, ".partner_connector_info") + + connector_basic_info = _builder.get(".properties.connectorBasicInfo") + if connector_basic_info is not None: + connector_basic_info.set_prop("connectorClass", AAZStrType, ".connector_class") + connector_basic_info.set_prop("connectorId", AAZStrType, ".connector_id") + connector_basic_info.set_prop("connectorName", AAZStrType, ".connector_name") + connector_basic_info.set_prop("connectorState", AAZStrType, ".connector_state") + connector_basic_info.set_prop("connectorType", AAZStrType, ".connector_type") + + connector_service_type_info = _builder.get(".properties.connectorServiceTypeInfo") + if connector_service_type_info is not None: + connector_service_type_info.set_const("connectorServiceType", "AzureBlobStorageSinkConnector", AAZStrType, ".azure_blob_storage_sink_connector", typ_kwargs={"flags": {"required": True}}) + connector_service_type_info.set_const("connectorServiceType", "AzureBlobStorageSourceConnector", AAZStrType, ".azure_blob_storage_source_connector", typ_kwargs={"flags": {"required": True}}) + connector_service_type_info.set_const("connectorServiceType", "AzureCosmosDBSinkConnector", AAZStrType, ".azure_cosmos_db_sink_connector", typ_kwargs={"flags": {"required": True}}) + connector_service_type_info.set_const("connectorServiceType", "AzureCosmosDBSourceConnector", AAZStrType, ".azure_cosmos_db_source_connector", typ_kwargs={"flags": {"required": True}}) + connector_service_type_info.set_const("connectorServiceType", "AzureSynapseAnalyticsSinkConnector", AAZStrType, ".azure_synapse_analytics_sink_connector", typ_kwargs={"flags": {"required": True}}) + connector_service_type_info.discriminate_by("connectorServiceType", "AzureBlobStorageSinkConnector") + connector_service_type_info.discriminate_by("connectorServiceType", "AzureBlobStorageSourceConnector") + connector_service_type_info.discriminate_by("connectorServiceType", "AzureCosmosDBSinkConnector") + connector_service_type_info.discriminate_by("connectorServiceType", "AzureCosmosDBSourceConnector") + connector_service_type_info.discriminate_by("connectorServiceType", "AzureSynapseAnalyticsSinkConnector") + + disc_azure_blob_storage_sink_connector = _builder.get(".properties.connectorServiceTypeInfo{connectorServiceType:AzureBlobStorageSinkConnector}") + if disc_azure_blob_storage_sink_connector is not None: + disc_azure_blob_storage_sink_connector.set_prop("storageAccountKey", AAZStrType, ".azure_blob_storage_sink_connector.storage_account_key") + disc_azure_blob_storage_sink_connector.set_prop("storageAccountName", AAZStrType, ".azure_blob_storage_sink_connector.storage_account_name") + disc_azure_blob_storage_sink_connector.set_prop("storageContainerName", AAZStrType, ".azure_blob_storage_sink_connector.storage_container_name") + + disc_azure_blob_storage_source_connector = _builder.get(".properties.connectorServiceTypeInfo{connectorServiceType:AzureBlobStorageSourceConnector}") + if disc_azure_blob_storage_source_connector is not None: + disc_azure_blob_storage_source_connector.set_prop("storageAccountKey", AAZStrType, ".azure_blob_storage_source_connector.storage_account_key", typ_kwargs={"flags": {"secret": True}}) + disc_azure_blob_storage_source_connector.set_prop("storageAccountName", AAZStrType, ".azure_blob_storage_source_connector.storage_account_name") + disc_azure_blob_storage_source_connector.set_prop("storageContainerName", AAZStrType, ".azure_blob_storage_source_connector.storage_container_name") + + disc_azure_cosmos_db_sink_connector = _builder.get(".properties.connectorServiceTypeInfo{connectorServiceType:AzureCosmosDBSinkConnector}") + if disc_azure_cosmos_db_sink_connector is not None: + disc_azure_cosmos_db_sink_connector.set_prop("cosmosConnectionEndpoint", AAZStrType, ".azure_cosmos_db_sink_connector.cosmos_connection_endpoint") + disc_azure_cosmos_db_sink_connector.set_prop("cosmosContainersTopicMapping", AAZStrType, ".azure_cosmos_db_sink_connector.cosmos_containers_topic_mapping") + disc_azure_cosmos_db_sink_connector.set_prop("cosmosDatabaseName", AAZStrType, ".azure_cosmos_db_sink_connector.cosmos_database_name") + disc_azure_cosmos_db_sink_connector.set_prop("cosmosIdStrategy", AAZStrType, ".azure_cosmos_db_sink_connector.cosmos_id_strategy") + disc_azure_cosmos_db_sink_connector.set_prop("cosmosMasterKey", AAZStrType, ".azure_cosmos_db_sink_connector.cosmos_master_key") + + disc_azure_cosmos_db_source_connector = _builder.get(".properties.connectorServiceTypeInfo{connectorServiceType:AzureCosmosDBSourceConnector}") + if disc_azure_cosmos_db_source_connector is not None: + disc_azure_cosmos_db_source_connector.set_prop("cosmosConnectionEndpoint", AAZStrType, ".azure_cosmos_db_source_connector.cosmos_connection_endpoint") + disc_azure_cosmos_db_source_connector.set_prop("cosmosContainersTopicMapping", AAZStrType, ".azure_cosmos_db_source_connector.cosmos_containers_topic_mapping") + disc_azure_cosmos_db_source_connector.set_prop("cosmosDatabaseName", AAZStrType, ".azure_cosmos_db_source_connector.cosmos_database_name") + disc_azure_cosmos_db_source_connector.set_prop("cosmosMasterKey", AAZStrType, ".azure_cosmos_db_source_connector.cosmos_master_key") + disc_azure_cosmos_db_source_connector.set_prop("cosmosMessageKeyEnabled", AAZBoolType, ".azure_cosmos_db_source_connector.cosmos_message_key_enabled") + disc_azure_cosmos_db_source_connector.set_prop("cosmosMessageKeyField", AAZStrType, ".azure_cosmos_db_source_connector.cosmos_message_key_field") + + disc_azure_synapse_analytics_sink_connector = _builder.get(".properties.connectorServiceTypeInfo{connectorServiceType:AzureSynapseAnalyticsSinkConnector}") + if disc_azure_synapse_analytics_sink_connector is not None: + disc_azure_synapse_analytics_sink_connector.set_prop("synapseSqlDatabaseName", AAZStrType, ".azure_synapse_analytics_sink_connector.synapse_sql_database_name") + disc_azure_synapse_analytics_sink_connector.set_prop("synapseSqlPassword", AAZStrType, ".azure_synapse_analytics_sink_connector.synapse_sql_password") + disc_azure_synapse_analytics_sink_connector.set_prop("synapseSqlServerName", AAZStrType, ".azure_synapse_analytics_sink_connector.synapse_sql_server_name") + disc_azure_synapse_analytics_sink_connector.set_prop("synapseSqlUser", AAZStrType, ".azure_synapse_analytics_sink_connector.synapse_sql_user") + + partner_connector_info = _builder.get(".properties.partnerConnectorInfo") + if partner_connector_info is not None: + partner_connector_info.set_const("partnerConnectorType", "KafkaAzureBlobStorageSink", AAZStrType, ".kafka_azure_blob_storage_sink", typ_kwargs={"flags": {"required": True}}) + partner_connector_info.set_const("partnerConnectorType", "KafkaAzureBlobStorageSource", AAZStrType, ".kafka_azure_blob_storage_source", typ_kwargs={"flags": {"required": True}}) + partner_connector_info.set_const("partnerConnectorType", "KafkaAzureCosmosDBSink", AAZStrType, ".kafka_azure_cosmos_db_sink", typ_kwargs={"flags": {"required": True}}) + partner_connector_info.set_const("partnerConnectorType", "KafkaAzureCosmosDBSource", AAZStrType, ".kafka_azure_cosmos_db_source", typ_kwargs={"flags": {"required": True}}) + partner_connector_info.set_const("partnerConnectorType", "KafkaAzureSynapseAnalyticsSink", AAZStrType, ".kafka_azure_synapse_analytics_sink", typ_kwargs={"flags": {"required": True}}) + partner_connector_info.discriminate_by("partnerConnectorType", "KafkaAzureBlobStorageSink") + partner_connector_info.discriminate_by("partnerConnectorType", "KafkaAzureBlobStorageSource") + partner_connector_info.discriminate_by("partnerConnectorType", "KafkaAzureCosmosDBSink") + partner_connector_info.discriminate_by("partnerConnectorType", "KafkaAzureCosmosDBSource") + partner_connector_info.discriminate_by("partnerConnectorType", "KafkaAzureSynapseAnalyticsSink") + + disc_kafka_azure_blob_storage_sink = _builder.get(".properties.partnerConnectorInfo{partnerConnectorType:KafkaAzureBlobStorageSink}") + if disc_kafka_azure_blob_storage_sink is not None: + disc_kafka_azure_blob_storage_sink.set_prop("apiKey", AAZStrType, ".kafka_azure_blob_storage_sink.api_key") + disc_kafka_azure_blob_storage_sink.set_prop("apiSecret", AAZStrType, ".kafka_azure_blob_storage_sink.api_secret") + disc_kafka_azure_blob_storage_sink.set_prop("authType", AAZStrType, ".kafka_azure_blob_storage_sink.auth_type") + disc_kafka_azure_blob_storage_sink.set_prop("flushSize", AAZStrType, ".kafka_azure_blob_storage_sink.flush_size") + disc_kafka_azure_blob_storage_sink.set_prop("inputFormat", AAZStrType, ".kafka_azure_blob_storage_sink.input_format") + disc_kafka_azure_blob_storage_sink.set_prop("maxTasks", AAZStrType, ".kafka_azure_blob_storage_sink.max_tasks") + disc_kafka_azure_blob_storage_sink.set_prop("outputFormat", AAZStrType, ".kafka_azure_blob_storage_sink.output_format") + disc_kafka_azure_blob_storage_sink.set_prop("serviceAccountId", AAZStrType, ".kafka_azure_blob_storage_sink.service_account_id") + disc_kafka_azure_blob_storage_sink.set_prop("timeInterval", AAZStrType, ".kafka_azure_blob_storage_sink.time_interval") + disc_kafka_azure_blob_storage_sink.set_prop("topics", AAZListType, ".kafka_azure_blob_storage_sink.topics") + disc_kafka_azure_blob_storage_sink.set_prop("topicsDir", AAZStrType, ".kafka_azure_blob_storage_sink.topics_dir") + + topics = _builder.get(".properties.partnerConnectorInfo{partnerConnectorType:KafkaAzureBlobStorageSink}.topics") + if topics is not None: + topics.set_elements(AAZStrType, ".") + + disc_kafka_azure_blob_storage_source = _builder.get(".properties.partnerConnectorInfo{partnerConnectorType:KafkaAzureBlobStorageSource}") + if disc_kafka_azure_blob_storage_source is not None: + disc_kafka_azure_blob_storage_source.set_prop("apiKey", AAZStrType, ".kafka_azure_blob_storage_source.api_key") + disc_kafka_azure_blob_storage_source.set_prop("apiSecret", AAZStrType, ".kafka_azure_blob_storage_source.api_secret", typ_kwargs={"flags": {"secret": True}}) + disc_kafka_azure_blob_storage_source.set_prop("authType", AAZStrType, ".kafka_azure_blob_storage_source.auth_type") + disc_kafka_azure_blob_storage_source.set_prop("inputFormat", AAZStrType, ".kafka_azure_blob_storage_source.input_format") + disc_kafka_azure_blob_storage_source.set_prop("maxTasks", AAZStrType, ".kafka_azure_blob_storage_source.max_tasks") + disc_kafka_azure_blob_storage_source.set_prop("outputFormat", AAZStrType, ".kafka_azure_blob_storage_source.output_format") + disc_kafka_azure_blob_storage_source.set_prop("serviceAccountId", AAZStrType, ".kafka_azure_blob_storage_source.service_account_id") + disc_kafka_azure_blob_storage_source.set_prop("topicRegex", AAZStrType, ".kafka_azure_blob_storage_source.topic_regex") + disc_kafka_azure_blob_storage_source.set_prop("topicsDir", AAZStrType, ".kafka_azure_blob_storage_source.topics_dir") + + disc_kafka_azure_cosmos_db_sink = _builder.get(".properties.partnerConnectorInfo{partnerConnectorType:KafkaAzureCosmosDBSink}") + if disc_kafka_azure_cosmos_db_sink is not None: + disc_kafka_azure_cosmos_db_sink.set_prop("apiKey", AAZStrType, ".kafka_azure_cosmos_db_sink.api_key") + disc_kafka_azure_cosmos_db_sink.set_prop("apiSecret", AAZStrType, ".kafka_azure_cosmos_db_sink.api_secret") + disc_kafka_azure_cosmos_db_sink.set_prop("authType", AAZStrType, ".kafka_azure_cosmos_db_sink.auth_type") + disc_kafka_azure_cosmos_db_sink.set_prop("flushSize", AAZStrType, ".kafka_azure_cosmos_db_sink.flush_size") + disc_kafka_azure_cosmos_db_sink.set_prop("inputFormat", AAZStrType, ".kafka_azure_cosmos_db_sink.input_format") + disc_kafka_azure_cosmos_db_sink.set_prop("maxTasks", AAZStrType, ".kafka_azure_cosmos_db_sink.max_tasks") + disc_kafka_azure_cosmos_db_sink.set_prop("outputFormat", AAZStrType, ".kafka_azure_cosmos_db_sink.output_format") + disc_kafka_azure_cosmos_db_sink.set_prop("serviceAccountId", AAZStrType, ".kafka_azure_cosmos_db_sink.service_account_id") + disc_kafka_azure_cosmos_db_sink.set_prop("timeInterval", AAZStrType, ".kafka_azure_cosmos_db_sink.time_interval") + disc_kafka_azure_cosmos_db_sink.set_prop("topics", AAZListType, ".kafka_azure_cosmos_db_sink.topics") + disc_kafka_azure_cosmos_db_sink.set_prop("topicsDir", AAZStrType, ".kafka_azure_cosmos_db_sink.topics_dir") + + topics = _builder.get(".properties.partnerConnectorInfo{partnerConnectorType:KafkaAzureCosmosDBSink}.topics") + if topics is not None: + topics.set_elements(AAZStrType, ".") + + disc_kafka_azure_cosmos_db_source = _builder.get(".properties.partnerConnectorInfo{partnerConnectorType:KafkaAzureCosmosDBSource}") + if disc_kafka_azure_cosmos_db_source is not None: + disc_kafka_azure_cosmos_db_source.set_prop("apiKey", AAZStrType, ".kafka_azure_cosmos_db_source.api_key") + disc_kafka_azure_cosmos_db_source.set_prop("apiSecret", AAZStrType, ".kafka_azure_cosmos_db_source.api_secret", typ_kwargs={"flags": {"secret": True}}) + disc_kafka_azure_cosmos_db_source.set_prop("authType", AAZStrType, ".kafka_azure_cosmos_db_source.auth_type") + disc_kafka_azure_cosmos_db_source.set_prop("inputFormat", AAZStrType, ".kafka_azure_cosmos_db_source.input_format") + disc_kafka_azure_cosmos_db_source.set_prop("maxTasks", AAZStrType, ".kafka_azure_cosmos_db_source.max_tasks") + disc_kafka_azure_cosmos_db_source.set_prop("outputFormat", AAZStrType, ".kafka_azure_cosmos_db_source.output_format") + disc_kafka_azure_cosmos_db_source.set_prop("serviceAccountId", AAZStrType, ".kafka_azure_cosmos_db_source.service_account_id") + disc_kafka_azure_cosmos_db_source.set_prop("topicRegex", AAZStrType, ".kafka_azure_cosmos_db_source.topic_regex") + disc_kafka_azure_cosmos_db_source.set_prop("topicsDir", AAZStrType, ".kafka_azure_cosmos_db_source.topics_dir") + + disc_kafka_azure_synapse_analytics_sink = _builder.get(".properties.partnerConnectorInfo{partnerConnectorType:KafkaAzureSynapseAnalyticsSink}") + if disc_kafka_azure_synapse_analytics_sink is not None: + disc_kafka_azure_synapse_analytics_sink.set_prop("apiKey", AAZStrType, ".kafka_azure_synapse_analytics_sink.api_key") + disc_kafka_azure_synapse_analytics_sink.set_prop("apiSecret", AAZStrType, ".kafka_azure_synapse_analytics_sink.api_secret") + disc_kafka_azure_synapse_analytics_sink.set_prop("authType", AAZStrType, ".kafka_azure_synapse_analytics_sink.auth_type") + disc_kafka_azure_synapse_analytics_sink.set_prop("flushSize", AAZStrType, ".kafka_azure_synapse_analytics_sink.flush_size") + disc_kafka_azure_synapse_analytics_sink.set_prop("inputFormat", AAZStrType, ".kafka_azure_synapse_analytics_sink.input_format") + disc_kafka_azure_synapse_analytics_sink.set_prop("maxTasks", AAZStrType, ".kafka_azure_synapse_analytics_sink.max_tasks") + disc_kafka_azure_synapse_analytics_sink.set_prop("outputFormat", AAZStrType, ".kafka_azure_synapse_analytics_sink.output_format") + disc_kafka_azure_synapse_analytics_sink.set_prop("serviceAccountId", AAZStrType, ".kafka_azure_synapse_analytics_sink.service_account_id") + disc_kafka_azure_synapse_analytics_sink.set_prop("timeInterval", AAZStrType, ".kafka_azure_synapse_analytics_sink.time_interval") + disc_kafka_azure_synapse_analytics_sink.set_prop("topics", AAZListType, ".kafka_azure_synapse_analytics_sink.topics") + disc_kafka_azure_synapse_analytics_sink.set_prop("topicsDir", AAZStrType, ".kafka_azure_synapse_analytics_sink.topics_dir") + + topics = _builder.get(".properties.partnerConnectorInfo{partnerConnectorType:KafkaAzureSynapseAnalyticsSink}.topics") + if topics is not None: + topics.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( + flags={"required": True, "client_flatten": True}, + ) + _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.connector_basic_info = AAZObjectType( + serialized_name="connectorBasicInfo", + ) + properties.connector_service_type_info = AAZObjectType( + serialized_name="connectorServiceTypeInfo", + ) + properties.partner_connector_info = AAZObjectType( + serialized_name="partnerConnectorInfo", + ) + + connector_basic_info = cls._schema_on_200_201.properties.connector_basic_info + connector_basic_info.connector_class = AAZStrType( + serialized_name="connectorClass", + ) + connector_basic_info.connector_id = AAZStrType( + serialized_name="connectorId", + ) + connector_basic_info.connector_name = AAZStrType( + serialized_name="connectorName", + ) + connector_basic_info.connector_state = AAZStrType( + serialized_name="connectorState", + ) + connector_basic_info.connector_type = AAZStrType( + serialized_name="connectorType", + ) + + connector_service_type_info = cls._schema_on_200_201.properties.connector_service_type_info + connector_service_type_info.connector_service_type = AAZStrType( + serialized_name="connectorServiceType", + flags={"required": True}, + ) + + disc_azure_blob_storage_sink_connector = cls._schema_on_200_201.properties.connector_service_type_info.discriminate_by("connector_service_type", "AzureBlobStorageSinkConnector") + disc_azure_blob_storage_sink_connector.storage_account_key = AAZStrType( + serialized_name="storageAccountKey", + ) + disc_azure_blob_storage_sink_connector.storage_account_name = AAZStrType( + serialized_name="storageAccountName", + ) + disc_azure_blob_storage_sink_connector.storage_container_name = AAZStrType( + serialized_name="storageContainerName", + ) + + disc_azure_blob_storage_source_connector = cls._schema_on_200_201.properties.connector_service_type_info.discriminate_by("connector_service_type", "AzureBlobStorageSourceConnector") + disc_azure_blob_storage_source_connector.storage_account_key = AAZStrType( + serialized_name="storageAccountKey", + flags={"secret": True}, + ) + disc_azure_blob_storage_source_connector.storage_account_name = AAZStrType( + serialized_name="storageAccountName", + ) + disc_azure_blob_storage_source_connector.storage_container_name = AAZStrType( + serialized_name="storageContainerName", + ) + + disc_azure_cosmos_db_sink_connector = cls._schema_on_200_201.properties.connector_service_type_info.discriminate_by("connector_service_type", "AzureCosmosDBSinkConnector") + disc_azure_cosmos_db_sink_connector.cosmos_connection_endpoint = AAZStrType( + serialized_name="cosmosConnectionEndpoint", + ) + disc_azure_cosmos_db_sink_connector.cosmos_containers_topic_mapping = AAZStrType( + serialized_name="cosmosContainersTopicMapping", + ) + disc_azure_cosmos_db_sink_connector.cosmos_database_name = AAZStrType( + serialized_name="cosmosDatabaseName", + ) + disc_azure_cosmos_db_sink_connector.cosmos_id_strategy = AAZStrType( + serialized_name="cosmosIdStrategy", + ) + disc_azure_cosmos_db_sink_connector.cosmos_master_key = AAZStrType( + serialized_name="cosmosMasterKey", + ) + + disc_azure_cosmos_db_source_connector = cls._schema_on_200_201.properties.connector_service_type_info.discriminate_by("connector_service_type", "AzureCosmosDBSourceConnector") + disc_azure_cosmos_db_source_connector.cosmos_connection_endpoint = AAZStrType( + serialized_name="cosmosConnectionEndpoint", + ) + disc_azure_cosmos_db_source_connector.cosmos_containers_topic_mapping = AAZStrType( + serialized_name="cosmosContainersTopicMapping", + ) + disc_azure_cosmos_db_source_connector.cosmos_database_name = AAZStrType( + serialized_name="cosmosDatabaseName", + ) + disc_azure_cosmos_db_source_connector.cosmos_master_key = AAZStrType( + serialized_name="cosmosMasterKey", + ) + disc_azure_cosmos_db_source_connector.cosmos_message_key_enabled = AAZBoolType( + serialized_name="cosmosMessageKeyEnabled", + ) + disc_azure_cosmos_db_source_connector.cosmos_message_key_field = AAZStrType( + serialized_name="cosmosMessageKeyField", + ) + + disc_azure_synapse_analytics_sink_connector = cls._schema_on_200_201.properties.connector_service_type_info.discriminate_by("connector_service_type", "AzureSynapseAnalyticsSinkConnector") + disc_azure_synapse_analytics_sink_connector.synapse_sql_database_name = AAZStrType( + serialized_name="synapseSqlDatabaseName", + ) + disc_azure_synapse_analytics_sink_connector.synapse_sql_password = AAZStrType( + serialized_name="synapseSqlPassword", + ) + disc_azure_synapse_analytics_sink_connector.synapse_sql_server_name = AAZStrType( + serialized_name="synapseSqlServerName", + ) + disc_azure_synapse_analytics_sink_connector.synapse_sql_user = AAZStrType( + serialized_name="synapseSqlUser", + ) + + partner_connector_info = cls._schema_on_200_201.properties.partner_connector_info + partner_connector_info.partner_connector_type = AAZStrType( + serialized_name="partnerConnectorType", + flags={"required": True}, + ) + + disc_kafka_azure_blob_storage_sink = cls._schema_on_200_201.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureBlobStorageSink") + disc_kafka_azure_blob_storage_sink.api_key = AAZStrType( + serialized_name="apiKey", + ) + disc_kafka_azure_blob_storage_sink.api_secret = AAZStrType( + serialized_name="apiSecret", + ) + disc_kafka_azure_blob_storage_sink.auth_type = AAZStrType( + serialized_name="authType", + ) + disc_kafka_azure_blob_storage_sink.flush_size = AAZStrType( + serialized_name="flushSize", + ) + disc_kafka_azure_blob_storage_sink.input_format = AAZStrType( + serialized_name="inputFormat", + ) + disc_kafka_azure_blob_storage_sink.max_tasks = AAZStrType( + serialized_name="maxTasks", + ) + disc_kafka_azure_blob_storage_sink.output_format = AAZStrType( + serialized_name="outputFormat", + ) + disc_kafka_azure_blob_storage_sink.service_account_id = AAZStrType( + serialized_name="serviceAccountId", + ) + disc_kafka_azure_blob_storage_sink.time_interval = AAZStrType( + serialized_name="timeInterval", + ) + disc_kafka_azure_blob_storage_sink.topics = AAZListType() + disc_kafka_azure_blob_storage_sink.topics_dir = AAZStrType( + serialized_name="topicsDir", + ) + + topics = cls._schema_on_200_201.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureBlobStorageSink").topics + topics.Element = AAZStrType() + + disc_kafka_azure_blob_storage_source = cls._schema_on_200_201.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureBlobStorageSource") + disc_kafka_azure_blob_storage_source.api_key = AAZStrType( + serialized_name="apiKey", + ) + disc_kafka_azure_blob_storage_source.api_secret = AAZStrType( + serialized_name="apiSecret", + flags={"secret": True}, + ) + disc_kafka_azure_blob_storage_source.auth_type = AAZStrType( + serialized_name="authType", + ) + disc_kafka_azure_blob_storage_source.input_format = AAZStrType( + serialized_name="inputFormat", + ) + disc_kafka_azure_blob_storage_source.max_tasks = AAZStrType( + serialized_name="maxTasks", + ) + disc_kafka_azure_blob_storage_source.output_format = AAZStrType( + serialized_name="outputFormat", + ) + disc_kafka_azure_blob_storage_source.service_account_id = AAZStrType( + serialized_name="serviceAccountId", + ) + disc_kafka_azure_blob_storage_source.topic_regex = AAZStrType( + serialized_name="topicRegex", + ) + disc_kafka_azure_blob_storage_source.topics_dir = AAZStrType( + serialized_name="topicsDir", + ) + + disc_kafka_azure_cosmos_db_sink = cls._schema_on_200_201.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureCosmosDBSink") + disc_kafka_azure_cosmos_db_sink.api_key = AAZStrType( + serialized_name="apiKey", + ) + disc_kafka_azure_cosmos_db_sink.api_secret = AAZStrType( + serialized_name="apiSecret", + ) + disc_kafka_azure_cosmos_db_sink.auth_type = AAZStrType( + serialized_name="authType", + ) + disc_kafka_azure_cosmos_db_sink.flush_size = AAZStrType( + serialized_name="flushSize", + ) + disc_kafka_azure_cosmos_db_sink.input_format = AAZStrType( + serialized_name="inputFormat", + ) + disc_kafka_azure_cosmos_db_sink.max_tasks = AAZStrType( + serialized_name="maxTasks", + ) + disc_kafka_azure_cosmos_db_sink.output_format = AAZStrType( + serialized_name="outputFormat", + ) + disc_kafka_azure_cosmos_db_sink.service_account_id = AAZStrType( + serialized_name="serviceAccountId", + ) + disc_kafka_azure_cosmos_db_sink.time_interval = AAZStrType( + serialized_name="timeInterval", + ) + disc_kafka_azure_cosmos_db_sink.topics = AAZListType() + disc_kafka_azure_cosmos_db_sink.topics_dir = AAZStrType( + serialized_name="topicsDir", + ) + + topics = cls._schema_on_200_201.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureCosmosDBSink").topics + topics.Element = AAZStrType() + + disc_kafka_azure_cosmos_db_source = cls._schema_on_200_201.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureCosmosDBSource") + disc_kafka_azure_cosmos_db_source.api_key = AAZStrType( + serialized_name="apiKey", + ) + disc_kafka_azure_cosmos_db_source.api_secret = AAZStrType( + serialized_name="apiSecret", + flags={"secret": True}, + ) + disc_kafka_azure_cosmos_db_source.auth_type = AAZStrType( + serialized_name="authType", + ) + disc_kafka_azure_cosmos_db_source.input_format = AAZStrType( + serialized_name="inputFormat", + ) + disc_kafka_azure_cosmos_db_source.max_tasks = AAZStrType( + serialized_name="maxTasks", + ) + disc_kafka_azure_cosmos_db_source.output_format = AAZStrType( + serialized_name="outputFormat", + ) + disc_kafka_azure_cosmos_db_source.service_account_id = AAZStrType( + serialized_name="serviceAccountId", + ) + disc_kafka_azure_cosmos_db_source.topic_regex = AAZStrType( + serialized_name="topicRegex", + ) + disc_kafka_azure_cosmos_db_source.topics_dir = AAZStrType( + serialized_name="topicsDir", + ) + + disc_kafka_azure_synapse_analytics_sink = cls._schema_on_200_201.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureSynapseAnalyticsSink") + disc_kafka_azure_synapse_analytics_sink.api_key = AAZStrType( + serialized_name="apiKey", + ) + disc_kafka_azure_synapse_analytics_sink.api_secret = AAZStrType( + serialized_name="apiSecret", + ) + disc_kafka_azure_synapse_analytics_sink.auth_type = AAZStrType( + serialized_name="authType", + ) + disc_kafka_azure_synapse_analytics_sink.flush_size = AAZStrType( + serialized_name="flushSize", + ) + disc_kafka_azure_synapse_analytics_sink.input_format = AAZStrType( + serialized_name="inputFormat", + ) + disc_kafka_azure_synapse_analytics_sink.max_tasks = AAZStrType( + serialized_name="maxTasks", + ) + disc_kafka_azure_synapse_analytics_sink.output_format = AAZStrType( + serialized_name="outputFormat", + ) + disc_kafka_azure_synapse_analytics_sink.service_account_id = AAZStrType( + serialized_name="serviceAccountId", + ) + disc_kafka_azure_synapse_analytics_sink.time_interval = AAZStrType( + serialized_name="timeInterval", + ) + disc_kafka_azure_synapse_analytics_sink.topics = AAZListType() + disc_kafka_azure_synapse_analytics_sink.topics_dir = AAZStrType( + serialized_name="topicsDir", + ) + + topics = cls._schema_on_200_201.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureSynapseAnalyticsSink").topics + topics.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/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/connector/_delete.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/connector/_delete.py new file mode 100644 index 00000000000..d087d977ef8 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/connector/_delete.py @@ -0,0 +1,190 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization environment cluster connector delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete confluent connector by name + """ + + _aaz_info = { + "version": "2024-07-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/environments/{}/clusters/{}/connectors/{}", "2024-07-01"], + ] + } + + 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.cluster_id = AAZStrArg( + options=["--cluster-id"], + help="Confluent kafka or schema registry cluster id", + required=True, + id_part="child_name_2", + ) + _args_schema.connector_name = AAZStrArg( + options=["-n", "--name", "--connector-name"], + help="Confluent connector name", + required=True, + id_part="child_name_3", + ) + _args_schema.environment_id = AAZStrArg( + options=["--environment-id"], + help="Confluent environment id", + required=True, + id_part="child_name_1", + ) + _args_schema.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ConnectorDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class ConnectorDelete(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.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/connectors/{connectorName}", + **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( + "clusterId", self.ctx.args.cluster_id, + required=True, + ), + **self.serialize_url_param( + "connectorName", self.ctx.args.connector_name, + required=True, + ), + **self.serialize_url_param( + "environmentId", self.ctx.args.environment_id, + required=True, + ), + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-07-01", + 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/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/connector/_list.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/connector/_list.py new file mode 100644 index 00000000000..24cc2b26c0d --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/connector/_list.py @@ -0,0 +1,521 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization environment cluster connector list", +) +class List(AAZCommand): + """List all the connectors in a cluster + """ + + _aaz_info = { + "version": "2024-07-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/environments/{}/clusters/{}/connectors", "2024-07-01"], + ] + } + + 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.cluster_id = AAZStrArg( + options=["--cluster-id"], + help="Confluent kafka or schema registry cluster id", + required=True, + ) + _args_schema.environment_id = AAZStrArg( + options=["--environment-id"], + help="Confluent environment id", + required=True, + ) + _args_schema.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.page_size = AAZIntArg( + options=["--page-size"], + help="Pagination size", + ) + _args_schema.page_token = AAZStrArg( + options=["--page-token"], + help="An opaque pagination token to fetch the next set of records", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConnectorList(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 ConnectorList(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.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/connectors", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterId", self.ctx.args.cluster_id, + required=True, + ), + **self.serialize_url_param( + "environmentId", self.ctx.args.environment_id, + required=True, + ), + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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( + "pageSize", self.ctx.args.page_size, + ), + **self.serialize_query_param( + "pageToken", self.ctx.args.page_token, + ), + **self.serialize_query_param( + "api-version", "2024-07-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.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.connector_basic_info = AAZObjectType( + serialized_name="connectorBasicInfo", + ) + properties.connector_service_type_info = AAZObjectType( + serialized_name="connectorServiceTypeInfo", + ) + properties.partner_connector_info = AAZObjectType( + serialized_name="partnerConnectorInfo", + ) + + connector_basic_info = cls._schema_on_200.value.Element.properties.connector_basic_info + connector_basic_info.connector_class = AAZStrType( + serialized_name="connectorClass", + ) + connector_basic_info.connector_id = AAZStrType( + serialized_name="connectorId", + ) + connector_basic_info.connector_name = AAZStrType( + serialized_name="connectorName", + ) + connector_basic_info.connector_state = AAZStrType( + serialized_name="connectorState", + ) + connector_basic_info.connector_type = AAZStrType( + serialized_name="connectorType", + ) + + connector_service_type_info = cls._schema_on_200.value.Element.properties.connector_service_type_info + connector_service_type_info.connector_service_type = AAZStrType( + serialized_name="connectorServiceType", + flags={"required": True}, + ) + + disc_azure_blob_storage_sink_connector = cls._schema_on_200.value.Element.properties.connector_service_type_info.discriminate_by("connector_service_type", "AzureBlobStorageSinkConnector") + disc_azure_blob_storage_sink_connector.storage_account_key = AAZStrType( + serialized_name="storageAccountKey", + ) + disc_azure_blob_storage_sink_connector.storage_account_name = AAZStrType( + serialized_name="storageAccountName", + ) + disc_azure_blob_storage_sink_connector.storage_container_name = AAZStrType( + serialized_name="storageContainerName", + ) + + disc_azure_blob_storage_source_connector = cls._schema_on_200.value.Element.properties.connector_service_type_info.discriminate_by("connector_service_type", "AzureBlobStorageSourceConnector") + disc_azure_blob_storage_source_connector.storage_account_key = AAZStrType( + serialized_name="storageAccountKey", + flags={"secret": True}, + ) + disc_azure_blob_storage_source_connector.storage_account_name = AAZStrType( + serialized_name="storageAccountName", + ) + disc_azure_blob_storage_source_connector.storage_container_name = AAZStrType( + serialized_name="storageContainerName", + ) + + disc_azure_cosmos_db_sink_connector = cls._schema_on_200.value.Element.properties.connector_service_type_info.discriminate_by("connector_service_type", "AzureCosmosDBSinkConnector") + disc_azure_cosmos_db_sink_connector.cosmos_connection_endpoint = AAZStrType( + serialized_name="cosmosConnectionEndpoint", + ) + disc_azure_cosmos_db_sink_connector.cosmos_containers_topic_mapping = AAZStrType( + serialized_name="cosmosContainersTopicMapping", + ) + disc_azure_cosmos_db_sink_connector.cosmos_database_name = AAZStrType( + serialized_name="cosmosDatabaseName", + ) + disc_azure_cosmos_db_sink_connector.cosmos_id_strategy = AAZStrType( + serialized_name="cosmosIdStrategy", + ) + disc_azure_cosmos_db_sink_connector.cosmos_master_key = AAZStrType( + serialized_name="cosmosMasterKey", + ) + + disc_azure_cosmos_db_source_connector = cls._schema_on_200.value.Element.properties.connector_service_type_info.discriminate_by("connector_service_type", "AzureCosmosDBSourceConnector") + disc_azure_cosmos_db_source_connector.cosmos_connection_endpoint = AAZStrType( + serialized_name="cosmosConnectionEndpoint", + ) + disc_azure_cosmos_db_source_connector.cosmos_containers_topic_mapping = AAZStrType( + serialized_name="cosmosContainersTopicMapping", + ) + disc_azure_cosmos_db_source_connector.cosmos_database_name = AAZStrType( + serialized_name="cosmosDatabaseName", + ) + disc_azure_cosmos_db_source_connector.cosmos_master_key = AAZStrType( + serialized_name="cosmosMasterKey", + ) + disc_azure_cosmos_db_source_connector.cosmos_message_key_enabled = AAZBoolType( + serialized_name="cosmosMessageKeyEnabled", + ) + disc_azure_cosmos_db_source_connector.cosmos_message_key_field = AAZStrType( + serialized_name="cosmosMessageKeyField", + ) + + disc_azure_synapse_analytics_sink_connector = cls._schema_on_200.value.Element.properties.connector_service_type_info.discriminate_by("connector_service_type", "AzureSynapseAnalyticsSinkConnector") + disc_azure_synapse_analytics_sink_connector.synapse_sql_database_name = AAZStrType( + serialized_name="synapseSqlDatabaseName", + ) + disc_azure_synapse_analytics_sink_connector.synapse_sql_password = AAZStrType( + serialized_name="synapseSqlPassword", + ) + disc_azure_synapse_analytics_sink_connector.synapse_sql_server_name = AAZStrType( + serialized_name="synapseSqlServerName", + ) + disc_azure_synapse_analytics_sink_connector.synapse_sql_user = AAZStrType( + serialized_name="synapseSqlUser", + ) + + partner_connector_info = cls._schema_on_200.value.Element.properties.partner_connector_info + partner_connector_info.partner_connector_type = AAZStrType( + serialized_name="partnerConnectorType", + flags={"required": True}, + ) + + disc_kafka_azure_blob_storage_sink = cls._schema_on_200.value.Element.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureBlobStorageSink") + disc_kafka_azure_blob_storage_sink.api_key = AAZStrType( + serialized_name="apiKey", + ) + disc_kafka_azure_blob_storage_sink.api_secret = AAZStrType( + serialized_name="apiSecret", + ) + disc_kafka_azure_blob_storage_sink.auth_type = AAZStrType( + serialized_name="authType", + ) + disc_kafka_azure_blob_storage_sink.flush_size = AAZStrType( + serialized_name="flushSize", + ) + disc_kafka_azure_blob_storage_sink.input_format = AAZStrType( + serialized_name="inputFormat", + ) + disc_kafka_azure_blob_storage_sink.max_tasks = AAZStrType( + serialized_name="maxTasks", + ) + disc_kafka_azure_blob_storage_sink.output_format = AAZStrType( + serialized_name="outputFormat", + ) + disc_kafka_azure_blob_storage_sink.service_account_id = AAZStrType( + serialized_name="serviceAccountId", + ) + disc_kafka_azure_blob_storage_sink.time_interval = AAZStrType( + serialized_name="timeInterval", + ) + disc_kafka_azure_blob_storage_sink.topics = AAZListType() + disc_kafka_azure_blob_storage_sink.topics_dir = AAZStrType( + serialized_name="topicsDir", + ) + + topics = cls._schema_on_200.value.Element.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureBlobStorageSink").topics + topics.Element = AAZStrType() + + disc_kafka_azure_blob_storage_source = cls._schema_on_200.value.Element.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureBlobStorageSource") + disc_kafka_azure_blob_storage_source.api_key = AAZStrType( + serialized_name="apiKey", + ) + disc_kafka_azure_blob_storage_source.api_secret = AAZStrType( + serialized_name="apiSecret", + flags={"secret": True}, + ) + disc_kafka_azure_blob_storage_source.auth_type = AAZStrType( + serialized_name="authType", + ) + disc_kafka_azure_blob_storage_source.input_format = AAZStrType( + serialized_name="inputFormat", + ) + disc_kafka_azure_blob_storage_source.max_tasks = AAZStrType( + serialized_name="maxTasks", + ) + disc_kafka_azure_blob_storage_source.output_format = AAZStrType( + serialized_name="outputFormat", + ) + disc_kafka_azure_blob_storage_source.service_account_id = AAZStrType( + serialized_name="serviceAccountId", + ) + disc_kafka_azure_blob_storage_source.topic_regex = AAZStrType( + serialized_name="topicRegex", + ) + disc_kafka_azure_blob_storage_source.topics_dir = AAZStrType( + serialized_name="topicsDir", + ) + + disc_kafka_azure_cosmos_db_sink = cls._schema_on_200.value.Element.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureCosmosDBSink") + disc_kafka_azure_cosmos_db_sink.api_key = AAZStrType( + serialized_name="apiKey", + ) + disc_kafka_azure_cosmos_db_sink.api_secret = AAZStrType( + serialized_name="apiSecret", + ) + disc_kafka_azure_cosmos_db_sink.auth_type = AAZStrType( + serialized_name="authType", + ) + disc_kafka_azure_cosmos_db_sink.flush_size = AAZStrType( + serialized_name="flushSize", + ) + disc_kafka_azure_cosmos_db_sink.input_format = AAZStrType( + serialized_name="inputFormat", + ) + disc_kafka_azure_cosmos_db_sink.max_tasks = AAZStrType( + serialized_name="maxTasks", + ) + disc_kafka_azure_cosmos_db_sink.output_format = AAZStrType( + serialized_name="outputFormat", + ) + disc_kafka_azure_cosmos_db_sink.service_account_id = AAZStrType( + serialized_name="serviceAccountId", + ) + disc_kafka_azure_cosmos_db_sink.time_interval = AAZStrType( + serialized_name="timeInterval", + ) + disc_kafka_azure_cosmos_db_sink.topics = AAZListType() + disc_kafka_azure_cosmos_db_sink.topics_dir = AAZStrType( + serialized_name="topicsDir", + ) + + topics = cls._schema_on_200.value.Element.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureCosmosDBSink").topics + topics.Element = AAZStrType() + + disc_kafka_azure_cosmos_db_source = cls._schema_on_200.value.Element.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureCosmosDBSource") + disc_kafka_azure_cosmos_db_source.api_key = AAZStrType( + serialized_name="apiKey", + ) + disc_kafka_azure_cosmos_db_source.api_secret = AAZStrType( + serialized_name="apiSecret", + flags={"secret": True}, + ) + disc_kafka_azure_cosmos_db_source.auth_type = AAZStrType( + serialized_name="authType", + ) + disc_kafka_azure_cosmos_db_source.input_format = AAZStrType( + serialized_name="inputFormat", + ) + disc_kafka_azure_cosmos_db_source.max_tasks = AAZStrType( + serialized_name="maxTasks", + ) + disc_kafka_azure_cosmos_db_source.output_format = AAZStrType( + serialized_name="outputFormat", + ) + disc_kafka_azure_cosmos_db_source.service_account_id = AAZStrType( + serialized_name="serviceAccountId", + ) + disc_kafka_azure_cosmos_db_source.topic_regex = AAZStrType( + serialized_name="topicRegex", + ) + disc_kafka_azure_cosmos_db_source.topics_dir = AAZStrType( + serialized_name="topicsDir", + ) + + disc_kafka_azure_synapse_analytics_sink = cls._schema_on_200.value.Element.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureSynapseAnalyticsSink") + disc_kafka_azure_synapse_analytics_sink.api_key = AAZStrType( + serialized_name="apiKey", + ) + disc_kafka_azure_synapse_analytics_sink.api_secret = AAZStrType( + serialized_name="apiSecret", + ) + disc_kafka_azure_synapse_analytics_sink.auth_type = AAZStrType( + serialized_name="authType", + ) + disc_kafka_azure_synapse_analytics_sink.flush_size = AAZStrType( + serialized_name="flushSize", + ) + disc_kafka_azure_synapse_analytics_sink.input_format = AAZStrType( + serialized_name="inputFormat", + ) + disc_kafka_azure_synapse_analytics_sink.max_tasks = AAZStrType( + serialized_name="maxTasks", + ) + disc_kafka_azure_synapse_analytics_sink.output_format = AAZStrType( + serialized_name="outputFormat", + ) + disc_kafka_azure_synapse_analytics_sink.service_account_id = AAZStrType( + serialized_name="serviceAccountId", + ) + disc_kafka_azure_synapse_analytics_sink.time_interval = AAZStrType( + serialized_name="timeInterval", + ) + disc_kafka_azure_synapse_analytics_sink.topics = AAZListType() + disc_kafka_azure_synapse_analytics_sink.topics_dir = AAZStrType( + serialized_name="topicsDir", + ) + + topics = cls._schema_on_200.value.Element.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureSynapseAnalyticsSink").topics + topics.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/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/connector/_show.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/connector/_show.py new file mode 100644 index 00000000000..ebb119c20a7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/connector/_show.py @@ -0,0 +1,509 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization environment cluster connector show", +) +class Show(AAZCommand): + """Get confluent connector by Name + """ + + _aaz_info = { + "version": "2024-07-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/environments/{}/clusters/{}/connectors/{}", "2024-07-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.cluster_id = AAZStrArg( + options=["--cluster-id"], + help="Confluent kafka or schema registry cluster id", + required=True, + id_part="child_name_2", + ) + _args_schema.connector_name = AAZStrArg( + options=["-n", "--name", "--connector-name"], + help="Confluent connector name", + required=True, + id_part="child_name_3", + ) + _args_schema.environment_id = AAZStrArg( + options=["--environment-id"], + help="Confluent environment id", + required=True, + id_part="child_name_1", + ) + _args_schema.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConnectorGet(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 ConnectorGet(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.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/connectors/{connectorName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterId", self.ctx.args.cluster_id, + required=True, + ), + **self.serialize_url_param( + "connectorName", self.ctx.args.connector_name, + required=True, + ), + **self.serialize_url_param( + "environmentId", self.ctx.args.environment_id, + required=True, + ), + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-07-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={"required": True, "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.connector_basic_info = AAZObjectType( + serialized_name="connectorBasicInfo", + ) + properties.connector_service_type_info = AAZObjectType( + serialized_name="connectorServiceTypeInfo", + ) + properties.partner_connector_info = AAZObjectType( + serialized_name="partnerConnectorInfo", + ) + + connector_basic_info = cls._schema_on_200.properties.connector_basic_info + connector_basic_info.connector_class = AAZStrType( + serialized_name="connectorClass", + ) + connector_basic_info.connector_id = AAZStrType( + serialized_name="connectorId", + ) + connector_basic_info.connector_name = AAZStrType( + serialized_name="connectorName", + ) + connector_basic_info.connector_state = AAZStrType( + serialized_name="connectorState", + ) + connector_basic_info.connector_type = AAZStrType( + serialized_name="connectorType", + ) + + connector_service_type_info = cls._schema_on_200.properties.connector_service_type_info + connector_service_type_info.connector_service_type = AAZStrType( + serialized_name="connectorServiceType", + flags={"required": True}, + ) + + disc_azure_blob_storage_sink_connector = cls._schema_on_200.properties.connector_service_type_info.discriminate_by("connector_service_type", "AzureBlobStorageSinkConnector") + disc_azure_blob_storage_sink_connector.storage_account_key = AAZStrType( + serialized_name="storageAccountKey", + ) + disc_azure_blob_storage_sink_connector.storage_account_name = AAZStrType( + serialized_name="storageAccountName", + ) + disc_azure_blob_storage_sink_connector.storage_container_name = AAZStrType( + serialized_name="storageContainerName", + ) + + disc_azure_blob_storage_source_connector = cls._schema_on_200.properties.connector_service_type_info.discriminate_by("connector_service_type", "AzureBlobStorageSourceConnector") + disc_azure_blob_storage_source_connector.storage_account_key = AAZStrType( + serialized_name="storageAccountKey", + flags={"secret": True}, + ) + disc_azure_blob_storage_source_connector.storage_account_name = AAZStrType( + serialized_name="storageAccountName", + ) + disc_azure_blob_storage_source_connector.storage_container_name = AAZStrType( + serialized_name="storageContainerName", + ) + + disc_azure_cosmos_db_sink_connector = cls._schema_on_200.properties.connector_service_type_info.discriminate_by("connector_service_type", "AzureCosmosDBSinkConnector") + disc_azure_cosmos_db_sink_connector.cosmos_connection_endpoint = AAZStrType( + serialized_name="cosmosConnectionEndpoint", + ) + disc_azure_cosmos_db_sink_connector.cosmos_containers_topic_mapping = AAZStrType( + serialized_name="cosmosContainersTopicMapping", + ) + disc_azure_cosmos_db_sink_connector.cosmos_database_name = AAZStrType( + serialized_name="cosmosDatabaseName", + ) + disc_azure_cosmos_db_sink_connector.cosmos_id_strategy = AAZStrType( + serialized_name="cosmosIdStrategy", + ) + disc_azure_cosmos_db_sink_connector.cosmos_master_key = AAZStrType( + serialized_name="cosmosMasterKey", + ) + + disc_azure_cosmos_db_source_connector = cls._schema_on_200.properties.connector_service_type_info.discriminate_by("connector_service_type", "AzureCosmosDBSourceConnector") + disc_azure_cosmos_db_source_connector.cosmos_connection_endpoint = AAZStrType( + serialized_name="cosmosConnectionEndpoint", + ) + disc_azure_cosmos_db_source_connector.cosmos_containers_topic_mapping = AAZStrType( + serialized_name="cosmosContainersTopicMapping", + ) + disc_azure_cosmos_db_source_connector.cosmos_database_name = AAZStrType( + serialized_name="cosmosDatabaseName", + ) + disc_azure_cosmos_db_source_connector.cosmos_master_key = AAZStrType( + serialized_name="cosmosMasterKey", + ) + disc_azure_cosmos_db_source_connector.cosmos_message_key_enabled = AAZBoolType( + serialized_name="cosmosMessageKeyEnabled", + ) + disc_azure_cosmos_db_source_connector.cosmos_message_key_field = AAZStrType( + serialized_name="cosmosMessageKeyField", + ) + + disc_azure_synapse_analytics_sink_connector = cls._schema_on_200.properties.connector_service_type_info.discriminate_by("connector_service_type", "AzureSynapseAnalyticsSinkConnector") + disc_azure_synapse_analytics_sink_connector.synapse_sql_database_name = AAZStrType( + serialized_name="synapseSqlDatabaseName", + ) + disc_azure_synapse_analytics_sink_connector.synapse_sql_password = AAZStrType( + serialized_name="synapseSqlPassword", + ) + disc_azure_synapse_analytics_sink_connector.synapse_sql_server_name = AAZStrType( + serialized_name="synapseSqlServerName", + ) + disc_azure_synapse_analytics_sink_connector.synapse_sql_user = AAZStrType( + serialized_name="synapseSqlUser", + ) + + partner_connector_info = cls._schema_on_200.properties.partner_connector_info + partner_connector_info.partner_connector_type = AAZStrType( + serialized_name="partnerConnectorType", + flags={"required": True}, + ) + + disc_kafka_azure_blob_storage_sink = cls._schema_on_200.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureBlobStorageSink") + disc_kafka_azure_blob_storage_sink.api_key = AAZStrType( + serialized_name="apiKey", + ) + disc_kafka_azure_blob_storage_sink.api_secret = AAZStrType( + serialized_name="apiSecret", + ) + disc_kafka_azure_blob_storage_sink.auth_type = AAZStrType( + serialized_name="authType", + ) + disc_kafka_azure_blob_storage_sink.flush_size = AAZStrType( + serialized_name="flushSize", + ) + disc_kafka_azure_blob_storage_sink.input_format = AAZStrType( + serialized_name="inputFormat", + ) + disc_kafka_azure_blob_storage_sink.max_tasks = AAZStrType( + serialized_name="maxTasks", + ) + disc_kafka_azure_blob_storage_sink.output_format = AAZStrType( + serialized_name="outputFormat", + ) + disc_kafka_azure_blob_storage_sink.service_account_id = AAZStrType( + serialized_name="serviceAccountId", + ) + disc_kafka_azure_blob_storage_sink.time_interval = AAZStrType( + serialized_name="timeInterval", + ) + disc_kafka_azure_blob_storage_sink.topics = AAZListType() + disc_kafka_azure_blob_storage_sink.topics_dir = AAZStrType( + serialized_name="topicsDir", + ) + + topics = cls._schema_on_200.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureBlobStorageSink").topics + topics.Element = AAZStrType() + + disc_kafka_azure_blob_storage_source = cls._schema_on_200.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureBlobStorageSource") + disc_kafka_azure_blob_storage_source.api_key = AAZStrType( + serialized_name="apiKey", + ) + disc_kafka_azure_blob_storage_source.api_secret = AAZStrType( + serialized_name="apiSecret", + flags={"secret": True}, + ) + disc_kafka_azure_blob_storage_source.auth_type = AAZStrType( + serialized_name="authType", + ) + disc_kafka_azure_blob_storage_source.input_format = AAZStrType( + serialized_name="inputFormat", + ) + disc_kafka_azure_blob_storage_source.max_tasks = AAZStrType( + serialized_name="maxTasks", + ) + disc_kafka_azure_blob_storage_source.output_format = AAZStrType( + serialized_name="outputFormat", + ) + disc_kafka_azure_blob_storage_source.service_account_id = AAZStrType( + serialized_name="serviceAccountId", + ) + disc_kafka_azure_blob_storage_source.topic_regex = AAZStrType( + serialized_name="topicRegex", + ) + disc_kafka_azure_blob_storage_source.topics_dir = AAZStrType( + serialized_name="topicsDir", + ) + + disc_kafka_azure_cosmos_db_sink = cls._schema_on_200.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureCosmosDBSink") + disc_kafka_azure_cosmos_db_sink.api_key = AAZStrType( + serialized_name="apiKey", + ) + disc_kafka_azure_cosmos_db_sink.api_secret = AAZStrType( + serialized_name="apiSecret", + ) + disc_kafka_azure_cosmos_db_sink.auth_type = AAZStrType( + serialized_name="authType", + ) + disc_kafka_azure_cosmos_db_sink.flush_size = AAZStrType( + serialized_name="flushSize", + ) + disc_kafka_azure_cosmos_db_sink.input_format = AAZStrType( + serialized_name="inputFormat", + ) + disc_kafka_azure_cosmos_db_sink.max_tasks = AAZStrType( + serialized_name="maxTasks", + ) + disc_kafka_azure_cosmos_db_sink.output_format = AAZStrType( + serialized_name="outputFormat", + ) + disc_kafka_azure_cosmos_db_sink.service_account_id = AAZStrType( + serialized_name="serviceAccountId", + ) + disc_kafka_azure_cosmos_db_sink.time_interval = AAZStrType( + serialized_name="timeInterval", + ) + disc_kafka_azure_cosmos_db_sink.topics = AAZListType() + disc_kafka_azure_cosmos_db_sink.topics_dir = AAZStrType( + serialized_name="topicsDir", + ) + + topics = cls._schema_on_200.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureCosmosDBSink").topics + topics.Element = AAZStrType() + + disc_kafka_azure_cosmos_db_source = cls._schema_on_200.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureCosmosDBSource") + disc_kafka_azure_cosmos_db_source.api_key = AAZStrType( + serialized_name="apiKey", + ) + disc_kafka_azure_cosmos_db_source.api_secret = AAZStrType( + serialized_name="apiSecret", + flags={"secret": True}, + ) + disc_kafka_azure_cosmos_db_source.auth_type = AAZStrType( + serialized_name="authType", + ) + disc_kafka_azure_cosmos_db_source.input_format = AAZStrType( + serialized_name="inputFormat", + ) + disc_kafka_azure_cosmos_db_source.max_tasks = AAZStrType( + serialized_name="maxTasks", + ) + disc_kafka_azure_cosmos_db_source.output_format = AAZStrType( + serialized_name="outputFormat", + ) + disc_kafka_azure_cosmos_db_source.service_account_id = AAZStrType( + serialized_name="serviceAccountId", + ) + disc_kafka_azure_cosmos_db_source.topic_regex = AAZStrType( + serialized_name="topicRegex", + ) + disc_kafka_azure_cosmos_db_source.topics_dir = AAZStrType( + serialized_name="topicsDir", + ) + + disc_kafka_azure_synapse_analytics_sink = cls._schema_on_200.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureSynapseAnalyticsSink") + disc_kafka_azure_synapse_analytics_sink.api_key = AAZStrType( + serialized_name="apiKey", + ) + disc_kafka_azure_synapse_analytics_sink.api_secret = AAZStrType( + serialized_name="apiSecret", + ) + disc_kafka_azure_synapse_analytics_sink.auth_type = AAZStrType( + serialized_name="authType", + ) + disc_kafka_azure_synapse_analytics_sink.flush_size = AAZStrType( + serialized_name="flushSize", + ) + disc_kafka_azure_synapse_analytics_sink.input_format = AAZStrType( + serialized_name="inputFormat", + ) + disc_kafka_azure_synapse_analytics_sink.max_tasks = AAZStrType( + serialized_name="maxTasks", + ) + disc_kafka_azure_synapse_analytics_sink.output_format = AAZStrType( + serialized_name="outputFormat", + ) + disc_kafka_azure_synapse_analytics_sink.service_account_id = AAZStrType( + serialized_name="serviceAccountId", + ) + disc_kafka_azure_synapse_analytics_sink.time_interval = AAZStrType( + serialized_name="timeInterval", + ) + disc_kafka_azure_synapse_analytics_sink.topics = AAZListType() + disc_kafka_azure_synapse_analytics_sink.topics_dir = AAZStrType( + serialized_name="topicsDir", + ) + + topics = cls._schema_on_200.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureSynapseAnalyticsSink").topics + topics.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/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/connector/_update.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/connector/_update.py new file mode 100644 index 00000000000..10afff8d282 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/connector/_update.py @@ -0,0 +1,1325 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization environment cluster connector update", +) +class Update(AAZCommand): + """Update confluent connector by Name + """ + + _aaz_info = { + "version": "2024-07-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/environments/{}/clusters/{}/connectors/{}", "2024-07-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.cluster_id = AAZStrArg( + options=["--cluster-id"], + help="Confluent kafka or schema registry cluster id", + required=True, + id_part="child_name_2", + ) + _args_schema.connector_name = AAZStrArg( + options=["-n", "--name", "--connector-name"], + help="Confluent connector name", + required=True, + id_part="child_name_3", + ) + _args_schema.environment_id = AAZStrArg( + options=["--environment-id"], + help="Confluent environment id", + required=True, + id_part="child_name_1", + ) + _args_schema.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.connector_basic_info = AAZObjectArg( + options=["--connector-basic-info"], + arg_group="Properties", + help="Connector Info Base", + nullable=True, + ) + _args_schema.connector_service_type_info = AAZObjectArg( + options=["--connector-service-type-info"], + arg_group="Properties", + help="Connector Service type info base properties.", + nullable=True, + ) + _args_schema.partner_connector_info = AAZObjectArg( + options=["--partner-connector-info"], + arg_group="Properties", + help="The connection information consumed by applications.", + nullable=True, + ) + + connector_basic_info = cls._args_schema.connector_basic_info + connector_basic_info.connector_class = AAZStrArg( + options=["connector-class"], + help="Connector Class", + nullable=True, + enum={"AZUREBLOBSINK": "AZUREBLOBSINK", "AZUREBLOBSOURCE": "AZUREBLOBSOURCE"}, + ) + connector_basic_info.connector_id = AAZStrArg( + options=["connector-id"], + help="Connector Id", + nullable=True, + ) + connector_basic_info.connector_name = AAZStrArg( + options=["connector-name"], + help="Connector Name", + nullable=True, + ) + connector_basic_info.connector_state = AAZStrArg( + options=["connector-state"], + help="Connector Status", + nullable=True, + enum={"FAILED": "FAILED", "PAUSED": "PAUSED", "PROVISIONING": "PROVISIONING", "RUNNING": "RUNNING"}, + ) + connector_basic_info.connector_type = AAZStrArg( + options=["connector-type"], + help="Connector Type", + nullable=True, + enum={"SINK": "SINK", "SOURCE": "SOURCE"}, + ) + + connector_service_type_info = cls._args_schema.connector_service_type_info + connector_service_type_info.azure_blob_storage_sink_connector = AAZObjectArg( + options=["azure-blob-storage-sink-connector"], + ) + connector_service_type_info.azure_blob_storage_source_connector = AAZObjectArg( + options=["azure-blob-storage-source-connector"], + ) + connector_service_type_info.azure_cosmos_db_sink_connector = AAZObjectArg( + options=["azure-cosmos-db-sink-connector"], + ) + connector_service_type_info.azure_cosmos_db_source_connector = AAZObjectArg( + options=["azure-cosmos-db-source-connector"], + ) + connector_service_type_info.azure_synapse_analytics_sink_connector = AAZObjectArg( + options=["azure-synapse-analytics-sink-connector"], + ) + + azure_blob_storage_sink_connector = cls._args_schema.connector_service_type_info.azure_blob_storage_sink_connector + azure_blob_storage_sink_connector.storage_account_key = AAZStrArg( + options=["storage-account-key"], + help="Azure Blob Storage Account Key", + nullable=True, + ) + azure_blob_storage_sink_connector.storage_account_name = AAZStrArg( + options=["storage-account-name"], + help="Azure Blob Storage Account Name", + nullable=True, + ) + azure_blob_storage_sink_connector.storage_container_name = AAZStrArg( + options=["storage-container-name"], + help="Azure Blob Storage Account Container Name", + nullable=True, + ) + + azure_blob_storage_source_connector = cls._args_schema.connector_service_type_info.azure_blob_storage_source_connector + azure_blob_storage_source_connector.storage_account_key = AAZStrArg( + options=["storage-account-key"], + help="Azure Blob Storage Account Key", + nullable=True, + ) + azure_blob_storage_source_connector.storage_account_name = AAZStrArg( + options=["storage-account-name"], + help="Azure Blob Storage Account Name", + nullable=True, + ) + azure_blob_storage_source_connector.storage_container_name = AAZStrArg( + options=["storage-container-name"], + help="Azure Blob Storage Account Container Name", + nullable=True, + ) + + azure_cosmos_db_sink_connector = cls._args_schema.connector_service_type_info.azure_cosmos_db_sink_connector + azure_cosmos_db_sink_connector.cosmos_connection_endpoint = AAZStrArg( + options=["cosmos-connection-endpoint"], + help="Azure Cosmos Database Connection Endpoint", + nullable=True, + ) + azure_cosmos_db_sink_connector.cosmos_containers_topic_mapping = AAZStrArg( + options=["cosmos-containers-topic-mapping"], + help="Azure Cosmos Database Containers Topic Mapping", + nullable=True, + ) + azure_cosmos_db_sink_connector.cosmos_database_name = AAZStrArg( + options=["cosmos-database-name"], + help="Azure Cosmos Database Name", + nullable=True, + ) + azure_cosmos_db_sink_connector.cosmos_id_strategy = AAZStrArg( + options=["cosmos-id-strategy"], + help="Azure Cosmos Database Id Strategy", + nullable=True, + ) + azure_cosmos_db_sink_connector.cosmos_master_key = AAZStrArg( + options=["cosmos-master-key"], + help="Azure Cosmos Database Master Key", + nullable=True, + ) + + azure_cosmos_db_source_connector = cls._args_schema.connector_service_type_info.azure_cosmos_db_source_connector + azure_cosmos_db_source_connector.cosmos_connection_endpoint = AAZStrArg( + options=["cosmos-connection-endpoint"], + help="Azure Cosmos Database Connection Endpoint", + nullable=True, + ) + azure_cosmos_db_source_connector.cosmos_containers_topic_mapping = AAZStrArg( + options=["cosmos-containers-topic-mapping"], + help="Azure Cosmos Database Containers Topic Mapping", + nullable=True, + ) + azure_cosmos_db_source_connector.cosmos_database_name = AAZStrArg( + options=["cosmos-database-name"], + help="Azure Cosmos Database Name", + nullable=True, + ) + azure_cosmos_db_source_connector.cosmos_master_key = AAZStrArg( + options=["cosmos-master-key"], + help="Azure Cosmos Database Master Key", + nullable=True, + ) + azure_cosmos_db_source_connector.cosmos_message_key_enabled = AAZBoolArg( + options=["cosmos-message-key-enabled"], + help="Azure Cosmos Database Message Key Enabled", + nullable=True, + ) + azure_cosmos_db_source_connector.cosmos_message_key_field = AAZStrArg( + options=["cosmos-message-key-field"], + help="Azure Cosmos Database Message Key Field", + nullable=True, + ) + + azure_synapse_analytics_sink_connector = cls._args_schema.connector_service_type_info.azure_synapse_analytics_sink_connector + azure_synapse_analytics_sink_connector.synapse_sql_database_name = AAZStrArg( + options=["synapse-sql-database-name"], + help="Azure Synapse Dedicated SQL Pool Database Name", + nullable=True, + ) + azure_synapse_analytics_sink_connector.synapse_sql_password = AAZStrArg( + options=["synapse-sql-password"], + help="Azure Synapse SQL login details", + nullable=True, + ) + azure_synapse_analytics_sink_connector.synapse_sql_server_name = AAZStrArg( + options=["synapse-sql-server-name"], + help="Azure Synapse Analytics SQL Server Name", + nullable=True, + ) + azure_synapse_analytics_sink_connector.synapse_sql_user = AAZStrArg( + options=["synapse-sql-user"], + help="Azure Synapse SQL login details", + nullable=True, + ) + + partner_connector_info = cls._args_schema.partner_connector_info + partner_connector_info.kafka_azure_blob_storage_sink = AAZObjectArg( + options=["kafka-azure-blob-storage-sink"], + ) + partner_connector_info.kafka_azure_blob_storage_source = AAZObjectArg( + options=["kafka-azure-blob-storage-source"], + ) + partner_connector_info.kafka_azure_cosmos_db_sink = AAZObjectArg( + options=["kafka-azure-cosmos-db-sink"], + ) + partner_connector_info.kafka_azure_cosmos_db_source = AAZObjectArg( + options=["kafka-azure-cosmos-db-source"], + ) + partner_connector_info.kafka_azure_synapse_analytics_sink = AAZObjectArg( + options=["kafka-azure-synapse-analytics-sink"], + ) + + kafka_azure_blob_storage_sink = cls._args_schema.partner_connector_info.kafka_azure_blob_storage_sink + kafka_azure_blob_storage_sink.api_key = AAZStrArg( + options=["api-key"], + help="Kafka API Key", + nullable=True, + ) + kafka_azure_blob_storage_sink.api_secret = AAZStrArg( + options=["api-secret"], + help="Kafka API Key Secret", + nullable=True, + ) + kafka_azure_blob_storage_sink.auth_type = AAZStrArg( + options=["auth-type"], + help="Kafka Auth Type", + nullable=True, + enum={"KAFKA_API_KEY": "KAFKA_API_KEY", "SERVICE_ACCOUNT": "SERVICE_ACCOUNT"}, + ) + kafka_azure_blob_storage_sink.flush_size = AAZStrArg( + options=["flush-size"], + help="Flush size", + nullable=True, + ) + kafka_azure_blob_storage_sink.input_format = AAZStrArg( + options=["input-format"], + help="Kafka Input Data Format Type", + nullable=True, + enum={"AVRO": "AVRO", "BYTES": "BYTES", "JSON": "JSON", "PROTOBUF": "PROTOBUF", "STRING": "STRING"}, + ) + kafka_azure_blob_storage_sink.max_tasks = AAZStrArg( + options=["max-tasks"], + help="Maximum Tasks", + nullable=True, + ) + kafka_azure_blob_storage_sink.output_format = AAZStrArg( + options=["output-format"], + help="Kafka Output Data Format Type", + nullable=True, + enum={"AVRO": "AVRO", "BYTES": "BYTES", "JSON": "JSON", "PROTOBUF": "PROTOBUF", "STRING": "STRING"}, + ) + kafka_azure_blob_storage_sink.service_account_id = AAZStrArg( + options=["service-account-id"], + help="Kafka Service Account Id", + nullable=True, + ) + kafka_azure_blob_storage_sink.time_interval = AAZStrArg( + options=["time-interval"], + help="Time Interval", + nullable=True, + ) + kafka_azure_blob_storage_sink.topics = AAZListArg( + options=["topics"], + help="Kafka topics list", + nullable=True, + ) + kafka_azure_blob_storage_sink.topics_dir = AAZStrArg( + options=["topics-dir"], + help="Kafka topics directory", + nullable=True, + ) + + topics = cls._args_schema.partner_connector_info.kafka_azure_blob_storage_sink.topics + topics.Element = AAZStrArg( + nullable=True, + ) + + kafka_azure_blob_storage_source = cls._args_schema.partner_connector_info.kafka_azure_blob_storage_source + kafka_azure_blob_storage_source.api_key = AAZStrArg( + options=["api-key"], + help="Kafka API Key", + nullable=True, + ) + kafka_azure_blob_storage_source.api_secret = AAZStrArg( + options=["api-secret"], + help="Kafka API Secret", + nullable=True, + ) + kafka_azure_blob_storage_source.auth_type = AAZStrArg( + options=["auth-type"], + help="Kafka Auth Type", + nullable=True, + enum={"KAFKA_API_KEY": "KAFKA_API_KEY", "SERVICE_ACCOUNT": "SERVICE_ACCOUNT"}, + ) + kafka_azure_blob_storage_source.input_format = AAZStrArg( + options=["input-format"], + help="Kafka Input Data Format Type", + nullable=True, + enum={"AVRO": "AVRO", "BYTES": "BYTES", "JSON": "JSON", "PROTOBUF": "PROTOBUF", "STRING": "STRING"}, + ) + kafka_azure_blob_storage_source.max_tasks = AAZStrArg( + options=["max-tasks"], + help="Maximum Tasks", + nullable=True, + ) + kafka_azure_blob_storage_source.output_format = AAZStrArg( + options=["output-format"], + help="Kafka Output Data Format Type", + nullable=True, + enum={"AVRO": "AVRO", "BYTES": "BYTES", "JSON": "JSON", "PROTOBUF": "PROTOBUF", "STRING": "STRING"}, + ) + kafka_azure_blob_storage_source.service_account_id = AAZStrArg( + options=["service-account-id"], + help="Kafka Service Account Id", + nullable=True, + ) + kafka_azure_blob_storage_source.topic_regex = AAZStrArg( + options=["topic-regex"], + help="Kafka topics Regex pattern", + nullable=True, + ) + kafka_azure_blob_storage_source.topics_dir = AAZStrArg( + options=["topics-dir"], + help="Kafka topics directory", + nullable=True, + ) + + kafka_azure_cosmos_db_sink = cls._args_schema.partner_connector_info.kafka_azure_cosmos_db_sink + kafka_azure_cosmos_db_sink.api_key = AAZStrArg( + options=["api-key"], + help="Kafka API Key", + nullable=True, + ) + kafka_azure_cosmos_db_sink.api_secret = AAZStrArg( + options=["api-secret"], + help="Kafka API Key Secret", + nullable=True, + ) + kafka_azure_cosmos_db_sink.auth_type = AAZStrArg( + options=["auth-type"], + help="Kafka Auth Type", + nullable=True, + enum={"KAFKA_API_KEY": "KAFKA_API_KEY", "SERVICE_ACCOUNT": "SERVICE_ACCOUNT"}, + ) + kafka_azure_cosmos_db_sink.flush_size = AAZStrArg( + options=["flush-size"], + help="Flush size", + nullable=True, + ) + kafka_azure_cosmos_db_sink.input_format = AAZStrArg( + options=["input-format"], + help="Kafka Input Data Format Type", + nullable=True, + enum={"AVRO": "AVRO", "BYTES": "BYTES", "JSON": "JSON", "PROTOBUF": "PROTOBUF", "STRING": "STRING"}, + ) + kafka_azure_cosmos_db_sink.max_tasks = AAZStrArg( + options=["max-tasks"], + help="Maximum Tasks", + nullable=True, + ) + kafka_azure_cosmos_db_sink.output_format = AAZStrArg( + options=["output-format"], + help="Kafka Output Data Format Type", + nullable=True, + enum={"AVRO": "AVRO", "BYTES": "BYTES", "JSON": "JSON", "PROTOBUF": "PROTOBUF", "STRING": "STRING"}, + ) + kafka_azure_cosmos_db_sink.service_account_id = AAZStrArg( + options=["service-account-id"], + help="Kafka Service Account Id", + nullable=True, + ) + kafka_azure_cosmos_db_sink.time_interval = AAZStrArg( + options=["time-interval"], + help="Time Interval", + nullable=True, + ) + kafka_azure_cosmos_db_sink.topics = AAZListArg( + options=["topics"], + help="Kafka topics list", + nullable=True, + ) + kafka_azure_cosmos_db_sink.topics_dir = AAZStrArg( + options=["topics-dir"], + help="Kafka topics directory", + nullable=True, + ) + + topics = cls._args_schema.partner_connector_info.kafka_azure_cosmos_db_sink.topics + topics.Element = AAZStrArg( + nullable=True, + ) + + kafka_azure_cosmos_db_source = cls._args_schema.partner_connector_info.kafka_azure_cosmos_db_source + kafka_azure_cosmos_db_source.api_key = AAZStrArg( + options=["api-key"], + help="Kafka API Key", + nullable=True, + ) + kafka_azure_cosmos_db_source.api_secret = AAZStrArg( + options=["api-secret"], + help="Kafka API Secret", + nullable=True, + ) + kafka_azure_cosmos_db_source.auth_type = AAZStrArg( + options=["auth-type"], + help="Kafka Auth Type", + nullable=True, + enum={"KAFKA_API_KEY": "KAFKA_API_KEY", "SERVICE_ACCOUNT": "SERVICE_ACCOUNT"}, + ) + kafka_azure_cosmos_db_source.input_format = AAZStrArg( + options=["input-format"], + help="Kafka Input Data Format Type", + nullable=True, + enum={"AVRO": "AVRO", "BYTES": "BYTES", "JSON": "JSON", "PROTOBUF": "PROTOBUF", "STRING": "STRING"}, + ) + kafka_azure_cosmos_db_source.max_tasks = AAZStrArg( + options=["max-tasks"], + help="Maximum Tasks", + nullable=True, + ) + kafka_azure_cosmos_db_source.output_format = AAZStrArg( + options=["output-format"], + help="Kafka Output Data Format Type", + nullable=True, + enum={"AVRO": "AVRO", "BYTES": "BYTES", "JSON": "JSON", "PROTOBUF": "PROTOBUF", "STRING": "STRING"}, + ) + kafka_azure_cosmos_db_source.service_account_id = AAZStrArg( + options=["service-account-id"], + help="Kafka Service Account Id", + nullable=True, + ) + kafka_azure_cosmos_db_source.topic_regex = AAZStrArg( + options=["topic-regex"], + help="Kafka topics Regex pattern", + nullable=True, + ) + kafka_azure_cosmos_db_source.topics_dir = AAZStrArg( + options=["topics-dir"], + help="Kafka topics directory", + nullable=True, + ) + + kafka_azure_synapse_analytics_sink = cls._args_schema.partner_connector_info.kafka_azure_synapse_analytics_sink + kafka_azure_synapse_analytics_sink.api_key = AAZStrArg( + options=["api-key"], + help="Kafka API Key", + nullable=True, + ) + kafka_azure_synapse_analytics_sink.api_secret = AAZStrArg( + options=["api-secret"], + help="Kafka API Key Secret", + nullable=True, + ) + kafka_azure_synapse_analytics_sink.auth_type = AAZStrArg( + options=["auth-type"], + help="Kafka Auth Type", + nullable=True, + enum={"KAFKA_API_KEY": "KAFKA_API_KEY", "SERVICE_ACCOUNT": "SERVICE_ACCOUNT"}, + ) + kafka_azure_synapse_analytics_sink.flush_size = AAZStrArg( + options=["flush-size"], + help="Flush size", + nullable=True, + ) + kafka_azure_synapse_analytics_sink.input_format = AAZStrArg( + options=["input-format"], + help="Kafka Input Data Format Type", + nullable=True, + enum={"AVRO": "AVRO", "BYTES": "BYTES", "JSON": "JSON", "PROTOBUF": "PROTOBUF", "STRING": "STRING"}, + ) + kafka_azure_synapse_analytics_sink.max_tasks = AAZStrArg( + options=["max-tasks"], + help="Maximum Tasks", + nullable=True, + ) + kafka_azure_synapse_analytics_sink.output_format = AAZStrArg( + options=["output-format"], + help="Kafka Output Data Format Type", + nullable=True, + enum={"AVRO": "AVRO", "BYTES": "BYTES", "JSON": "JSON", "PROTOBUF": "PROTOBUF", "STRING": "STRING"}, + ) + kafka_azure_synapse_analytics_sink.service_account_id = AAZStrArg( + options=["service-account-id"], + help="Kafka Service Account Id", + nullable=True, + ) + kafka_azure_synapse_analytics_sink.time_interval = AAZStrArg( + options=["time-interval"], + help="Time Interval", + nullable=True, + ) + kafka_azure_synapse_analytics_sink.topics = AAZListArg( + options=["topics"], + help="Kafka topics list", + nullable=True, + ) + kafka_azure_synapse_analytics_sink.topics_dir = AAZStrArg( + options=["topics-dir"], + help="Kafka topics directory", + nullable=True, + ) + + topics = cls._args_schema.partner_connector_info.kafka_azure_synapse_analytics_sink.topics + topics.Element = AAZStrArg( + nullable=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConnectorGet(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.ConnectorCreateOrUpdate(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 ConnectorGet(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.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/connectors/{connectorName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterId", self.ctx.args.cluster_id, + required=True, + ), + **self.serialize_url_param( + "connectorName", self.ctx.args.connector_name, + required=True, + ), + **self.serialize_url_param( + "environmentId", self.ctx.args.environment_id, + required=True, + ), + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-07-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_connector_resource_read(cls._schema_on_200) + + return cls._schema_on_200 + + class ConnectorCreateOrUpdate(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.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/connectors/{connectorName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterId", self.ctx.args.cluster_id, + required=True, + ), + **self.serialize_url_param( + "connectorName", self.ctx.args.connector_name, + required=True, + ), + **self.serialize_url_param( + "environmentId", self.ctx.args.environment_id, + required=True, + ), + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-07-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_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_connector_resource_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("connectorBasicInfo", AAZObjectType, ".connector_basic_info") + properties.set_prop("connectorServiceTypeInfo", AAZObjectType, ".connector_service_type_info") + properties.set_prop("partnerConnectorInfo", AAZObjectType, ".partner_connector_info") + + connector_basic_info = _builder.get(".properties.connectorBasicInfo") + if connector_basic_info is not None: + connector_basic_info.set_prop("connectorClass", AAZStrType, ".connector_class") + connector_basic_info.set_prop("connectorId", AAZStrType, ".connector_id") + connector_basic_info.set_prop("connectorName", AAZStrType, ".connector_name") + connector_basic_info.set_prop("connectorState", AAZStrType, ".connector_state") + connector_basic_info.set_prop("connectorType", AAZStrType, ".connector_type") + + connector_service_type_info = _builder.get(".properties.connectorServiceTypeInfo") + if connector_service_type_info is not None: + connector_service_type_info.set_const("connectorServiceType", "AzureBlobStorageSinkConnector", AAZStrType, ".azure_blob_storage_sink_connector", typ_kwargs={"flags": {"required": True}}) + connector_service_type_info.set_const("connectorServiceType", "AzureBlobStorageSourceConnector", AAZStrType, ".azure_blob_storage_source_connector", typ_kwargs={"flags": {"required": True}}) + connector_service_type_info.set_const("connectorServiceType", "AzureCosmosDBSinkConnector", AAZStrType, ".azure_cosmos_db_sink_connector", typ_kwargs={"flags": {"required": True}}) + connector_service_type_info.set_const("connectorServiceType", "AzureCosmosDBSourceConnector", AAZStrType, ".azure_cosmos_db_source_connector", typ_kwargs={"flags": {"required": True}}) + connector_service_type_info.set_const("connectorServiceType", "AzureSynapseAnalyticsSinkConnector", AAZStrType, ".azure_synapse_analytics_sink_connector", typ_kwargs={"flags": {"required": True}}) + connector_service_type_info.discriminate_by("connectorServiceType", "AzureBlobStorageSinkConnector") + connector_service_type_info.discriminate_by("connectorServiceType", "AzureBlobStorageSourceConnector") + connector_service_type_info.discriminate_by("connectorServiceType", "AzureCosmosDBSinkConnector") + connector_service_type_info.discriminate_by("connectorServiceType", "AzureCosmosDBSourceConnector") + connector_service_type_info.discriminate_by("connectorServiceType", "AzureSynapseAnalyticsSinkConnector") + + disc_azure_blob_storage_sink_connector = _builder.get(".properties.connectorServiceTypeInfo{connectorServiceType:AzureBlobStorageSinkConnector}") + if disc_azure_blob_storage_sink_connector is not None: + disc_azure_blob_storage_sink_connector.set_prop("storageAccountKey", AAZStrType, ".azure_blob_storage_sink_connector.storage_account_key") + disc_azure_blob_storage_sink_connector.set_prop("storageAccountName", AAZStrType, ".azure_blob_storage_sink_connector.storage_account_name") + disc_azure_blob_storage_sink_connector.set_prop("storageContainerName", AAZStrType, ".azure_blob_storage_sink_connector.storage_container_name") + + disc_azure_blob_storage_source_connector = _builder.get(".properties.connectorServiceTypeInfo{connectorServiceType:AzureBlobStorageSourceConnector}") + if disc_azure_blob_storage_source_connector is not None: + disc_azure_blob_storage_source_connector.set_prop("storageAccountKey", AAZStrType, ".azure_blob_storage_source_connector.storage_account_key", typ_kwargs={"flags": {"secret": True}}) + disc_azure_blob_storage_source_connector.set_prop("storageAccountName", AAZStrType, ".azure_blob_storage_source_connector.storage_account_name") + disc_azure_blob_storage_source_connector.set_prop("storageContainerName", AAZStrType, ".azure_blob_storage_source_connector.storage_container_name") + + disc_azure_cosmos_db_sink_connector = _builder.get(".properties.connectorServiceTypeInfo{connectorServiceType:AzureCosmosDBSinkConnector}") + if disc_azure_cosmos_db_sink_connector is not None: + disc_azure_cosmos_db_sink_connector.set_prop("cosmosConnectionEndpoint", AAZStrType, ".azure_cosmos_db_sink_connector.cosmos_connection_endpoint") + disc_azure_cosmos_db_sink_connector.set_prop("cosmosContainersTopicMapping", AAZStrType, ".azure_cosmos_db_sink_connector.cosmos_containers_topic_mapping") + disc_azure_cosmos_db_sink_connector.set_prop("cosmosDatabaseName", AAZStrType, ".azure_cosmos_db_sink_connector.cosmos_database_name") + disc_azure_cosmos_db_sink_connector.set_prop("cosmosIdStrategy", AAZStrType, ".azure_cosmos_db_sink_connector.cosmos_id_strategy") + disc_azure_cosmos_db_sink_connector.set_prop("cosmosMasterKey", AAZStrType, ".azure_cosmos_db_sink_connector.cosmos_master_key") + + disc_azure_cosmos_db_source_connector = _builder.get(".properties.connectorServiceTypeInfo{connectorServiceType:AzureCosmosDBSourceConnector}") + if disc_azure_cosmos_db_source_connector is not None: + disc_azure_cosmos_db_source_connector.set_prop("cosmosConnectionEndpoint", AAZStrType, ".azure_cosmos_db_source_connector.cosmos_connection_endpoint") + disc_azure_cosmos_db_source_connector.set_prop("cosmosContainersTopicMapping", AAZStrType, ".azure_cosmos_db_source_connector.cosmos_containers_topic_mapping") + disc_azure_cosmos_db_source_connector.set_prop("cosmosDatabaseName", AAZStrType, ".azure_cosmos_db_source_connector.cosmos_database_name") + disc_azure_cosmos_db_source_connector.set_prop("cosmosMasterKey", AAZStrType, ".azure_cosmos_db_source_connector.cosmos_master_key") + disc_azure_cosmos_db_source_connector.set_prop("cosmosMessageKeyEnabled", AAZBoolType, ".azure_cosmos_db_source_connector.cosmos_message_key_enabled") + disc_azure_cosmos_db_source_connector.set_prop("cosmosMessageKeyField", AAZStrType, ".azure_cosmos_db_source_connector.cosmos_message_key_field") + + disc_azure_synapse_analytics_sink_connector = _builder.get(".properties.connectorServiceTypeInfo{connectorServiceType:AzureSynapseAnalyticsSinkConnector}") + if disc_azure_synapse_analytics_sink_connector is not None: + disc_azure_synapse_analytics_sink_connector.set_prop("synapseSqlDatabaseName", AAZStrType, ".azure_synapse_analytics_sink_connector.synapse_sql_database_name") + disc_azure_synapse_analytics_sink_connector.set_prop("synapseSqlPassword", AAZStrType, ".azure_synapse_analytics_sink_connector.synapse_sql_password") + disc_azure_synapse_analytics_sink_connector.set_prop("synapseSqlServerName", AAZStrType, ".azure_synapse_analytics_sink_connector.synapse_sql_server_name") + disc_azure_synapse_analytics_sink_connector.set_prop("synapseSqlUser", AAZStrType, ".azure_synapse_analytics_sink_connector.synapse_sql_user") + + partner_connector_info = _builder.get(".properties.partnerConnectorInfo") + if partner_connector_info is not None: + partner_connector_info.set_const("partnerConnectorType", "KafkaAzureBlobStorageSink", AAZStrType, ".kafka_azure_blob_storage_sink", typ_kwargs={"flags": {"required": True}}) + partner_connector_info.set_const("partnerConnectorType", "KafkaAzureBlobStorageSource", AAZStrType, ".kafka_azure_blob_storage_source", typ_kwargs={"flags": {"required": True}}) + partner_connector_info.set_const("partnerConnectorType", "KafkaAzureCosmosDBSink", AAZStrType, ".kafka_azure_cosmos_db_sink", typ_kwargs={"flags": {"required": True}}) + partner_connector_info.set_const("partnerConnectorType", "KafkaAzureCosmosDBSource", AAZStrType, ".kafka_azure_cosmos_db_source", typ_kwargs={"flags": {"required": True}}) + partner_connector_info.set_const("partnerConnectorType", "KafkaAzureSynapseAnalyticsSink", AAZStrType, ".kafka_azure_synapse_analytics_sink", typ_kwargs={"flags": {"required": True}}) + partner_connector_info.discriminate_by("partnerConnectorType", "KafkaAzureBlobStorageSink") + partner_connector_info.discriminate_by("partnerConnectorType", "KafkaAzureBlobStorageSource") + partner_connector_info.discriminate_by("partnerConnectorType", "KafkaAzureCosmosDBSink") + partner_connector_info.discriminate_by("partnerConnectorType", "KafkaAzureCosmosDBSource") + partner_connector_info.discriminate_by("partnerConnectorType", "KafkaAzureSynapseAnalyticsSink") + + disc_kafka_azure_blob_storage_sink = _builder.get(".properties.partnerConnectorInfo{partnerConnectorType:KafkaAzureBlobStorageSink}") + if disc_kafka_azure_blob_storage_sink is not None: + disc_kafka_azure_blob_storage_sink.set_prop("apiKey", AAZStrType, ".kafka_azure_blob_storage_sink.api_key") + disc_kafka_azure_blob_storage_sink.set_prop("apiSecret", AAZStrType, ".kafka_azure_blob_storage_sink.api_secret") + disc_kafka_azure_blob_storage_sink.set_prop("authType", AAZStrType, ".kafka_azure_blob_storage_sink.auth_type") + disc_kafka_azure_blob_storage_sink.set_prop("flushSize", AAZStrType, ".kafka_azure_blob_storage_sink.flush_size") + disc_kafka_azure_blob_storage_sink.set_prop("inputFormat", AAZStrType, ".kafka_azure_blob_storage_sink.input_format") + disc_kafka_azure_blob_storage_sink.set_prop("maxTasks", AAZStrType, ".kafka_azure_blob_storage_sink.max_tasks") + disc_kafka_azure_blob_storage_sink.set_prop("outputFormat", AAZStrType, ".kafka_azure_blob_storage_sink.output_format") + disc_kafka_azure_blob_storage_sink.set_prop("serviceAccountId", AAZStrType, ".kafka_azure_blob_storage_sink.service_account_id") + disc_kafka_azure_blob_storage_sink.set_prop("timeInterval", AAZStrType, ".kafka_azure_blob_storage_sink.time_interval") + disc_kafka_azure_blob_storage_sink.set_prop("topics", AAZListType, ".kafka_azure_blob_storage_sink.topics") + disc_kafka_azure_blob_storage_sink.set_prop("topicsDir", AAZStrType, ".kafka_azure_blob_storage_sink.topics_dir") + + topics = _builder.get(".properties.partnerConnectorInfo{partnerConnectorType:KafkaAzureBlobStorageSink}.topics") + if topics is not None: + topics.set_elements(AAZStrType, ".") + + disc_kafka_azure_blob_storage_source = _builder.get(".properties.partnerConnectorInfo{partnerConnectorType:KafkaAzureBlobStorageSource}") + if disc_kafka_azure_blob_storage_source is not None: + disc_kafka_azure_blob_storage_source.set_prop("apiKey", AAZStrType, ".kafka_azure_blob_storage_source.api_key") + disc_kafka_azure_blob_storage_source.set_prop("apiSecret", AAZStrType, ".kafka_azure_blob_storage_source.api_secret", typ_kwargs={"flags": {"secret": True}}) + disc_kafka_azure_blob_storage_source.set_prop("authType", AAZStrType, ".kafka_azure_blob_storage_source.auth_type") + disc_kafka_azure_blob_storage_source.set_prop("inputFormat", AAZStrType, ".kafka_azure_blob_storage_source.input_format") + disc_kafka_azure_blob_storage_source.set_prop("maxTasks", AAZStrType, ".kafka_azure_blob_storage_source.max_tasks") + disc_kafka_azure_blob_storage_source.set_prop("outputFormat", AAZStrType, ".kafka_azure_blob_storage_source.output_format") + disc_kafka_azure_blob_storage_source.set_prop("serviceAccountId", AAZStrType, ".kafka_azure_blob_storage_source.service_account_id") + disc_kafka_azure_blob_storage_source.set_prop("topicRegex", AAZStrType, ".kafka_azure_blob_storage_source.topic_regex") + disc_kafka_azure_blob_storage_source.set_prop("topicsDir", AAZStrType, ".kafka_azure_blob_storage_source.topics_dir") + + disc_kafka_azure_cosmos_db_sink = _builder.get(".properties.partnerConnectorInfo{partnerConnectorType:KafkaAzureCosmosDBSink}") + if disc_kafka_azure_cosmos_db_sink is not None: + disc_kafka_azure_cosmos_db_sink.set_prop("apiKey", AAZStrType, ".kafka_azure_cosmos_db_sink.api_key") + disc_kafka_azure_cosmos_db_sink.set_prop("apiSecret", AAZStrType, ".kafka_azure_cosmos_db_sink.api_secret") + disc_kafka_azure_cosmos_db_sink.set_prop("authType", AAZStrType, ".kafka_azure_cosmos_db_sink.auth_type") + disc_kafka_azure_cosmos_db_sink.set_prop("flushSize", AAZStrType, ".kafka_azure_cosmos_db_sink.flush_size") + disc_kafka_azure_cosmos_db_sink.set_prop("inputFormat", AAZStrType, ".kafka_azure_cosmos_db_sink.input_format") + disc_kafka_azure_cosmos_db_sink.set_prop("maxTasks", AAZStrType, ".kafka_azure_cosmos_db_sink.max_tasks") + disc_kafka_azure_cosmos_db_sink.set_prop("outputFormat", AAZStrType, ".kafka_azure_cosmos_db_sink.output_format") + disc_kafka_azure_cosmos_db_sink.set_prop("serviceAccountId", AAZStrType, ".kafka_azure_cosmos_db_sink.service_account_id") + disc_kafka_azure_cosmos_db_sink.set_prop("timeInterval", AAZStrType, ".kafka_azure_cosmos_db_sink.time_interval") + disc_kafka_azure_cosmos_db_sink.set_prop("topics", AAZListType, ".kafka_azure_cosmos_db_sink.topics") + disc_kafka_azure_cosmos_db_sink.set_prop("topicsDir", AAZStrType, ".kafka_azure_cosmos_db_sink.topics_dir") + + topics = _builder.get(".properties.partnerConnectorInfo{partnerConnectorType:KafkaAzureCosmosDBSink}.topics") + if topics is not None: + topics.set_elements(AAZStrType, ".") + + disc_kafka_azure_cosmos_db_source = _builder.get(".properties.partnerConnectorInfo{partnerConnectorType:KafkaAzureCosmosDBSource}") + if disc_kafka_azure_cosmos_db_source is not None: + disc_kafka_azure_cosmos_db_source.set_prop("apiKey", AAZStrType, ".kafka_azure_cosmos_db_source.api_key") + disc_kafka_azure_cosmos_db_source.set_prop("apiSecret", AAZStrType, ".kafka_azure_cosmos_db_source.api_secret", typ_kwargs={"flags": {"secret": True}}) + disc_kafka_azure_cosmos_db_source.set_prop("authType", AAZStrType, ".kafka_azure_cosmos_db_source.auth_type") + disc_kafka_azure_cosmos_db_source.set_prop("inputFormat", AAZStrType, ".kafka_azure_cosmos_db_source.input_format") + disc_kafka_azure_cosmos_db_source.set_prop("maxTasks", AAZStrType, ".kafka_azure_cosmos_db_source.max_tasks") + disc_kafka_azure_cosmos_db_source.set_prop("outputFormat", AAZStrType, ".kafka_azure_cosmos_db_source.output_format") + disc_kafka_azure_cosmos_db_source.set_prop("serviceAccountId", AAZStrType, ".kafka_azure_cosmos_db_source.service_account_id") + disc_kafka_azure_cosmos_db_source.set_prop("topicRegex", AAZStrType, ".kafka_azure_cosmos_db_source.topic_regex") + disc_kafka_azure_cosmos_db_source.set_prop("topicsDir", AAZStrType, ".kafka_azure_cosmos_db_source.topics_dir") + + disc_kafka_azure_synapse_analytics_sink = _builder.get(".properties.partnerConnectorInfo{partnerConnectorType:KafkaAzureSynapseAnalyticsSink}") + if disc_kafka_azure_synapse_analytics_sink is not None: + disc_kafka_azure_synapse_analytics_sink.set_prop("apiKey", AAZStrType, ".kafka_azure_synapse_analytics_sink.api_key") + disc_kafka_azure_synapse_analytics_sink.set_prop("apiSecret", AAZStrType, ".kafka_azure_synapse_analytics_sink.api_secret") + disc_kafka_azure_synapse_analytics_sink.set_prop("authType", AAZStrType, ".kafka_azure_synapse_analytics_sink.auth_type") + disc_kafka_azure_synapse_analytics_sink.set_prop("flushSize", AAZStrType, ".kafka_azure_synapse_analytics_sink.flush_size") + disc_kafka_azure_synapse_analytics_sink.set_prop("inputFormat", AAZStrType, ".kafka_azure_synapse_analytics_sink.input_format") + disc_kafka_azure_synapse_analytics_sink.set_prop("maxTasks", AAZStrType, ".kafka_azure_synapse_analytics_sink.max_tasks") + disc_kafka_azure_synapse_analytics_sink.set_prop("outputFormat", AAZStrType, ".kafka_azure_synapse_analytics_sink.output_format") + disc_kafka_azure_synapse_analytics_sink.set_prop("serviceAccountId", AAZStrType, ".kafka_azure_synapse_analytics_sink.service_account_id") + disc_kafka_azure_synapse_analytics_sink.set_prop("timeInterval", AAZStrType, ".kafka_azure_synapse_analytics_sink.time_interval") + disc_kafka_azure_synapse_analytics_sink.set_prop("topics", AAZListType, ".kafka_azure_synapse_analytics_sink.topics") + disc_kafka_azure_synapse_analytics_sink.set_prop("topicsDir", AAZStrType, ".kafka_azure_synapse_analytics_sink.topics_dir") + + topics = _builder.get(".properties.partnerConnectorInfo{partnerConnectorType:KafkaAzureSynapseAnalyticsSink}.topics") + if topics is not None: + topics.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_connector_resource_read = None + + @classmethod + def _build_schema_connector_resource_read(cls, _schema): + if cls._schema_connector_resource_read is not None: + _schema.id = cls._schema_connector_resource_read.id + _schema.name = cls._schema_connector_resource_read.name + _schema.properties = cls._schema_connector_resource_read.properties + _schema.system_data = cls._schema_connector_resource_read.system_data + _schema.type = cls._schema_connector_resource_read.type + return + + cls._schema_connector_resource_read = _schema_connector_resource_read = AAZObjectType() + + connector_resource_read = _schema_connector_resource_read + connector_resource_read.id = AAZStrType( + flags={"read_only": True}, + ) + connector_resource_read.name = AAZStrType( + flags={"read_only": True}, + ) + connector_resource_read.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + connector_resource_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + connector_resource_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_connector_resource_read.properties + properties.connector_basic_info = AAZObjectType( + serialized_name="connectorBasicInfo", + ) + properties.connector_service_type_info = AAZObjectType( + serialized_name="connectorServiceTypeInfo", + ) + properties.partner_connector_info = AAZObjectType( + serialized_name="partnerConnectorInfo", + ) + + connector_basic_info = _schema_connector_resource_read.properties.connector_basic_info + connector_basic_info.connector_class = AAZStrType( + serialized_name="connectorClass", + ) + connector_basic_info.connector_id = AAZStrType( + serialized_name="connectorId", + ) + connector_basic_info.connector_name = AAZStrType( + serialized_name="connectorName", + ) + connector_basic_info.connector_state = AAZStrType( + serialized_name="connectorState", + ) + connector_basic_info.connector_type = AAZStrType( + serialized_name="connectorType", + ) + + connector_service_type_info = _schema_connector_resource_read.properties.connector_service_type_info + connector_service_type_info.connector_service_type = AAZStrType( + serialized_name="connectorServiceType", + flags={"required": True}, + ) + + disc_azure_blob_storage_sink_connector = _schema_connector_resource_read.properties.connector_service_type_info.discriminate_by("connector_service_type", "AzureBlobStorageSinkConnector") + disc_azure_blob_storage_sink_connector.storage_account_key = AAZStrType( + serialized_name="storageAccountKey", + ) + disc_azure_blob_storage_sink_connector.storage_account_name = AAZStrType( + serialized_name="storageAccountName", + ) + disc_azure_blob_storage_sink_connector.storage_container_name = AAZStrType( + serialized_name="storageContainerName", + ) + + disc_azure_blob_storage_source_connector = _schema_connector_resource_read.properties.connector_service_type_info.discriminate_by("connector_service_type", "AzureBlobStorageSourceConnector") + disc_azure_blob_storage_source_connector.storage_account_key = AAZStrType( + serialized_name="storageAccountKey", + flags={"secret": True}, + ) + disc_azure_blob_storage_source_connector.storage_account_name = AAZStrType( + serialized_name="storageAccountName", + ) + disc_azure_blob_storage_source_connector.storage_container_name = AAZStrType( + serialized_name="storageContainerName", + ) + + disc_azure_cosmos_db_sink_connector = _schema_connector_resource_read.properties.connector_service_type_info.discriminate_by("connector_service_type", "AzureCosmosDBSinkConnector") + disc_azure_cosmos_db_sink_connector.cosmos_connection_endpoint = AAZStrType( + serialized_name="cosmosConnectionEndpoint", + ) + disc_azure_cosmos_db_sink_connector.cosmos_containers_topic_mapping = AAZStrType( + serialized_name="cosmosContainersTopicMapping", + ) + disc_azure_cosmos_db_sink_connector.cosmos_database_name = AAZStrType( + serialized_name="cosmosDatabaseName", + ) + disc_azure_cosmos_db_sink_connector.cosmos_id_strategy = AAZStrType( + serialized_name="cosmosIdStrategy", + ) + disc_azure_cosmos_db_sink_connector.cosmos_master_key = AAZStrType( + serialized_name="cosmosMasterKey", + ) + + disc_azure_cosmos_db_source_connector = _schema_connector_resource_read.properties.connector_service_type_info.discriminate_by("connector_service_type", "AzureCosmosDBSourceConnector") + disc_azure_cosmos_db_source_connector.cosmos_connection_endpoint = AAZStrType( + serialized_name="cosmosConnectionEndpoint", + ) + disc_azure_cosmos_db_source_connector.cosmos_containers_topic_mapping = AAZStrType( + serialized_name="cosmosContainersTopicMapping", + ) + disc_azure_cosmos_db_source_connector.cosmos_database_name = AAZStrType( + serialized_name="cosmosDatabaseName", + ) + disc_azure_cosmos_db_source_connector.cosmos_master_key = AAZStrType( + serialized_name="cosmosMasterKey", + ) + disc_azure_cosmos_db_source_connector.cosmos_message_key_enabled = AAZBoolType( + serialized_name="cosmosMessageKeyEnabled", + ) + disc_azure_cosmos_db_source_connector.cosmos_message_key_field = AAZStrType( + serialized_name="cosmosMessageKeyField", + ) + + disc_azure_synapse_analytics_sink_connector = _schema_connector_resource_read.properties.connector_service_type_info.discriminate_by("connector_service_type", "AzureSynapseAnalyticsSinkConnector") + disc_azure_synapse_analytics_sink_connector.synapse_sql_database_name = AAZStrType( + serialized_name="synapseSqlDatabaseName", + ) + disc_azure_synapse_analytics_sink_connector.synapse_sql_password = AAZStrType( + serialized_name="synapseSqlPassword", + ) + disc_azure_synapse_analytics_sink_connector.synapse_sql_server_name = AAZStrType( + serialized_name="synapseSqlServerName", + ) + disc_azure_synapse_analytics_sink_connector.synapse_sql_user = AAZStrType( + serialized_name="synapseSqlUser", + ) + + partner_connector_info = _schema_connector_resource_read.properties.partner_connector_info + partner_connector_info.partner_connector_type = AAZStrType( + serialized_name="partnerConnectorType", + flags={"required": True}, + ) + + disc_kafka_azure_blob_storage_sink = _schema_connector_resource_read.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureBlobStorageSink") + disc_kafka_azure_blob_storage_sink.api_key = AAZStrType( + serialized_name="apiKey", + ) + disc_kafka_azure_blob_storage_sink.api_secret = AAZStrType( + serialized_name="apiSecret", + ) + disc_kafka_azure_blob_storage_sink.auth_type = AAZStrType( + serialized_name="authType", + ) + disc_kafka_azure_blob_storage_sink.flush_size = AAZStrType( + serialized_name="flushSize", + ) + disc_kafka_azure_blob_storage_sink.input_format = AAZStrType( + serialized_name="inputFormat", + ) + disc_kafka_azure_blob_storage_sink.max_tasks = AAZStrType( + serialized_name="maxTasks", + ) + disc_kafka_azure_blob_storage_sink.output_format = AAZStrType( + serialized_name="outputFormat", + ) + disc_kafka_azure_blob_storage_sink.service_account_id = AAZStrType( + serialized_name="serviceAccountId", + ) + disc_kafka_azure_blob_storage_sink.time_interval = AAZStrType( + serialized_name="timeInterval", + ) + disc_kafka_azure_blob_storage_sink.topics = AAZListType() + disc_kafka_azure_blob_storage_sink.topics_dir = AAZStrType( + serialized_name="topicsDir", + ) + + topics = _schema_connector_resource_read.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureBlobStorageSink").topics + topics.Element = AAZStrType() + + disc_kafka_azure_blob_storage_source = _schema_connector_resource_read.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureBlobStorageSource") + disc_kafka_azure_blob_storage_source.api_key = AAZStrType( + serialized_name="apiKey", + ) + disc_kafka_azure_blob_storage_source.api_secret = AAZStrType( + serialized_name="apiSecret", + flags={"secret": True}, + ) + disc_kafka_azure_blob_storage_source.auth_type = AAZStrType( + serialized_name="authType", + ) + disc_kafka_azure_blob_storage_source.input_format = AAZStrType( + serialized_name="inputFormat", + ) + disc_kafka_azure_blob_storage_source.max_tasks = AAZStrType( + serialized_name="maxTasks", + ) + disc_kafka_azure_blob_storage_source.output_format = AAZStrType( + serialized_name="outputFormat", + ) + disc_kafka_azure_blob_storage_source.service_account_id = AAZStrType( + serialized_name="serviceAccountId", + ) + disc_kafka_azure_blob_storage_source.topic_regex = AAZStrType( + serialized_name="topicRegex", + ) + disc_kafka_azure_blob_storage_source.topics_dir = AAZStrType( + serialized_name="topicsDir", + ) + + disc_kafka_azure_cosmos_db_sink = _schema_connector_resource_read.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureCosmosDBSink") + disc_kafka_azure_cosmos_db_sink.api_key = AAZStrType( + serialized_name="apiKey", + ) + disc_kafka_azure_cosmos_db_sink.api_secret = AAZStrType( + serialized_name="apiSecret", + ) + disc_kafka_azure_cosmos_db_sink.auth_type = AAZStrType( + serialized_name="authType", + ) + disc_kafka_azure_cosmos_db_sink.flush_size = AAZStrType( + serialized_name="flushSize", + ) + disc_kafka_azure_cosmos_db_sink.input_format = AAZStrType( + serialized_name="inputFormat", + ) + disc_kafka_azure_cosmos_db_sink.max_tasks = AAZStrType( + serialized_name="maxTasks", + ) + disc_kafka_azure_cosmos_db_sink.output_format = AAZStrType( + serialized_name="outputFormat", + ) + disc_kafka_azure_cosmos_db_sink.service_account_id = AAZStrType( + serialized_name="serviceAccountId", + ) + disc_kafka_azure_cosmos_db_sink.time_interval = AAZStrType( + serialized_name="timeInterval", + ) + disc_kafka_azure_cosmos_db_sink.topics = AAZListType() + disc_kafka_azure_cosmos_db_sink.topics_dir = AAZStrType( + serialized_name="topicsDir", + ) + + topics = _schema_connector_resource_read.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureCosmosDBSink").topics + topics.Element = AAZStrType() + + disc_kafka_azure_cosmos_db_source = _schema_connector_resource_read.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureCosmosDBSource") + disc_kafka_azure_cosmos_db_source.api_key = AAZStrType( + serialized_name="apiKey", + ) + disc_kafka_azure_cosmos_db_source.api_secret = AAZStrType( + serialized_name="apiSecret", + flags={"secret": True}, + ) + disc_kafka_azure_cosmos_db_source.auth_type = AAZStrType( + serialized_name="authType", + ) + disc_kafka_azure_cosmos_db_source.input_format = AAZStrType( + serialized_name="inputFormat", + ) + disc_kafka_azure_cosmos_db_source.max_tasks = AAZStrType( + serialized_name="maxTasks", + ) + disc_kafka_azure_cosmos_db_source.output_format = AAZStrType( + serialized_name="outputFormat", + ) + disc_kafka_azure_cosmos_db_source.service_account_id = AAZStrType( + serialized_name="serviceAccountId", + ) + disc_kafka_azure_cosmos_db_source.topic_regex = AAZStrType( + serialized_name="topicRegex", + ) + disc_kafka_azure_cosmos_db_source.topics_dir = AAZStrType( + serialized_name="topicsDir", + ) + + disc_kafka_azure_synapse_analytics_sink = _schema_connector_resource_read.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureSynapseAnalyticsSink") + disc_kafka_azure_synapse_analytics_sink.api_key = AAZStrType( + serialized_name="apiKey", + ) + disc_kafka_azure_synapse_analytics_sink.api_secret = AAZStrType( + serialized_name="apiSecret", + ) + disc_kafka_azure_synapse_analytics_sink.auth_type = AAZStrType( + serialized_name="authType", + ) + disc_kafka_azure_synapse_analytics_sink.flush_size = AAZStrType( + serialized_name="flushSize", + ) + disc_kafka_azure_synapse_analytics_sink.input_format = AAZStrType( + serialized_name="inputFormat", + ) + disc_kafka_azure_synapse_analytics_sink.max_tasks = AAZStrType( + serialized_name="maxTasks", + ) + disc_kafka_azure_synapse_analytics_sink.output_format = AAZStrType( + serialized_name="outputFormat", + ) + disc_kafka_azure_synapse_analytics_sink.service_account_id = AAZStrType( + serialized_name="serviceAccountId", + ) + disc_kafka_azure_synapse_analytics_sink.time_interval = AAZStrType( + serialized_name="timeInterval", + ) + disc_kafka_azure_synapse_analytics_sink.topics = AAZListType() + disc_kafka_azure_synapse_analytics_sink.topics_dir = AAZStrType( + serialized_name="topicsDir", + ) + + topics = _schema_connector_resource_read.properties.partner_connector_info.discriminate_by("partner_connector_type", "KafkaAzureSynapseAnalyticsSink").topics + topics.Element = AAZStrType() + + system_data = _schema_connector_resource_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_connector_resource_read.id + _schema.name = cls._schema_connector_resource_read.name + _schema.properties = cls._schema_connector_resource_read.properties + _schema.system_data = cls._schema_connector_resource_read.system_data + _schema.type = cls._schema_connector_resource_read.type + + +__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/topic/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/topic/__cmd_group.py new file mode 100644 index 00000000000..b46b0a18e78 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/topic/__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( + "confluent organization environment cluster topic", +) +class __CMDGroup(AAZCommandGroup): + """Manage Topic + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/topic/__init__.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/topic/__init__.py new file mode 100644 index 00000000000..c401f439385 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/topic/__init__.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/topic/_create.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/topic/_create.py new file mode 100644 index 00000000000..227660b176b --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/topic/_create.py @@ -0,0 +1,390 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization environment cluster topic create", +) +class Create(AAZCommand): + """Create confluent topics by Name + """ + + _aaz_info = { + "version": "2024-07-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/environments/{}/clusters/{}/topics/{}", "2024-07-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.cluster_id = AAZStrArg( + options=["--cluster-id"], + help="Confluent kafka or schema registry cluster id", + required=True, + ) + _args_schema.environment_id = AAZStrArg( + options=["--environment-id"], + help="Confluent environment id", + required=True, + ) + _args_schema.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.topic_name = AAZStrArg( + options=["-n", "--name", "--topic-name"], + help="Confluent kafka or schema registry topic name", + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.configs = AAZObjectArg( + options=["--configs"], + arg_group="Properties", + help="Config Specification of the topic", + ) + cls._build_args_topics_related_link_create(_args_schema.configs) + _args_schema.input_configs = AAZListArg( + options=["--input-configs"], + arg_group="Properties", + help="Input Config Specification of the topic", + ) + _args_schema.kind = AAZStrArg( + options=["--kind"], + arg_group="Properties", + help="Type of topic", + ) + _args_schema.metadata = AAZObjectArg( + options=["--metadata"], + arg_group="Properties", + help="Metadata of the record", + ) + _args_schema.partitions = AAZObjectArg( + options=["--partitions"], + arg_group="Properties", + help="Partition Specification of the topic", + ) + cls._build_args_topics_related_link_create(_args_schema.partitions) + _args_schema.partitions_count = AAZStrArg( + options=["--partitions-count"], + arg_group="Properties", + help="Partition count of the topic", + ) + _args_schema.partitions_reassignments = AAZObjectArg( + options=["--partitions-reassignments"], + arg_group="Properties", + help="Partition Reassignment Specification of the topic", + ) + cls._build_args_topics_related_link_create(_args_schema.partitions_reassignments) + _args_schema.replication_factor = AAZStrArg( + options=["--replication-factor"], + arg_group="Properties", + help="Replication factor of the topic", + ) + _args_schema.topic_id = AAZStrArg( + options=["--topic-id"], + arg_group="Properties", + help="Topic Id returned by Confluent", + ) + + input_configs = cls._args_schema.input_configs + input_configs.Element = AAZObjectArg() + + _element = cls._args_schema.input_configs.Element + _element.name = AAZStrArg( + options=["name"], + help="Name of the topic input config", + ) + _element.value = AAZStrArg( + options=["value"], + help="Value of the topic input config", + ) + + metadata = cls._args_schema.metadata + metadata.resource_name = AAZStrArg( + options=["resource-name"], + help="Resource name of the record", + ) + metadata.self = AAZStrArg( + options=["self"], + help="Self lookup url", + ) + return cls._args_schema + + _args_topics_related_link_create = None + + @classmethod + def _build_args_topics_related_link_create(cls, _schema): + if cls._args_topics_related_link_create is not None: + _schema.related = cls._args_topics_related_link_create.related + return + + cls._args_topics_related_link_create = AAZObjectArg() + + topics_related_link_create = cls._args_topics_related_link_create + topics_related_link_create.related = AAZStrArg( + options=["related"], + help="Relationship of the topic", + ) + + _schema.related = cls._args_topics_related_link_create.related + + def _execute_operations(self): + self.pre_operations() + self.TopicsCreate(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 TopicsCreate(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.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/topics/{topicName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterId", self.ctx.args.cluster_id, + required=True, + ), + **self.serialize_url_param( + "environmentId", self.ctx.args.environment_id, + required=True, + ), + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "topicName", self.ctx.args.topic_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-07-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": {"client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + _CreateHelper._build_schema_topics_related_link_create(properties.set_prop("configs", AAZObjectType, ".configs")) + properties.set_prop("inputConfigs", AAZListType, ".input_configs") + properties.set_prop("kind", AAZStrType, ".kind") + properties.set_prop("metadata", AAZObjectType, ".metadata") + _CreateHelper._build_schema_topics_related_link_create(properties.set_prop("partitions", AAZObjectType, ".partitions")) + properties.set_prop("partitionsCount", AAZStrType, ".partitions_count") + _CreateHelper._build_schema_topics_related_link_create(properties.set_prop("partitionsReassignments", AAZObjectType, ".partitions_reassignments")) + properties.set_prop("replicationFactor", AAZStrType, ".replication_factor") + properties.set_prop("topicId", AAZStrType, ".topic_id") + + input_configs = _builder.get(".properties.inputConfigs") + if input_configs is not None: + input_configs.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.inputConfigs[]") + if _elements is not None: + _elements.set_prop("name", AAZStrType, ".name") + _elements.set_prop("value", AAZStrType, ".value") + + metadata = _builder.get(".properties.metadata") + if metadata is not None: + metadata.set_prop("resourceName", AAZStrType, ".resource_name") + metadata.set_prop("self", AAZStrType, ".self") + + 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( + flags={"client_flatten": True}, + ) + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.configs = AAZObjectType() + _CreateHelper._build_schema_topics_related_link_read(properties.configs) + properties.input_configs = AAZListType( + serialized_name="inputConfigs", + ) + properties.kind = AAZStrType() + properties.metadata = AAZObjectType() + properties.partitions = AAZObjectType() + _CreateHelper._build_schema_topics_related_link_read(properties.partitions) + properties.partitions_count = AAZStrType( + serialized_name="partitionsCount", + ) + properties.partitions_reassignments = AAZObjectType( + serialized_name="partitionsReassignments", + ) + _CreateHelper._build_schema_topics_related_link_read(properties.partitions_reassignments) + properties.replication_factor = AAZStrType( + serialized_name="replicationFactor", + ) + properties.topic_id = AAZStrType( + serialized_name="topicId", + ) + + input_configs = cls._schema_on_200_201.properties.input_configs + input_configs.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.input_configs.Element + _element.name = AAZStrType() + _element.value = AAZStrType() + + metadata = cls._schema_on_200_201.properties.metadata + metadata.resource_name = AAZStrType( + serialized_name="resourceName", + ) + metadata.self = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + @classmethod + def _build_schema_topics_related_link_create(cls, _builder): + if _builder is None: + return + _builder.set_prop("related", AAZStrType, ".related") + + _schema_topics_related_link_read = None + + @classmethod + def _build_schema_topics_related_link_read(cls, _schema): + if cls._schema_topics_related_link_read is not None: + _schema.related = cls._schema_topics_related_link_read.related + return + + cls._schema_topics_related_link_read = _schema_topics_related_link_read = AAZObjectType() + + topics_related_link_read = _schema_topics_related_link_read + topics_related_link_read.related = AAZStrType() + + _schema.related = cls._schema_topics_related_link_read.related + + +__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/topic/_delete.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/topic/_delete.py new file mode 100644 index 00000000000..ba20f7b841e --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/topic/_delete.py @@ -0,0 +1,190 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization environment cluster topic delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete confluent topic by name + """ + + _aaz_info = { + "version": "2024-07-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/environments/{}/clusters/{}/topics/{}", "2024-07-01"], + ] + } + + 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.cluster_id = AAZStrArg( + options=["--cluster-id"], + help="Confluent kafka or schema registry cluster id", + required=True, + id_part="child_name_2", + ) + _args_schema.environment_id = AAZStrArg( + options=["--environment-id"], + help="Confluent environment id", + required=True, + id_part="child_name_1", + ) + _args_schema.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.topic_name = AAZStrArg( + options=["-n", "--name", "--topic-name"], + help="Confluent kafka or schema registry topic name", + required=True, + id_part="child_name_3", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.TopicsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class TopicsDelete(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.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/topics/{topicName}", + **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( + "clusterId", self.ctx.args.cluster_id, + required=True, + ), + **self.serialize_url_param( + "environmentId", self.ctx.args.environment_id, + required=True, + ), + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "topicName", self.ctx.args.topic_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-07-01", + 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/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/topic/_list.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/topic/_list.py new file mode 100644 index 00000000000..5ecd2167e3a --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/topic/_list.py @@ -0,0 +1,267 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "confluent organization environment cluster topic list", +) +class List(AAZCommand): + """List of all the topics in a clusters + """ + + _aaz_info = { + "version": "2024-07-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/environments/{}/clusters/{}/topics", "2024-07-01"], + ] + } + + 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.cluster_id = AAZStrArg( + options=["--cluster-id"], + help="Confluent kafka or schema registry cluster id", + required=True, + ) + _args_schema.environment_id = AAZStrArg( + options=["--environment-id"], + help="Confluent environment id", + required=True, + ) + _args_schema.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.page_size = AAZIntArg( + options=["--page-size"], + help="Pagination size", + ) + _args_schema.page_token = AAZStrArg( + options=["--page-token"], + help="An opaque pagination token to fetch the next set of records", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.TopicsList(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 TopicsList(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.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/topics", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterId", self.ctx.args.cluster_id, + required=True, + ), + **self.serialize_url_param( + "environmentId", self.ctx.args.environment_id, + required=True, + ), + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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( + "pageSize", self.ctx.args.page_size, + ), + **self.serialize_query_param( + "pageToken", self.ctx.args.page_token, + ), + **self.serialize_query_param( + "api-version", "2024-07-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.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.configs = AAZObjectType() + _ListHelper._build_schema_topics_related_link_read(properties.configs) + properties.input_configs = AAZListType( + serialized_name="inputConfigs", + ) + properties.kind = AAZStrType() + properties.metadata = AAZObjectType() + properties.partitions = AAZObjectType() + _ListHelper._build_schema_topics_related_link_read(properties.partitions) + properties.partitions_count = AAZStrType( + serialized_name="partitionsCount", + ) + properties.partitions_reassignments = AAZObjectType( + serialized_name="partitionsReassignments", + ) + _ListHelper._build_schema_topics_related_link_read(properties.partitions_reassignments) + properties.replication_factor = AAZStrType( + serialized_name="replicationFactor", + ) + properties.topic_id = AAZStrType( + serialized_name="topicId", + ) + + input_configs = cls._schema_on_200.value.Element.properties.input_configs + input_configs.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.input_configs.Element + _element.name = AAZStrType() + _element.value = AAZStrType() + + metadata = cls._schema_on_200.value.Element.properties.metadata + metadata.resource_name = AAZStrType( + serialized_name="resourceName", + ) + metadata.self = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + _schema_topics_related_link_read = None + + @classmethod + def _build_schema_topics_related_link_read(cls, _schema): + if cls._schema_topics_related_link_read is not None: + _schema.related = cls._schema_topics_related_link_read.related + return + + cls._schema_topics_related_link_read = _schema_topics_related_link_read = AAZObjectType() + + topics_related_link_read = _schema_topics_related_link_read + topics_related_link_read.related = AAZStrType() + + _schema.related = cls._schema_topics_related_link_read.related + + +__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/topic/_show.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/topic/_show.py new file mode 100644 index 00000000000..e3d5a091beb --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/topic/_show.py @@ -0,0 +1,255 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization environment cluster topic show", +) +class Show(AAZCommand): + """Get confluent topic by Name + """ + + _aaz_info = { + "version": "2024-07-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/environments/{}/clusters/{}/topics/{}", "2024-07-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.cluster_id = AAZStrArg( + options=["--cluster-id"], + help="Confluent kafka or schema registry cluster id", + required=True, + id_part="child_name_2", + ) + _args_schema.environment_id = AAZStrArg( + options=["--environment-id"], + help="Confluent environment id", + required=True, + id_part="child_name_1", + ) + _args_schema.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.topic_name = AAZStrArg( + options=["-n", "--name", "--topic-name"], + help="Confluent kafka or schema registry topic name", + required=True, + id_part="child_name_3", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.TopicsGet(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 TopicsGet(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.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/topics/{topicName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterId", self.ctx.args.cluster_id, + required=True, + ), + **self.serialize_url_param( + "environmentId", self.ctx.args.environment_id, + required=True, + ), + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "topicName", self.ctx.args.topic_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-07-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.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.configs = AAZObjectType() + _ShowHelper._build_schema_topics_related_link_read(properties.configs) + properties.input_configs = AAZListType( + serialized_name="inputConfigs", + ) + properties.kind = AAZStrType() + properties.metadata = AAZObjectType() + properties.partitions = AAZObjectType() + _ShowHelper._build_schema_topics_related_link_read(properties.partitions) + properties.partitions_count = AAZStrType( + serialized_name="partitionsCount", + ) + properties.partitions_reassignments = AAZObjectType( + serialized_name="partitionsReassignments", + ) + _ShowHelper._build_schema_topics_related_link_read(properties.partitions_reassignments) + properties.replication_factor = AAZStrType( + serialized_name="replicationFactor", + ) + properties.topic_id = AAZStrType( + serialized_name="topicId", + ) + + input_configs = cls._schema_on_200.properties.input_configs + input_configs.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.input_configs.Element + _element.name = AAZStrType() + _element.value = AAZStrType() + + metadata = cls._schema_on_200.properties.metadata + metadata.resource_name = AAZStrType( + serialized_name="resourceName", + ) + metadata.self = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + _schema_topics_related_link_read = None + + @classmethod + def _build_schema_topics_related_link_read(cls, _schema): + if cls._schema_topics_related_link_read is not None: + _schema.related = cls._schema_topics_related_link_read.related + return + + cls._schema_topics_related_link_read = _schema_topics_related_link_read = AAZObjectType() + + topics_related_link_read = _schema_topics_related_link_read + topics_related_link_read.related = AAZStrType() + + _schema.related = cls._schema_topics_related_link_read.related + + +__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/topic/_update.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/topic/_update.py new file mode 100644 index 00000000000..71fade572c6 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/cluster/topic/_update.py @@ -0,0 +1,562 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization environment cluster topic update", +) +class Update(AAZCommand): + """Update confluent topics by Name + """ + + _aaz_info = { + "version": "2024-07-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/environments/{}/clusters/{}/topics/{}", "2024-07-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.cluster_id = AAZStrArg( + options=["--cluster-id"], + help="Confluent kafka or schema registry cluster id", + required=True, + id_part="child_name_2", + ) + _args_schema.environment_id = AAZStrArg( + options=["--environment-id"], + help="Confluent environment id", + required=True, + id_part="child_name_1", + ) + _args_schema.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.topic_name = AAZStrArg( + options=["-n", "--name", "--topic-name"], + help="Confluent kafka or schema registry topic name", + required=True, + id_part="child_name_3", + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.configs = AAZObjectArg( + options=["--configs"], + arg_group="Properties", + help="Config Specification of the topic", + nullable=True, + ) + cls._build_args_topics_related_link_update(_args_schema.configs) + _args_schema.input_configs = AAZListArg( + options=["--input-configs"], + arg_group="Properties", + help="Input Config Specification of the topic", + nullable=True, + ) + _args_schema.kind = AAZStrArg( + options=["--kind"], + arg_group="Properties", + help="Type of topic", + nullable=True, + ) + _args_schema.metadata = AAZObjectArg( + options=["--metadata"], + arg_group="Properties", + help="Metadata of the record", + nullable=True, + ) + _args_schema.partitions = AAZObjectArg( + options=["--partitions"], + arg_group="Properties", + help="Partition Specification of the topic", + nullable=True, + ) + cls._build_args_topics_related_link_update(_args_schema.partitions) + _args_schema.partitions_count = AAZStrArg( + options=["--partitions-count"], + arg_group="Properties", + help="Partition count of the topic", + nullable=True, + ) + _args_schema.partitions_reassignments = AAZObjectArg( + options=["--partitions-reassignments"], + arg_group="Properties", + help="Partition Reassignment Specification of the topic", + nullable=True, + ) + cls._build_args_topics_related_link_update(_args_schema.partitions_reassignments) + _args_schema.replication_factor = AAZStrArg( + options=["--replication-factor"], + arg_group="Properties", + help="Replication factor of the topic", + nullable=True, + ) + _args_schema.topic_id = AAZStrArg( + options=["--topic-id"], + arg_group="Properties", + help="Topic Id returned by Confluent", + nullable=True, + ) + + input_configs = cls._args_schema.input_configs + input_configs.Element = AAZObjectArg( + nullable=True, + ) + + _element = cls._args_schema.input_configs.Element + _element.name = AAZStrArg( + options=["name"], + help="Name of the topic input config", + nullable=True, + ) + _element.value = AAZStrArg( + options=["value"], + help="Value of the topic input config", + nullable=True, + ) + + metadata = cls._args_schema.metadata + metadata.resource_name = AAZStrArg( + options=["resource-name"], + help="Resource name of the record", + nullable=True, + ) + metadata.self = AAZStrArg( + options=["self"], + help="Self lookup url", + nullable=True, + ) + return cls._args_schema + + _args_topics_related_link_update = None + + @classmethod + def _build_args_topics_related_link_update(cls, _schema): + if cls._args_topics_related_link_update is not None: + _schema.related = cls._args_topics_related_link_update.related + return + + cls._args_topics_related_link_update = AAZObjectArg( + nullable=True, + ) + + topics_related_link_update = cls._args_topics_related_link_update + topics_related_link_update.related = AAZStrArg( + options=["related"], + help="Relationship of the topic", + nullable=True, + ) + + _schema.related = cls._args_topics_related_link_update.related + + def _execute_operations(self): + self.pre_operations() + self.TopicsGet(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.TopicsCreate(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 TopicsGet(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.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/topics/{topicName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterId", self.ctx.args.cluster_id, + required=True, + ), + **self.serialize_url_param( + "environmentId", self.ctx.args.environment_id, + required=True, + ), + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "topicName", self.ctx.args.topic_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-07-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_topic_record_read(cls._schema_on_200) + + return cls._schema_on_200 + + class TopicsCreate(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.Confluent/organizations/{organizationName}/environments/{environmentId}/clusters/{clusterId}/topics/{topicName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterId", self.ctx.args.cluster_id, + required=True, + ), + **self.serialize_url_param( + "environmentId", self.ctx.args.environment_id, + required=True, + ), + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "topicName", self.ctx.args.topic_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-07-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_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_topic_record_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + _UpdateHelper._build_schema_topics_related_link_update(properties.set_prop("configs", AAZObjectType, ".configs")) + properties.set_prop("inputConfigs", AAZListType, ".input_configs") + properties.set_prop("kind", AAZStrType, ".kind") + properties.set_prop("metadata", AAZObjectType, ".metadata") + _UpdateHelper._build_schema_topics_related_link_update(properties.set_prop("partitions", AAZObjectType, ".partitions")) + properties.set_prop("partitionsCount", AAZStrType, ".partitions_count") + _UpdateHelper._build_schema_topics_related_link_update(properties.set_prop("partitionsReassignments", AAZObjectType, ".partitions_reassignments")) + properties.set_prop("replicationFactor", AAZStrType, ".replication_factor") + properties.set_prop("topicId", AAZStrType, ".topic_id") + + input_configs = _builder.get(".properties.inputConfigs") + if input_configs is not None: + input_configs.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.inputConfigs[]") + if _elements is not None: + _elements.set_prop("name", AAZStrType, ".name") + _elements.set_prop("value", AAZStrType, ".value") + + metadata = _builder.get(".properties.metadata") + if metadata is not None: + metadata.set_prop("resourceName", AAZStrType, ".resource_name") + metadata.set_prop("self", AAZStrType, ".self") + + return _instance_value + + class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance_by_generic( + self.ctx.vars.instance, + self.ctx.generic_update_args + ) + + +class _UpdateHelper: + """Helper class for Update""" + + @classmethod + def _build_schema_topics_related_link_update(cls, _builder): + if _builder is None: + return + _builder.set_prop("related", AAZStrType, ".related") + + _schema_topic_record_read = None + + @classmethod + def _build_schema_topic_record_read(cls, _schema): + if cls._schema_topic_record_read is not None: + _schema.id = cls._schema_topic_record_read.id + _schema.name = cls._schema_topic_record_read.name + _schema.properties = cls._schema_topic_record_read.properties + _schema.type = cls._schema_topic_record_read.type + return + + cls._schema_topic_record_read = _schema_topic_record_read = AAZObjectType() + + topic_record_read = _schema_topic_record_read + topic_record_read.id = AAZStrType( + flags={"read_only": True}, + ) + topic_record_read.name = AAZStrType( + flags={"read_only": True}, + ) + topic_record_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + topic_record_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_topic_record_read.properties + properties.configs = AAZObjectType() + cls._build_schema_topics_related_link_read(properties.configs) + properties.input_configs = AAZListType( + serialized_name="inputConfigs", + ) + properties.kind = AAZStrType() + properties.metadata = AAZObjectType() + properties.partitions = AAZObjectType() + cls._build_schema_topics_related_link_read(properties.partitions) + properties.partitions_count = AAZStrType( + serialized_name="partitionsCount", + ) + properties.partitions_reassignments = AAZObjectType( + serialized_name="partitionsReassignments", + ) + cls._build_schema_topics_related_link_read(properties.partitions_reassignments) + properties.replication_factor = AAZStrType( + serialized_name="replicationFactor", + ) + properties.topic_id = AAZStrType( + serialized_name="topicId", + ) + + input_configs = _schema_topic_record_read.properties.input_configs + input_configs.Element = AAZObjectType() + + _element = _schema_topic_record_read.properties.input_configs.Element + _element.name = AAZStrType() + _element.value = AAZStrType() + + metadata = _schema_topic_record_read.properties.metadata + metadata.resource_name = AAZStrType( + serialized_name="resourceName", + ) + metadata.self = AAZStrType() + + _schema.id = cls._schema_topic_record_read.id + _schema.name = cls._schema_topic_record_read.name + _schema.properties = cls._schema_topic_record_read.properties + _schema.type = cls._schema_topic_record_read.type + + _schema_topics_related_link_read = None + + @classmethod + def _build_schema_topics_related_link_read(cls, _schema): + if cls._schema_topics_related_link_read is not None: + _schema.related = cls._schema_topics_related_link_read.related + return + + cls._schema_topics_related_link_read = _schema_topics_related_link_read = AAZObjectType() + + topics_related_link_read = _schema_topics_related_link_read + topics_related_link_read.related = AAZStrType() + + _schema.related = cls._schema_topics_related_link_read.related + + +__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/schema_registry_cluster/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/schema_registry_cluster/__cmd_group.py new file mode 100644 index 00000000000..4c4512cdbe0 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/schema_registry_cluster/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "confluent organization environment schema-registry-cluster", +) +class __CMDGroup(AAZCommandGroup): + """Retrieve details of Schema Registry clusters within a Confluent environment. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/schema_registry_cluster/__init__.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/schema_registry_cluster/__init__.py new file mode 100644 index 00000000000..2df85698253 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/schema_registry_cluster/__init__.py @@ -0,0 +1,13 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._list import * +from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/schema_registry_cluster/_list.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/schema_registry_cluster/_list.py new file mode 100644 index 00000000000..b64ed81e3ba --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/schema_registry_cluster/_list.py @@ -0,0 +1,257 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization environment schema-registry-cluster list", +) +class List(AAZCommand): + """List all Schema Registry clusters within a Confluent environment. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/environments/{}/schemaregistryclusters", "2024-02-13"], + ] + } + + 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.environment_id = AAZStrArg( + options=["--environment-id"], + help="Confluent environment id", + required=True, + ) + _args_schema.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.page_size = AAZIntArg( + options=["--page-size"], + help="Pagination size", + ) + _args_schema.page_token = AAZStrArg( + options=["--page-token"], + help="An opaque pagination token to fetch the next set of records", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.OrganizationListSchemaRegistryClusters(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 OrganizationListSchemaRegistryClusters(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.Confluent/organizations/{organizationName}/environments/{environmentId}/schemaRegistryClusters", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "environmentId", self.ctx.args.environment_id, + required=True, + ), + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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( + "pageSize", self.ctx.args.page_size, + ), + **self.serialize_query_param( + "pageToken", self.ctx.args.page_token, + ), + **self.serialize_query_param( + "api-version", "2024-02-13", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType() + _element.kind = AAZStrType() + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.metadata = AAZObjectType() + properties.spec = AAZObjectType() + properties.status = AAZObjectType() + + metadata = cls._schema_on_200.value.Element.properties.metadata + metadata.created_timestamp = AAZStrType( + serialized_name="createdTimestamp", + ) + metadata.deleted_timestamp = AAZStrType( + serialized_name="deletedTimestamp", + ) + metadata.resource_name = AAZStrType( + serialized_name="resourceName", + ) + metadata.self = AAZStrType() + metadata.updated_timestamp = AAZStrType( + serialized_name="updatedTimestamp", + ) + + spec = cls._schema_on_200.value.Element.properties.spec + spec.cloud = AAZStrType() + spec.environment = AAZObjectType() + _ListHelper._build_schema_schema_registry_cluster_environment_region_entity_read(spec.environment) + spec.http_endpoint = AAZStrType( + serialized_name="httpEndpoint", + ) + spec.name = AAZStrType() + spec.package = AAZStrType() + spec.region = AAZObjectType() + _ListHelper._build_schema_schema_registry_cluster_environment_region_entity_read(spec.region) + + status = cls._schema_on_200.value.Element.properties.status + status.phase = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + _schema_schema_registry_cluster_environment_region_entity_read = None + + @classmethod + def _build_schema_schema_registry_cluster_environment_region_entity_read(cls, _schema): + if cls._schema_schema_registry_cluster_environment_region_entity_read is not None: + _schema.id = cls._schema_schema_registry_cluster_environment_region_entity_read.id + _schema.related = cls._schema_schema_registry_cluster_environment_region_entity_read.related + _schema.resource_name = cls._schema_schema_registry_cluster_environment_region_entity_read.resource_name + return + + cls._schema_schema_registry_cluster_environment_region_entity_read = _schema_schema_registry_cluster_environment_region_entity_read = AAZObjectType() + + schema_registry_cluster_environment_region_entity_read = _schema_schema_registry_cluster_environment_region_entity_read + schema_registry_cluster_environment_region_entity_read.id = AAZStrType() + schema_registry_cluster_environment_region_entity_read.related = AAZStrType() + schema_registry_cluster_environment_region_entity_read.resource_name = AAZStrType( + serialized_name="resourceName", + ) + + _schema.id = cls._schema_schema_registry_cluster_environment_region_entity_read.id + _schema.related = cls._schema_schema_registry_cluster_environment_region_entity_read.related + _schema.resource_name = cls._schema_schema_registry_cluster_environment_region_entity_read.resource_name + + +__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/schema_registry_cluster/_show.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/schema_registry_cluster/_show.py new file mode 100644 index 00000000000..67ac16fa663 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/environment/schema_registry_cluster/_show.py @@ -0,0 +1,244 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization environment schema-registry-cluster show", +) +class Show(AAZCommand): + """Retrieve details of a specific Schema Registry cluster by its ID. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/environments/{}/schemaregistryclusters/{}", "2024-02-13"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cluster_id = AAZStrArg( + options=["--cluster-id"], + help="Confluent kafka or schema registry cluster id prefixed with lkc or lks", + required=True, + id_part="child_name_2", + ) + _args_schema.environment_id = AAZStrArg( + options=["--environment-id"], + help="Confluent environment id", + required=True, + id_part="child_name_1", + ) + _args_schema.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.OrganizationGetSchemaRegistryClusterById(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 OrganizationGetSchemaRegistryClusterById(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.Confluent/organizations/{organizationName}/environments/{environmentId}/schemaRegistryClusters/{clusterId}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterId", self.ctx.args.cluster_id, + required=True, + ), + **self.serialize_url_param( + "environmentId", self.ctx.args.environment_id, + required=True, + ), + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + 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() + _schema_on_200.kind = AAZStrType() + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + + properties = cls._schema_on_200.properties + properties.metadata = AAZObjectType() + properties.spec = AAZObjectType() + properties.status = AAZObjectType() + + metadata = cls._schema_on_200.properties.metadata + metadata.created_timestamp = AAZStrType( + serialized_name="createdTimestamp", + ) + metadata.deleted_timestamp = AAZStrType( + serialized_name="deletedTimestamp", + ) + metadata.resource_name = AAZStrType( + serialized_name="resourceName", + ) + metadata.self = AAZStrType() + metadata.updated_timestamp = AAZStrType( + serialized_name="updatedTimestamp", + ) + + spec = cls._schema_on_200.properties.spec + spec.cloud = AAZStrType() + spec.environment = AAZObjectType() + _ShowHelper._build_schema_schema_registry_cluster_environment_region_entity_read(spec.environment) + spec.http_endpoint = AAZStrType( + serialized_name="httpEndpoint", + ) + spec.name = AAZStrType() + spec.package = AAZStrType() + spec.region = AAZObjectType() + _ShowHelper._build_schema_schema_registry_cluster_environment_region_entity_read(spec.region) + + status = cls._schema_on_200.properties.status + status.phase = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + _schema_schema_registry_cluster_environment_region_entity_read = None + + @classmethod + def _build_schema_schema_registry_cluster_environment_region_entity_read(cls, _schema): + if cls._schema_schema_registry_cluster_environment_region_entity_read is not None: + _schema.id = cls._schema_schema_registry_cluster_environment_region_entity_read.id + _schema.related = cls._schema_schema_registry_cluster_environment_region_entity_read.related + _schema.resource_name = cls._schema_schema_registry_cluster_environment_region_entity_read.resource_name + return + + cls._schema_schema_registry_cluster_environment_region_entity_read = _schema_schema_registry_cluster_environment_region_entity_read = AAZObjectType() + + schema_registry_cluster_environment_region_entity_read = _schema_schema_registry_cluster_environment_region_entity_read + schema_registry_cluster_environment_region_entity_read.id = AAZStrType() + schema_registry_cluster_environment_region_entity_read.related = AAZStrType() + schema_registry_cluster_environment_region_entity_read.resource_name = AAZStrType( + serialized_name="resourceName", + ) + + _schema.id = cls._schema_schema_registry_cluster_environment_region_entity_read.id + _schema.related = cls._schema_schema_registry_cluster_environment_region_entity_read.related + _schema.resource_name = cls._schema_schema_registry_cluster_environment_region_entity_read.resource_name + + +__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/role_binding/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/role_binding/__cmd_group.py new file mode 100644 index 00000000000..9a9f70b3bc2 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/role_binding/__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( + "confluent organization role-binding", +) +class __CMDGroup(AAZCommandGroup): + """Manage role bindings within a Confluent organization. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/role_binding/__init__.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/role_binding/__init__.py new file mode 100644 index 00000000000..af9cedd3228 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/role_binding/__init__.py @@ -0,0 +1,12 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._delete import * diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/role_binding/_delete.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/role_binding/_delete.py new file mode 100644 index 00000000000..577a5ef9eaf --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/organization/role_binding/_delete.py @@ -0,0 +1,146 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent organization role-binding delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete role bindings within a Confluent organization. + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/organizations/{}/access/default/deleterolebinding/{}", "2024-02-13"], + ] + } + + 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.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.role_binding_id = AAZStrArg( + options=["--role-binding-id"], + help="Confluent Role binding id", + required=True, + id_part="child_name_2", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AccessDeleteRoleBinding(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class AccessDeleteRoleBinding(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.Confluent/organizations/{organizationName}/access/default/deleteRoleBinding/{roleBindingId}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "roleBindingId", self.ctx.args.role_binding_id, + 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-02-13", + 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/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/validation/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/validation/__cmd_group.py new file mode 100644 index 00000000000..e2a1e355487 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/validation/__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( + "confluent validation", +) +class __CMDGroup(AAZCommandGroup): + """Manage Validation + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/validation/__init__.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/validation/__init__.py new file mode 100644 index 00000000000..6d3edf0ca3a --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/validation/__init__.py @@ -0,0 +1,13 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._orgvalidate import * +from ._orgvalidate_v2 import * diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/validation/_orgvalidate.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/validation/_orgvalidate.py new file mode 100644 index 00000000000..3a9fc0c3b99 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/validation/_orgvalidate.py @@ -0,0 +1,481 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent validation orgvalidate", +) +class Orgvalidate(AAZCommand): + """Organization Validate proxy resource + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/validations/{}/orgvalidate", "2024-02-13"], + ] + } + + 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.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Body" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Body", + help="Location of Organization resource", + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Body", + help="Organization resource tags", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.link_organization = AAZObjectArg( + options=["--link-organization"], + arg_group="Properties", + help="Link an existing Confluent organization", + ) + _args_schema.offer_detail = AAZObjectArg( + options=["--offer-detail"], + arg_group="Properties", + help="Confluent offer detail", + required=True, + ) + _args_schema.user_detail = AAZObjectArg( + options=["--user-detail"], + arg_group="Properties", + help="Subscriber detail", + required=True, + ) + + link_organization = cls._args_schema.link_organization + link_organization.token = AAZStrArg( + options=["token"], + help="User auth token", + required=True, + ) + + offer_detail = cls._args_schema.offer_detail + offer_detail.id = AAZStrArg( + options=["id"], + help="Offer Id", + required=True, + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + offer_detail.plan_id = AAZStrArg( + options=["plan-id"], + help="Offer Plan Id", + required=True, + fmt=AAZStrArgFormat( + max_length=200, + ), + ) + offer_detail.plan_name = AAZStrArg( + options=["plan-name"], + help="Offer Plan Name", + required=True, + fmt=AAZStrArgFormat( + max_length=200, + ), + ) + offer_detail.private_offer_id = AAZStrArg( + options=["private-offer-id"], + help="Private Offer Id", + fmt=AAZStrArgFormat( + max_length=255, + ), + ) + offer_detail.private_offer_ids = AAZListArg( + options=["private-offer-ids"], + help="Array of Private Offer Ids", + ) + offer_detail.publisher_id = AAZStrArg( + options=["publisher-id"], + help="Publisher Id", + required=True, + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + offer_detail.status = AAZStrArg( + options=["status"], + help="SaaS Offer Status", + enum={"Failed": "Failed", "InProgress": "InProgress", "PendingFulfillmentStart": "PendingFulfillmentStart", "Reinstated": "Reinstated", "Started": "Started", "Subscribed": "Subscribed", "Succeeded": "Succeeded", "Suspended": "Suspended", "Unsubscribed": "Unsubscribed", "Updating": "Updating"}, + ) + offer_detail.term_id = AAZStrArg( + options=["term-id"], + help="Offer Plan Term Id", + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + offer_detail.term_unit = AAZStrArg( + options=["term-unit"], + help="Offer Plan Term unit", + required=True, + fmt=AAZStrArgFormat( + max_length=25, + ), + ) + + private_offer_ids = cls._args_schema.offer_detail.private_offer_ids + private_offer_ids.Element = AAZStrArg() + + user_detail = cls._args_schema.user_detail + user_detail.aad_email = AAZStrArg( + options=["aad-email"], + help="AAD email address", + ) + user_detail.email_address = AAZStrArg( + options=["email-address"], + help="Email address", + required=True, + fmt=AAZStrArgFormat( + pattern="^\\S+@\\S+\\.\\S+$", + ), + ) + user_detail.first_name = AAZStrArg( + options=["first-name"], + help="First name", + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + user_detail.last_name = AAZStrArg( + options=["last-name"], + help="Last name", + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + user_detail.user_principal_name = AAZStrArg( + options=["user-principal-name"], + help="User principal name", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ValidationsValidateOrganization(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 ValidationsValidateOrganization(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.Confluent/validations/{organizationName}/orgvalidate", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + 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") + _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("linkOrganization", AAZObjectType, ".link_organization") + properties.set_prop("offerDetail", AAZObjectType, ".offer_detail", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("userDetail", AAZObjectType, ".user_detail", typ_kwargs={"flags": {"required": True}}) + + link_organization = _builder.get(".properties.linkOrganization") + if link_organization is not None: + link_organization.set_prop("token", AAZStrType, ".token", typ_kwargs={"flags": {"secret": True}}) + + offer_detail = _builder.get(".properties.offerDetail") + if offer_detail is not None: + offer_detail.set_prop("id", AAZStrType, ".id", typ_kwargs={"flags": {"required": True}}) + offer_detail.set_prop("planId", AAZStrType, ".plan_id", typ_kwargs={"flags": {"required": True}}) + offer_detail.set_prop("planName", AAZStrType, ".plan_name", typ_kwargs={"flags": {"required": True}}) + offer_detail.set_prop("privateOfferId", AAZStrType, ".private_offer_id") + offer_detail.set_prop("privateOfferIds", AAZListType, ".private_offer_ids") + offer_detail.set_prop("publisherId", AAZStrType, ".publisher_id", typ_kwargs={"flags": {"required": True}}) + offer_detail.set_prop("status", AAZStrType, ".status") + offer_detail.set_prop("termId", AAZStrType, ".term_id") + offer_detail.set_prop("termUnit", AAZStrType, ".term_unit", typ_kwargs={"flags": {"required": True}}) + + private_offer_ids = _builder.get(".properties.offerDetail.privateOfferIds") + if private_offer_ids is not None: + private_offer_ids.set_elements(AAZStrType, ".") + + user_detail = _builder.get(".properties.userDetail") + if user_detail is not None: + user_detail.set_prop("aadEmail", AAZStrType, ".aad_email") + user_detail.set_prop("emailAddress", AAZStrType, ".email_address", typ_kwargs={"flags": {"required": True}}) + user_detail.set_prop("firstName", AAZStrType, ".first_name") + user_detail.set_prop("lastName", AAZStrType, ".last_name") + user_detail.set_prop("userPrincipalName", AAZStrType, ".user_principal_name") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType() + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.created_time = AAZStrType( + serialized_name="createdTime", + flags={"read_only": True}, + ) + properties.offer_detail = AAZObjectType( + serialized_name="offerDetail", + flags={"required": True}, + ) + properties.organization_id = AAZStrType( + serialized_name="organizationId", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.sso_url = AAZStrType( + serialized_name="ssoUrl", + flags={"read_only": True}, + ) + properties.user_detail = AAZObjectType( + serialized_name="userDetail", + flags={"required": True}, + ) + + offer_detail = cls._schema_on_200.properties.offer_detail + offer_detail.id = AAZStrType( + flags={"required": True}, + ) + offer_detail.plan_id = AAZStrType( + serialized_name="planId", + flags={"required": True}, + ) + offer_detail.plan_name = AAZStrType( + serialized_name="planName", + flags={"required": True}, + ) + offer_detail.private_offer_id = AAZStrType( + serialized_name="privateOfferId", + ) + offer_detail.private_offer_ids = AAZListType( + serialized_name="privateOfferIds", + ) + offer_detail.publisher_id = AAZStrType( + serialized_name="publisherId", + flags={"required": True}, + ) + offer_detail.status = AAZStrType() + offer_detail.term_id = AAZStrType( + serialized_name="termId", + ) + offer_detail.term_unit = AAZStrType( + serialized_name="termUnit", + flags={"required": True}, + ) + + private_offer_ids = cls._schema_on_200.properties.offer_detail.private_offer_ids + private_offer_ids.Element = AAZStrType() + + user_detail = cls._schema_on_200.properties.user_detail + user_detail.aad_email = AAZStrType( + serialized_name="aadEmail", + ) + user_detail.email_address = AAZStrType( + serialized_name="emailAddress", + flags={"required": True}, + ) + user_detail.first_name = AAZStrType( + serialized_name="firstName", + ) + user_detail.last_name = AAZStrType( + serialized_name="lastName", + ) + user_detail.user_principal_name = AAZStrType( + serialized_name="userPrincipalName", + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _OrgvalidateHelper: + """Helper class for Orgvalidate""" + + +__all__ = ["Orgvalidate"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/validation/_orgvalidate_v2.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/validation/_orgvalidate_v2.py new file mode 100644 index 00000000000..195002d207b --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/aaz/latest/confluent/validation/_orgvalidate_v2.py @@ -0,0 +1,366 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "confluent validation orgvalidate-v2", +) +class OrgvalidateV2(AAZCommand): + """Validate Confluent organization resource + """ + + _aaz_info = { + "version": "2024-02-13", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.confluent/validations/{}/orgvalidatev2", "2024-02-13"], + ] + } + + 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.organization_name = AAZStrArg( + options=["--organization-name"], + help="Organization resource name", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Body" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Body", + help="Location of Organization resource", + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Body", + help="Organization resource tags", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.link_organization = AAZObjectArg( + options=["--link-organization"], + arg_group="Properties", + help="Link an existing Confluent organization", + ) + _args_schema.offer_detail = AAZObjectArg( + options=["--offer-detail"], + arg_group="Properties", + help="Confluent offer detail", + required=True, + ) + _args_schema.user_detail = AAZObjectArg( + options=["--user-detail"], + arg_group="Properties", + help="Subscriber detail", + required=True, + ) + + link_organization = cls._args_schema.link_organization + link_organization.token = AAZStrArg( + options=["token"], + help="User auth token", + required=True, + ) + + offer_detail = cls._args_schema.offer_detail + offer_detail.id = AAZStrArg( + options=["id"], + help="Offer Id", + required=True, + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + offer_detail.plan_id = AAZStrArg( + options=["plan-id"], + help="Offer Plan Id", + required=True, + fmt=AAZStrArgFormat( + max_length=200, + ), + ) + offer_detail.plan_name = AAZStrArg( + options=["plan-name"], + help="Offer Plan Name", + required=True, + fmt=AAZStrArgFormat( + max_length=200, + ), + ) + offer_detail.private_offer_id = AAZStrArg( + options=["private-offer-id"], + help="Private Offer Id", + fmt=AAZStrArgFormat( + max_length=255, + ), + ) + offer_detail.private_offer_ids = AAZListArg( + options=["private-offer-ids"], + help="Array of Private Offer Ids", + ) + offer_detail.publisher_id = AAZStrArg( + options=["publisher-id"], + help="Publisher Id", + required=True, + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + offer_detail.status = AAZStrArg( + options=["status"], + help="SaaS Offer Status", + enum={"Failed": "Failed", "InProgress": "InProgress", "PendingFulfillmentStart": "PendingFulfillmentStart", "Reinstated": "Reinstated", "Started": "Started", "Subscribed": "Subscribed", "Succeeded": "Succeeded", "Suspended": "Suspended", "Unsubscribed": "Unsubscribed", "Updating": "Updating"}, + ) + offer_detail.term_id = AAZStrArg( + options=["term-id"], + help="Offer Plan Term Id", + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + offer_detail.term_unit = AAZStrArg( + options=["term-unit"], + help="Offer Plan Term unit", + required=True, + fmt=AAZStrArgFormat( + max_length=25, + ), + ) + + private_offer_ids = cls._args_schema.offer_detail.private_offer_ids + private_offer_ids.Element = AAZStrArg() + + user_detail = cls._args_schema.user_detail + user_detail.aad_email = AAZStrArg( + options=["aad-email"], + help="AAD email address", + ) + user_detail.email_address = AAZStrArg( + options=["email-address"], + help="Email address", + required=True, + fmt=AAZStrArgFormat( + pattern="^\\S+@\\S+\\.\\S+$", + ), + ) + user_detail.first_name = AAZStrArg( + options=["first-name"], + help="First name", + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + user_detail.last_name = AAZStrArg( + options=["last-name"], + help="Last name", + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + user_detail.user_principal_name = AAZStrArg( + options=["user-principal-name"], + help="User principal name", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ValidationsValidateOrganizationV2(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 ValidationsValidateOrganizationV2(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.Confluent/validations/{organizationName}/orgvalidateV2", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "organizationName", self.ctx.args.organization_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", "2024-02-13", + 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") + _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("linkOrganization", AAZObjectType, ".link_organization") + properties.set_prop("offerDetail", AAZObjectType, ".offer_detail", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("userDetail", AAZObjectType, ".user_detail", typ_kwargs={"flags": {"required": True}}) + + link_organization = _builder.get(".properties.linkOrganization") + if link_organization is not None: + link_organization.set_prop("token", AAZStrType, ".token", typ_kwargs={"flags": {"secret": True}}) + + offer_detail = _builder.get(".properties.offerDetail") + if offer_detail is not None: + offer_detail.set_prop("id", AAZStrType, ".id", typ_kwargs={"flags": {"required": True}}) + offer_detail.set_prop("planId", AAZStrType, ".plan_id", typ_kwargs={"flags": {"required": True}}) + offer_detail.set_prop("planName", AAZStrType, ".plan_name", typ_kwargs={"flags": {"required": True}}) + offer_detail.set_prop("privateOfferId", AAZStrType, ".private_offer_id") + offer_detail.set_prop("privateOfferIds", AAZListType, ".private_offer_ids") + offer_detail.set_prop("publisherId", AAZStrType, ".publisher_id", typ_kwargs={"flags": {"required": True}}) + offer_detail.set_prop("status", AAZStrType, ".status") + offer_detail.set_prop("termId", AAZStrType, ".term_id") + offer_detail.set_prop("termUnit", AAZStrType, ".term_unit", typ_kwargs={"flags": {"required": True}}) + + private_offer_ids = _builder.get(".properties.offerDetail.privateOfferIds") + if private_offer_ids is not None: + private_offer_ids.set_elements(AAZStrType, ".") + + user_detail = _builder.get(".properties.userDetail") + if user_detail is not None: + user_detail.set_prop("aadEmail", AAZStrType, ".aad_email") + user_detail.set_prop("emailAddress", AAZStrType, ".email_address", typ_kwargs={"flags": {"required": True}}) + user_detail.set_prop("firstName", AAZStrType, ".first_name") + user_detail.set_prop("lastName", AAZStrType, ".last_name") + user_detail.set_prop("userPrincipalName", AAZStrType, ".user_principal_name") + + 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.info = AAZDictType() + + info = cls._schema_on_200.info + info.Element = AAZStrType() + + return cls._schema_on_200 + + +class _OrgvalidateV2Helper: + """Helper class for OrgvalidateV2""" + + +__all__ = ["OrgvalidateV2"] diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/commands.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/commands.py new file mode 100644 index 00000000000..30b4e29e7ca --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/commands.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +# from azure.cli.core.commands import CliCommandType +# from azure.cli.core.profiles import ResourceType + + +def load_command_table(self, _): # pylint: disable=unused-argument + pass diff --git a/src/azure-cli/azure/cli/command_modules/cli_new_extension/custom.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/custom.py new file mode 100644 index 00000000000..86df1e48ef5 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/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/azure-cli/azure/cli/command_modules/cli_new_extension/tests/__init__.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/tests/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/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/azure-cli/azure/cli/command_modules/cli_new_extension/tests/latest/__init__.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/tests/latest/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/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/azure-cli/azure/cli/command_modules/cli_new_extension/tests/latest/test_cli_new_extension.py b/src/azure-cli/azure/cli/command_modules/cli_new_extension/tests/latest/test_cli_new_extension.py new file mode 100644 index 00000000000..a0f00eb1eb9 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/cli_new_extension/tests/latest/test_cli_new_extension.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 CliNewExtensionScenario(ScenarioTest): + # TODO: add tests here + pass