diff --git a/src/dnc/HISTORY.rst b/src/dnc/HISTORY.rst index 73b2d54e915..3678f1e5e6b 100644 --- a/src/dnc/HISTORY.rst +++ b/src/dnc/HISTORY.rst @@ -3,6 +3,10 @@ Release History =============== +0.2.0 +++++++ +* Add optional "purpose" parameter for controller creation + 0.1.3 ++++++ * Correct bug with delegate subnet diff --git a/src/dnc/README.md b/src/dnc/README.md index 08a00042843..c64f7c4c3b4 100644 --- a/src/dnc/README.md +++ b/src/dnc/README.md @@ -1,83 +1,14 @@ -# Azure CLI dnc Extension # -This is the extension for dnc +# Azure CLI Dnc Extension # +This is an extension to Azure CLI to manage DNC resources. + +## How to use ## -### How to use ### Install this extension using the below CLI command ``` az extension add --name dnc ``` -### Included Features ### -#### dnc controller #### -##### Create ##### -``` -az dnc controller create --location "eastus2euap" --resource-group "TestRG" --resource-name "testcontroller" -``` -##### Patch ##### -``` -az dnc controller patch --tags key="value" --resource-group "TestRG" --resource-name "testcontroller" -``` -##### Show-detail ##### -``` -az dnc controller show-detail --resource-group "TestRG" --resource-name "testcontroller" -``` -##### Delete ##### -``` -az dnc controller delete --resource-group "TestRG" --resource-name "testcontroller" -``` -#### dnc delegated-network #### -##### List ##### -``` -az dnc delegated-network list --resource-group "testRG" -``` -#### dnc orchestrator-instance-service #### -##### Create ##### -``` -az dnc orchestrator-instance-service create --type "SystemAssigned" --location "eastus2euap" \ - --api-server-endpoint "https://testk8s.cloudapp.net" --cluster-root-ca "ddsadsad344mfdsfdl" \ - --id "/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.DelegatedNetwork/controller/testcontroller" \ - --orchestrator-app-id "546192d7-503f-477a-9cfe-4efc3ee2b6e1" \ - --orchestrator-tenant-id "da6192d7-503f-477a-9cfe-4efc3ee2b6c3" \ - --private-link-resource-id "/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.Network/privateLinkServices/plresource1" \ - --resource-group "TestRG" --resource-name "testk8s1" -``` -##### List ##### -``` -az dnc orchestrator-instance-service list --resource-group "testRG" -``` -##### Patch ##### -``` -az dnc orchestrator-instance-service patch --tags key="value" --resource-group "TestRG" --resource-name "testk8s1" -``` -##### Show-detail ##### -``` -az dnc orchestrator-instance-service show-detail --resource-group "TestRG" --resource-name "testk8s1" -``` -##### Delete ##### -``` -az dnc orchestrator-instance-service delete --resource-group "TestRG" --resource-name "k8stest1" -``` -#### dnc delegated-subnet-service #### -##### Put-detail ##### -``` -az dnc delegated-subnet-service put-detail --location "eastus2euap" \ - --id "/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.DelegatedNetwork/controller/dnctestcontroller" \ - --subnet-details-id "/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet" \ - --resource-group "TestRG" --resource-name "delegated1" -``` -##### Patch-detail ##### -``` -az dnc delegated-subnet-service patch-detail --tags key="value" --resource-group "TestRG" --resource-name "delegated1" -``` -##### List ##### -``` -az dnc delegated-subnet-service list --resource-group "testRG" -``` -##### Show-detail ##### -``` -az dnc delegated-subnet-service show-detail --resource-group "TestRG" --resource-name "delegated1" -``` -##### Delete ##### +## Included Features ## ``` -az dnc delegated-subnet-service delete --resource-group "TestRG" --resource-name "delegated1" +az dnc --help ``` \ No newline at end of file diff --git a/src/dnc/azext_dnc/__init__.py b/src/dnc/azext_dnc/__init__.py index 258f2269109..d4fd01df9bf 100644 --- a/src/dnc/azext_dnc/__init__.py +++ b/src/dnc/azext_dnc/__init__.py @@ -1,50 +1,42 @@ -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. +# Licensed under the MIT License. See License.txt in the project root for license information. # -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- from azure.cli.core import AzCommandsLoader -from azext_dnc.generated._help import helps # pylint: disable=unused-import -try: - from azext_dnc.manual._help import helps # pylint: disable=reimported -except ImportError: - pass +from azext_dnc._help import helps # pylint: disable=unused-import -class DNCCommandsLoader(AzCommandsLoader): +class DncCommandsLoader(AzCommandsLoader): def __init__(self, cli_ctx=None): from azure.cli.core.commands import CliCommandType - from azext_dnc.generated._client_factory import cf_dnc_cl - dnc_custom = CliCommandType( - operations_tmpl='azext_dnc.custom#{}', - client_factory=cf_dnc_cl) - parent = super(DNCCommandsLoader, self) - parent.__init__(cli_ctx=cli_ctx, custom_command_type=dnc_custom) + custom_command_type = CliCommandType( + operations_tmpl='azext_dnc.custom#{}') + super().__init__(cli_ctx=cli_ctx, + custom_command_type=custom_command_type) def load_command_table(self, args): - from azext_dnc.generated.commands import load_command_table - load_command_table(self, args) + from azext_dnc.commands import load_command_table + from azure.cli.core.aaz import load_aaz_command_table try: - from azext_dnc.manual.commands import load_command_table as load_command_table_manual - load_command_table_manual(self, args) + from . import aaz except ImportError: - pass + aaz = None + if aaz: + load_aaz_command_table( + loader=self, + aaz_pkg_name=aaz.__name__, + args=args + ) + load_command_table(self, args) return self.command_table def load_arguments(self, command): - from azext_dnc.generated._params import load_arguments + from azext_dnc._params import load_arguments load_arguments(self, command) - try: - from azext_dnc.manual._params import load_arguments as load_arguments_manual - load_arguments_manual(self, command) - except ImportError: - pass -COMMAND_LOADER_CLS = DNCCommandsLoader +COMMAND_LOADER_CLS = DncCommandsLoader diff --git a/src/dnc/azext_dnc/manual/_help.py b/src/dnc/azext_dnc/_help.py similarity index 73% rename from src/dnc/azext_dnc/manual/_help.py rename to src/dnc/azext_dnc/_help.py index 0716ba31f74..126d5d00714 100644 --- a/src/dnc/azext_dnc/manual/_help.py +++ b/src/dnc/azext_dnc/_help.py @@ -1,12 +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=too-many-lines -from knack.help_files import helps +# pylint: disable=line-too-long +# pylint: disable=too-many-lines -helps['dnc'] = """ - type: group - short-summary: Manage Delegated Network -""" +from knack.help_files import helps # pylint: disable=unused-import diff --git a/src/dnc/azext_dnc/_params.py b/src/dnc/azext_dnc/_params.py new file mode 100644 index 00000000000..cfcec717c9c --- /dev/null +++ b/src/dnc/azext_dnc/_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/dnc/azext_dnc/vendored_sdks/dnc/aio/__init__.py b/src/dnc/azext_dnc/aaz/__init__.py similarity index 55% rename from src/dnc/azext_dnc/vendored_sdks/dnc/aio/__init__.py rename to src/dnc/azext_dnc/aaz/__init__.py index eee4efec6cf..5757aea3175 100644 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/aio/__init__.py +++ b/src/dnc/azext_dnc/aaz/__init__.py @@ -1,10 +1,6 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------------------------- # 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._dnc import DNC -__all__ = ['DNC'] +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- diff --git a/src/dnc/azext_dnc/manual/tests/__init__.py b/src/dnc/azext_dnc/aaz/latest/__init__.py similarity index 55% rename from src/dnc/azext_dnc/manual/tests/__init__.py rename to src/dnc/azext_dnc/aaz/latest/__init__.py index b33a44c1ebf..5757aea3175 100644 --- a/src/dnc/azext_dnc/manual/tests/__init__.py +++ b/src/dnc/azext_dnc/aaz/latest/__init__.py @@ -1,9 +1,6 @@ -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. +# Licensed under the MIT License. See License.txt in the project root for license information. # -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- diff --git a/src/dnc/azext_dnc/aaz/latest/dnc/__cmd_group.py b/src/dnc/azext_dnc/aaz/latest/dnc/__cmd_group.py new file mode 100644 index 00000000000..ca4d4b94a61 --- /dev/null +++ b/src/dnc/azext_dnc/aaz/latest/dnc/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "dnc", + is_preview=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage Delegated Network. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/dnc/azext_dnc/vendored_sdks/dnc/_version.py b/src/dnc/azext_dnc/aaz/latest/dnc/__init__.py similarity index 58% rename from src/dnc/azext_dnc/vendored_sdks/dnc/_version.py rename to src/dnc/azext_dnc/aaz/latest/dnc/__init__.py index e5754a47ce6..5a9d61963d6 100644 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/_version.py +++ b/src/dnc/azext_dnc/aaz/latest/dnc/__init__.py @@ -1,9 +1,11 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------------------------- # 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- -VERSION = "1.0.0b1" +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * diff --git a/src/dnc/azext_dnc/aaz/latest/dnc/controller/__cmd_group.py b/src/dnc/azext_dnc/aaz/latest/dnc/controller/__cmd_group.py new file mode 100644 index 00000000000..7e1a9174aad --- /dev/null +++ b/src/dnc/azext_dnc/aaz/latest/dnc/controller/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "dnc controller", + is_preview=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage controller with dnc. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/dnc/azext_dnc/aaz/latest/dnc/controller/__init__.py b/src/dnc/azext_dnc/aaz/latest/dnc/controller/__init__.py new file mode 100644 index 00000000000..1965d86a763 --- /dev/null +++ b/src/dnc/azext_dnc/aaz/latest/dnc/controller/__init__.py @@ -0,0 +1,15 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._show import * +from ._wait import * diff --git a/src/dnc/azext_dnc/aaz/latest/dnc/controller/_create.py b/src/dnc/azext_dnc/aaz/latest/dnc/controller/_create.py new file mode 100644 index 00000000000..5d36e69d056 --- /dev/null +++ b/src/dnc/azext_dnc/aaz/latest/dnc/controller/_create.py @@ -0,0 +1,283 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "dnc controller create", + is_preview=True, +) +class Create(AAZCommand): + """Create a dnc controller. + + :example: Create a controller + az dnc controller create --location "West US" --resource-group "TestRG" --resource-name "testcontroller" + + :example: Create a test controller + az dnc controller create --location "West US" --resource-group "TestRG" --resource-name "testcontroller" --purpose "test" + """ + + _aaz_info = { + "version": "2023-05-18-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.delegatednetwork/controller/{}", "2023-05-18-preview"], + ] + } + + 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.resource_group = AAZResourceGroupNameArg( + help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["-n", "--name", "--resource-name"], + help="The name of the resource. It must be a minimum of 3 characters, and a maximum of 63.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-z][a-z0-9]*$", + max_length=63, + min_length=3, + ), + ) + + # define Arg Group "Parameters" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Parameters", + help="Location of the resource.", + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Parameters", + help="The resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.purpose = AAZStrArg( + options=["--purpose"], + arg_group="Properties", + help="The purpose of the dnc controller resource.", + is_preview=True, + default="prod", + enum={"prod": "prod", "test": "test"}, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ControllerCreate(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 ControllerCreate(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.DelegatedNetwork/controller/{resourceName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2023-05-18-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("location", AAZStrType, ".location") + _builder.set_prop("properties", AAZObjectType) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("purpose", AAZStrType, ".purpose") + + 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() + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.dnc_app_id = AAZStrType( + serialized_name="dncAppId", + flags={"read_only": True}, + ) + properties.dnc_endpoint = AAZStrType( + serialized_name="dncEndpoint", + flags={"read_only": True}, + ) + properties.dnc_tenant_id = AAZStrType( + serialized_name="dncTenantId", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.purpose = AAZStrType() + properties.resource_guid = AAZStrType( + serialized_name="resourceGuid", + flags={"read_only": True}, + ) + + 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/dnc/azext_dnc/aaz/latest/dnc/controller/_delete.py b/src/dnc/azext_dnc/aaz/latest/dnc/controller/_delete.py new file mode 100644 index 00000000000..29b4c319cd3 --- /dev/null +++ b/src/dnc/azext_dnc/aaz/latest/dnc/controller/_delete.py @@ -0,0 +1,170 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "dnc controller delete", + is_preview=True, + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the DNC controller. + + :example: Delete a controller + az dnc controller delete --resource-group "TestRG" --resource-name "testcontroller" + """ + + _aaz_info = { + "version": "2023-05-18-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.delegatednetwork/controller/{}", "2023-05-18-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["-n", "--name", "--resource-name"], + help="The name of the resource. It must be a minimum of 3 characters, and a maximum of 63.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-z][a-z0-9]*$", + max_length=63, + min_length=3, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ControllerDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class ControllerDelete(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": "azure-async-operation"}, + 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": "azure-async-operation"}, + 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": "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.DelegatedNetwork/controller/{resourceName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2023-05-18-preview", + 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/dnc/azext_dnc/aaz/latest/dnc/controller/_show.py b/src/dnc/azext_dnc/aaz/latest/dnc/controller/_show.py new file mode 100644 index 00000000000..119970baa67 --- /dev/null +++ b/src/dnc/azext_dnc/aaz/latest/dnc/controller/_show.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( + "dnc controller show", + is_preview=True, +) +class Show(AAZCommand): + """Get details about the specified dnc controller. + + :example: Get details of a controller + az dnc controller show --resource-group "TestRG" --resource-name "testcontroller" + """ + + _aaz_info = { + "version": "2023-05-18-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.delegatednetwork/controller/{}", "2023-05-18-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["-n", "--name", "--resource-name"], + help="The name of the resource. It must be a minimum of 3 characters, and a maximum of 63.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-z][a-z0-9]*$", + max_length=63, + min_length=3, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ControllerGetDetails(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 ControllerGetDetails(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.DelegatedNetwork/controller/{resourceName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2023-05-18-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType() + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.dnc_app_id = AAZStrType( + serialized_name="dncAppId", + flags={"read_only": True}, + ) + properties.dnc_endpoint = AAZStrType( + serialized_name="dncEndpoint", + flags={"read_only": True}, + ) + properties.dnc_tenant_id = AAZStrType( + serialized_name="dncTenantId", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.purpose = AAZStrType() + properties.resource_guid = AAZStrType( + serialized_name="resourceGuid", + flags={"read_only": True}, + ) + + 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/dnc/azext_dnc/aaz/latest/dnc/controller/_wait.py b/src/dnc/azext_dnc/aaz/latest/dnc/controller/_wait.py new file mode 100644 index 00000000000..1fec9c86326 --- /dev/null +++ b/src/dnc/azext_dnc/aaz/latest/dnc/controller/_wait.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( + "dnc controller 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.delegatednetwork/controller/{}", "2023-05-18-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["-n", "--name", "--resource-name"], + help="The name of the resource. It must be a minimum of 3 characters, and a maximum of 63.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-z][a-z0-9]*$", + max_length=63, + min_length=3, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ControllerGetDetails(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 ControllerGetDetails(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.DelegatedNetwork/controller/{resourceName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2023-05-18-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType() + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.dnc_app_id = AAZStrType( + serialized_name="dncAppId", + flags={"read_only": True}, + ) + properties.dnc_endpoint = AAZStrType( + serialized_name="dncEndpoint", + flags={"read_only": True}, + ) + properties.dnc_tenant_id = AAZStrType( + serialized_name="dncTenantId", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.purpose = AAZStrType() + properties.resource_guid = AAZStrType( + serialized_name="resourceGuid", + flags={"read_only": True}, + ) + + 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/dnc/azext_dnc/aaz/latest/dnc/delegated_subnet_service/__cmd_group.py b/src/dnc/azext_dnc/aaz/latest/dnc/delegated_subnet_service/__cmd_group.py new file mode 100644 index 00000000000..0fd440bb965 --- /dev/null +++ b/src/dnc/azext_dnc/aaz/latest/dnc/delegated_subnet_service/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "dnc delegated-subnet-service", + is_preview=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage delegated subnet service with dnc. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/dnc/azext_dnc/aaz/latest/dnc/delegated_subnet_service/__init__.py b/src/dnc/azext_dnc/aaz/latest/dnc/delegated_subnet_service/__init__.py new file mode 100644 index 00000000000..1965d86a763 --- /dev/null +++ b/src/dnc/azext_dnc/aaz/latest/dnc/delegated_subnet_service/__init__.py @@ -0,0 +1,15 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._show import * +from ._wait import * diff --git a/src/dnc/azext_dnc/aaz/latest/dnc/delegated_subnet_service/_create.py b/src/dnc/azext_dnc/aaz/latest/dnc/delegated_subnet_service/_create.py new file mode 100644 index 00000000000..45f4f9c46da --- /dev/null +++ b/src/dnc/azext_dnc/aaz/latest/dnc/delegated_subnet_service/_create.py @@ -0,0 +1,296 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "dnc delegated-subnet-service create", + is_preview=True, +) +class Create(AAZCommand): + """Create delegated subnet resource. + + :example: Create a subnet delegated to DNC + az dnc delegated-subnet-service create --location "West US" --id "/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.DelegatedNetwork/controller/dnctestcontroller" --subnet-details-id "/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet" --resource-group "TestRG" --resource-name "delegated1" + """ + + _aaz_info = { + "version": "2023-05-18-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.delegatednetwork/delegatedsubnets/{}", "2023-05-18-preview"], + ] + } + + 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.resource_group = AAZResourceGroupNameArg( + help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["-n", "--name", "--resource-name"], + help="The name of the resource. It must be a minimum of 3 characters, and a maximum of 63.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-z][a-z0-9]*$", + max_length=63, + min_length=3, + ), + ) + + # define Arg Group "ControllerDetails" + + _args_schema = cls._args_schema + _args_schema.id = AAZStrArg( + options=["--id"], + arg_group="ControllerDetails", + help="controller arm resource id", + ) + + # define Arg Group "Parameters" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Parameters", + help="Location of the resource.", + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Parameters", + help="The resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "SubnetDetails" + + _args_schema = cls._args_schema + _args_schema.subnet_details_id = AAZStrArg( + options=["--subnet-details-id"], + arg_group="SubnetDetails", + help="subnet arm resource id", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.DelegatedSubnetServicePutDetails(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 DelegatedSubnetServicePutDetails(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.DelegatedNetwork/delegatedSubnets/{resourceName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2023-05-18-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("location", AAZStrType, ".location") + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("controllerDetails", AAZObjectType) + properties.set_prop("subnetDetails", AAZObjectType) + + controller_details = _builder.get(".properties.controllerDetails") + if controller_details is not None: + controller_details.set_prop("id", AAZStrType, ".id") + + subnet_details = _builder.get(".properties.subnetDetails") + if subnet_details is not None: + subnet_details.set_prop("id", AAZStrType, ".subnet_details_id") + + 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={"client_flatten": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.controller_details = AAZObjectType( + serialized_name="controllerDetails", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.resource_guid = AAZStrType( + serialized_name="resourceGuid", + flags={"read_only": True}, + ) + properties.subnet_details = AAZObjectType( + serialized_name="subnetDetails", + ) + + controller_details = cls._schema_on_200_201.properties.controller_details + controller_details.id = AAZStrType() + + subnet_details = cls._schema_on_200_201.properties.subnet_details + subnet_details.id = AAZStrType() + + 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/dnc/azext_dnc/aaz/latest/dnc/delegated_subnet_service/_delete.py b/src/dnc/azext_dnc/aaz/latest/dnc/delegated_subnet_service/_delete.py new file mode 100644 index 00000000000..ed6104a0931 --- /dev/null +++ b/src/dnc/azext_dnc/aaz/latest/dnc/delegated_subnet_service/_delete.py @@ -0,0 +1,177 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "dnc delegated-subnet-service delete", + is_preview=True, + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete dnc DelegatedSubnet. + + :example: Delete the subnet delegated to DNC + az dnc delegated-subnet-service delete --resource-group "TestRG" --resource-name "delegated1" + """ + + _aaz_info = { + "version": "2023-05-18-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.delegatednetwork/delegatedsubnets/{}", "2023-05-18-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["-n", "--name", "--resource-name"], + help="The name of the resource. It must be a minimum of 3 characters, and a maximum of 63.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-z][a-z0-9]*$", + max_length=63, + min_length=3, + ), + ) + _args_schema.force_delete = AAZBoolArg( + options=["--force-delete"], + help="Force delete resource", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.DelegatedSubnetServiceDeleteDetails(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class DelegatedSubnetServiceDeleteDetails(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": "azure-async-operation"}, + 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": "azure-async-operation"}, + 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": "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.DelegatedNetwork/delegatedSubnets/{resourceName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "forceDelete", self.ctx.args.force_delete, + ), + **self.serialize_query_param( + "api-version", "2023-05-18-preview", + 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/dnc/azext_dnc/aaz/latest/dnc/delegated_subnet_service/_show.py b/src/dnc/azext_dnc/aaz/latest/dnc/delegated_subnet_service/_show.py new file mode 100644 index 00000000000..a3bdcc6e074 --- /dev/null +++ b/src/dnc/azext_dnc/aaz/latest/dnc/delegated_subnet_service/_show.py @@ -0,0 +1,210 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "dnc delegated-subnet-service show", + is_preview=True, +) +class Show(AAZCommand): + """Get details about the specified dnc DelegatedSubnet Link. + + :example: Get details of a subnet delegated to DNC + az dnc delegated-subnet-service show --resource-group "TestRG" --resource-name "delegated1" + """ + + _aaz_info = { + "version": "2023-05-18-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.delegatednetwork/delegatedsubnets/{}", "2023-05-18-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["-n", "--name", "--resource-name"], + help="The name of the resource. It must be a minimum of 3 characters, and a maximum of 63.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-z][a-z0-9]*$", + max_length=63, + min_length=3, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.DelegatedSubnetServiceGetDetails(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 DelegatedSubnetServiceGetDetails(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.DelegatedNetwork/delegatedSubnets/{resourceName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2023-05-18-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType() + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.controller_details = AAZObjectType( + serialized_name="controllerDetails", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.resource_guid = AAZStrType( + serialized_name="resourceGuid", + flags={"read_only": True}, + ) + properties.subnet_details = AAZObjectType( + serialized_name="subnetDetails", + ) + + controller_details = cls._schema_on_200.properties.controller_details + controller_details.id = AAZStrType() + + subnet_details = cls._schema_on_200.properties.subnet_details + subnet_details.id = AAZStrType() + + 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/dnc/azext_dnc/aaz/latest/dnc/delegated_subnet_service/_wait.py b/src/dnc/azext_dnc/aaz/latest/dnc/delegated_subnet_service/_wait.py new file mode 100644 index 00000000000..5d2240b7d91 --- /dev/null +++ b/src/dnc/azext_dnc/aaz/latest/dnc/delegated_subnet_service/_wait.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( + "dnc delegated-subnet-service 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.delegatednetwork/delegatedsubnets/{}", "2023-05-18-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["-n", "--name", "--resource-name"], + help="The name of the resource. It must be a minimum of 3 characters, and a maximum of 63.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-z][a-z0-9]*$", + max_length=63, + min_length=3, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.DelegatedSubnetServiceGetDetails(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 DelegatedSubnetServiceGetDetails(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.DelegatedNetwork/delegatedSubnets/{resourceName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2023-05-18-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType() + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.controller_details = AAZObjectType( + serialized_name="controllerDetails", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.resource_guid = AAZStrType( + serialized_name="resourceGuid", + flags={"read_only": True}, + ) + properties.subnet_details = AAZObjectType( + serialized_name="subnetDetails", + ) + + controller_details = cls._schema_on_200.properties.controller_details + controller_details.id = AAZStrType() + + subnet_details = cls._schema_on_200.properties.subnet_details + subnet_details.id = AAZStrType() + + 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/dnc/azext_dnc/aaz/latest/dnc/orchestrator_instance_service/__cmd_group.py b/src/dnc/azext_dnc/aaz/latest/dnc/orchestrator_instance_service/__cmd_group.py new file mode 100644 index 00000000000..9dda7cadede --- /dev/null +++ b/src/dnc/azext_dnc/aaz/latest/dnc/orchestrator_instance_service/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "dnc orchestrator-instance-service", + is_preview=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage orchestrator instance service with dnc. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/dnc/azext_dnc/aaz/latest/dnc/orchestrator_instance_service/__init__.py b/src/dnc/azext_dnc/aaz/latest/dnc/orchestrator_instance_service/__init__.py new file mode 100644 index 00000000000..1965d86a763 --- /dev/null +++ b/src/dnc/azext_dnc/aaz/latest/dnc/orchestrator_instance_service/__init__.py @@ -0,0 +1,15 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._show import * +from ._wait import * diff --git a/src/dnc/azext_dnc/aaz/latest/dnc/orchestrator_instance_service/_create.py b/src/dnc/azext_dnc/aaz/latest/dnc/orchestrator_instance_service/_create.py new file mode 100644 index 00000000000..0d7e9bac15d --- /dev/null +++ b/src/dnc/azext_dnc/aaz/latest/dnc/orchestrator_instance_service/_create.py @@ -0,0 +1,363 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "dnc orchestrator-instance-service create", + is_preview=True, +) +class Create(AAZCommand): + """Create a orchestrator instance. + + :example: Create an orchestrator instance + az dnc orchestrator-instance-service create --type "SystemAssigned" --location "West US" --kind "Kubernetes" --api-server-endpoint "https://testk8s.cloudapp.net" --cluster-root-ca "ddsadsad344mfdsfdl" --id "/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.DelegatedNetwork/controller/testcontroller" --orchestrator-app-id "546192d7-503f-477a-9cfe-4efc3ee2b6e1" --orchestrator-tenant-id "da6192d7-503f-477a-9cfe-4efc3ee2b6c3" --priv-link-resource-id "/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.Network/privateLinkServices/plresource1" --resource-group "TestRG" --resource-name "testk8s1" + """ + + _aaz_info = { + "version": "2023-05-18-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.delegatednetwork/orchestrators/{}", "2023-05-18-preview"], + ] + } + + 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.resource_group = AAZResourceGroupNameArg( + help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["-n", "--name", "--resource-name"], + help="The name of the resource. It must be a minimum of 3 characters, and a maximum of 63.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-z][a-z0-9]*$", + max_length=63, + min_length=3, + ), + ) + + # define Arg Group "ControllerDetails" + + _args_schema = cls._args_schema + _args_schema.id = AAZStrArg( + options=["--id"], + arg_group="ControllerDetails", + help="controller arm resource id", + ) + + # define Arg Group "Identity" + + _args_schema = cls._args_schema + _args_schema.type = AAZStrArg( + options=["--type"], + arg_group="Identity", + help="The type of identity used for orchestrator cluster. Type 'SystemAssigned' will use an implicitly created identity orchestrator clusters", + enum={"None": "None", "SystemAssigned": "SystemAssigned"}, + ) + + # define Arg Group "Parameters" + + _args_schema = cls._args_schema + _args_schema.kind = AAZStrArg( + options=["--kind"], + arg_group="Parameters", + help="The kind of workbook. Choices are user and shared.", + required=True, + default="Kubernetes", + enum={"Kubernetes": "Kubernetes"}, + ) + _args_schema.location = AAZResourceLocationArg( + arg_group="Parameters", + help="Location of the resource.", + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Parameters", + help="The resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.api_server_endpoint = AAZStrArg( + options=["--api-server-endpoint"], + arg_group="Properties", + help="K8s APIServer url. Either one of apiServerEndpoint or privateLinkResourceId can be specified", + ) + _args_schema.cluster_root_ca = AAZStrArg( + options=["--cluster-root-ca"], + arg_group="Properties", + help="RootCA certificate of kubernetes cluster base64 encoded", + ) + _args_schema.orchestrator_app_id = AAZStrArg( + options=["--orchestrator-app-id"], + arg_group="Properties", + help="AAD ID used with apiserver", + ) + _args_schema.orchestrator_tenant_id = AAZStrArg( + options=["--orchestrator-tenant-id"], + arg_group="Properties", + help="TenantID of server App ID", + ) + _args_schema.priv_link_resource_id = AAZStrArg( + options=["--priv-link-resource-id"], + arg_group="Properties", + help="private link arm resource id. Either one of apiServerEndpoint or privateLinkResourceId can be specified", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.OrchestratorInstanceServiceCreate(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 OrchestratorInstanceServiceCreate(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.DelegatedNetwork/orchestrators/{resourceName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2023-05-18-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("identity", AAZObjectType) + _builder.set_prop("kind", AAZStrType, ".kind", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("location", AAZStrType, ".location") + _builder.set_prop("properties", AAZObjectType) + _builder.set_prop("tags", AAZDictType, ".tags") + + identity = _builder.get(".identity") + if identity is not None: + identity.set_prop("type", AAZStrType, ".type") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("apiServerEndpoint", AAZStrType, ".api_server_endpoint") + properties.set_prop("clusterRootCA", AAZStrType, ".cluster_root_ca") + properties.set_prop("controllerDetails", AAZObjectType, ".", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("orchestratorAppId", AAZStrType, ".orchestrator_app_id") + properties.set_prop("orchestratorTenantId", AAZStrType, ".orchestrator_tenant_id") + properties.set_prop("privateLinkResourceId", AAZStrType, ".priv_link_resource_id") + + controller_details = _builder.get(".properties.controllerDetails") + if controller_details is not None: + controller_details.set_prop("id", AAZStrType, ".id") + + 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.identity = AAZObjectType() + _schema_on_200_201.kind = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.location = AAZStrType() + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType() + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + identity = cls._schema_on_200_201.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType() + + properties = cls._schema_on_200_201.properties + properties.api_server_endpoint = AAZStrType( + serialized_name="apiServerEndpoint", + ) + properties.cluster_root_ca = AAZStrType( + serialized_name="clusterRootCA", + ) + properties.controller_details = AAZObjectType( + serialized_name="controllerDetails", + flags={"required": True}, + ) + properties.orchestrator_app_id = AAZStrType( + serialized_name="orchestratorAppId", + ) + properties.orchestrator_tenant_id = AAZStrType( + serialized_name="orchestratorTenantId", + ) + properties.private_link_resource_id = AAZStrType( + serialized_name="privateLinkResourceId", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.resource_guid = AAZStrType( + serialized_name="resourceGuid", + flags={"read_only": True}, + ) + + controller_details = cls._schema_on_200_201.properties.controller_details + controller_details.id = AAZStrType() + + 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/dnc/azext_dnc/aaz/latest/dnc/orchestrator_instance_service/_delete.py b/src/dnc/azext_dnc/aaz/latest/dnc/orchestrator_instance_service/_delete.py new file mode 100644 index 00000000000..879b6302675 --- /dev/null +++ b/src/dnc/azext_dnc/aaz/latest/dnc/orchestrator_instance_service/_delete.py @@ -0,0 +1,177 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "dnc orchestrator-instance-service delete", + is_preview=True, + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the Orchestrator Instance. + + :example: Delete an orchestrator instance + az dnc orchestrator-instance-service delete --resource-group "TestRG" --resource-name "testk8s1" + """ + + _aaz_info = { + "version": "2023-05-18-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.delegatednetwork/orchestrators/{}", "2023-05-18-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["-n", "--name", "--resource-name"], + help="The name of the resource. It must be a minimum of 3 characters, and a maximum of 63.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-z][a-z0-9]*$", + max_length=63, + min_length=3, + ), + ) + _args_schema.force_delete = AAZBoolArg( + options=["--force-delete"], + help="Force delete resource", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.OrchestratorInstanceServiceDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class OrchestratorInstanceServiceDelete(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": "azure-async-operation"}, + 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": "azure-async-operation"}, + 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": "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.DelegatedNetwork/orchestrators/{resourceName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "forceDelete", self.ctx.args.force_delete, + ), + **self.serialize_query_param( + "api-version", "2023-05-18-preview", + 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/dnc/azext_dnc/aaz/latest/dnc/orchestrator_instance_service/_show.py b/src/dnc/azext_dnc/aaz/latest/dnc/orchestrator_instance_service/_show.py new file mode 100644 index 00000000000..4b063901255 --- /dev/null +++ b/src/dnc/azext_dnc/aaz/latest/dnc/orchestrator_instance_service/_show.py @@ -0,0 +1,233 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "dnc orchestrator-instance-service show", + is_preview=True, +) +class Show(AAZCommand): + """Get details about the orchestrator instance. + + :example: Get details of an orchestrator instance + az dnc orchestrator-instance-service show --resource-group "TestRG" --resource-name "testk8s1" + """ + + _aaz_info = { + "version": "2023-05-18-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.delegatednetwork/orchestrators/{}", "2023-05-18-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["-n", "--name", "--resource-name"], + help="The name of the resource. It must be a minimum of 3 characters, and a maximum of 63.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-z][a-z0-9]*$", + max_length=63, + min_length=3, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.OrchestratorInstanceServiceGetDetails(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 OrchestratorInstanceServiceGetDetails(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.DelegatedNetwork/orchestrators/{resourceName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2023-05-18-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.identity = AAZObjectType() + _schema_on_200.kind = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.location = AAZStrType() + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + identity = cls._schema_on_200.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType() + + properties = cls._schema_on_200.properties + properties.api_server_endpoint = AAZStrType( + serialized_name="apiServerEndpoint", + ) + properties.cluster_root_ca = AAZStrType( + serialized_name="clusterRootCA", + ) + properties.controller_details = AAZObjectType( + serialized_name="controllerDetails", + flags={"required": True}, + ) + properties.orchestrator_app_id = AAZStrType( + serialized_name="orchestratorAppId", + ) + properties.orchestrator_tenant_id = AAZStrType( + serialized_name="orchestratorTenantId", + ) + properties.private_link_resource_id = AAZStrType( + serialized_name="privateLinkResourceId", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.resource_guid = AAZStrType( + serialized_name="resourceGuid", + flags={"read_only": True}, + ) + + controller_details = cls._schema_on_200.properties.controller_details + controller_details.id = AAZStrType() + + 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/dnc/azext_dnc/aaz/latest/dnc/orchestrator_instance_service/_wait.py b/src/dnc/azext_dnc/aaz/latest/dnc/orchestrator_instance_service/_wait.py new file mode 100644 index 00000000000..eccb1c43c23 --- /dev/null +++ b/src/dnc/azext_dnc/aaz/latest/dnc/orchestrator_instance_service/_wait.py @@ -0,0 +1,228 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "dnc orchestrator-instance-service 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.delegatednetwork/orchestrators/{}", "2023-05-18-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", + required=True, + ) + _args_schema.resource_name = AAZStrArg( + options=["-n", "--name", "--resource-name"], + help="The name of the resource. It must be a minimum of 3 characters, and a maximum of 63.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-z][a-z0-9]*$", + max_length=63, + min_length=3, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.OrchestratorInstanceServiceGetDetails(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 OrchestratorInstanceServiceGetDetails(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.DelegatedNetwork/orchestrators/{resourceName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "resourceName", self.ctx.args.resource_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2023-05-18-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.identity = AAZObjectType() + _schema_on_200.kind = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.location = AAZStrType() + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + identity = cls._schema_on_200.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType() + + properties = cls._schema_on_200.properties + properties.api_server_endpoint = AAZStrType( + serialized_name="apiServerEndpoint", + ) + properties.cluster_root_ca = AAZStrType( + serialized_name="clusterRootCA", + ) + properties.controller_details = AAZObjectType( + serialized_name="controllerDetails", + flags={"required": True}, + ) + properties.orchestrator_app_id = AAZStrType( + serialized_name="orchestratorAppId", + ) + properties.orchestrator_tenant_id = AAZStrType( + serialized_name="orchestratorTenantId", + ) + properties.private_link_resource_id = AAZStrType( + serialized_name="privateLinkResourceId", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.resource_guid = AAZStrType( + serialized_name="resourceGuid", + flags={"read_only": True}, + ) + + controller_details = cls._schema_on_200.properties.controller_details + controller_details.id = AAZStrType() + + 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/dnc/azext_dnc/action.py b/src/dnc/azext_dnc/action.py deleted file mode 100644 index d95d53bf711..00000000000 --- a/src/dnc/azext_dnc/action.py +++ /dev/null @@ -1,17 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=wildcard-import -# pylint: disable=unused-wildcard-import - -from .generated.action import * # noqa: F403 -try: - from .manual.action import * # noqa: F403 -except ImportError: - pass diff --git a/src/dnc/azext_dnc/azext_metadata.json b/src/dnc/azext_dnc/azext_metadata.json index 30fdaf614ee..7923ce3c67b 100644 --- a/src/dnc/azext_dnc/azext_metadata.json +++ b/src/dnc/azext_dnc/azext_metadata.json @@ -1,4 +1,4 @@ { "azext.isPreview": true, - "azext.minCliCoreVersion": "2.15.0" + "azext.minCliCoreVersion": "2.49.0" } \ No newline at end of file diff --git a/src/dnc/azext_dnc/commands.py b/src/dnc/azext_dnc/commands.py new file mode 100644 index 00000000000..b0d842e4993 --- /dev/null +++ b/src/dnc/azext_dnc/commands.py @@ -0,0 +1,15 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +# from azure.cli.core.commands import CliCommandType + + +def load_command_table(self, _): # pylint: disable=unused-argument + pass diff --git a/src/dnc/azext_dnc/custom.py b/src/dnc/azext_dnc/custom.py index dbe9d5f9742..86df1e48ef5 100644 --- a/src/dnc/azext_dnc/custom.py +++ b/src/dnc/azext_dnc/custom.py @@ -1,17 +1,14 @@ -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. +# Licensed under the MIT License. See License.txt in the project root for license information. # -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=wildcard-import -# pylint: disable=unused-wildcard-import +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- -from .generated.custom import * # noqa: F403 -try: - from .manual.custom import * # noqa: F403 -except ImportError: - pass +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +from knack.log import get_logger + + +logger = get_logger(__name__) diff --git a/src/dnc/azext_dnc/generated/__init__.py b/src/dnc/azext_dnc/generated/__init__.py deleted file mode 100644 index c9cfdc73e77..00000000000 --- a/src/dnc/azext_dnc/generated/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/dnc/azext_dnc/generated/_client_factory.py b/src/dnc/azext_dnc/generated/_client_factory.py deleted file mode 100644 index f68e285dece..00000000000 --- a/src/dnc/azext_dnc/generated/_client_factory.py +++ /dev/null @@ -1,28 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - - -def cf_dnc_cl(cli_ctx, *_): - from azure.cli.core.commands.client_factory import get_mgmt_service_client - from azext_dnc.vendored_sdks.dnc import DNC - return get_mgmt_service_client(cli_ctx, - DNC) - - -def cf_controller(cli_ctx, *_): - return cf_dnc_cl(cli_ctx).controller - - -def cf_orchestrator_instance_service(cli_ctx, *_): - return cf_dnc_cl(cli_ctx).orchestrator_instance_service - - -def cf_delegated_subnet_service(cli_ctx, *_): - return cf_dnc_cl(cli_ctx).delegated_subnet_service diff --git a/src/dnc/azext_dnc/generated/_help.py b/src/dnc/azext_dnc/generated/_help.py deleted file mode 100644 index 317f5312ea9..00000000000 --- a/src/dnc/azext_dnc/generated/_help.py +++ /dev/null @@ -1,159 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=too-many-lines - -from knack.help_files import helps - - -helps['dnc controller'] = """ - type: group - short-summary: Manage controller with dnc -""" - -helps['dnc controller show'] = """ - type: command - short-summary: "Gets details about the specified dnc controller." - examples: - - name: Get details of a controller - text: |- - az dnc controller show --resource-group "TestRG" --resource-name "testcontroller" -""" - -helps['dnc controller create'] = """ - type: command - short-summary: "Create a dnc controller." - examples: - - name: Create controller - text: |- - az dnc controller create --location "West US" --resource-group "TestRG" --resource-name \ -"testcontroller" -""" - -helps['dnc controller delete'] = """ - type: command - short-summary: "Deletes the DNC controller." - examples: - - name: Delete controller - text: |- - az dnc controller delete --resource-group "TestRG" --resource-name "testcontroller" -""" - -helps['dnc controller wait'] = """ - type: command - short-summary: Place the CLI in a waiting state until a condition of the dnc controller is met. - examples: - - name: Pause executing next line of CLI script until the dnc controller is successfully created. - text: |- - az dnc controller wait --resource-group "TestRG" --resource-name "testcontroller" --created - - name: Pause executing next line of CLI script until the dnc controller is successfully deleted. - text: |- - az dnc controller wait --resource-group "TestRG" --resource-name "testcontroller" --deleted -""" - -helps['dnc orchestrator-instance-service'] = """ - type: group - short-summary: Manage orchestrator instance service with dnc -""" - -helps['dnc orchestrator-instance-service show'] = """ - type: command - short-summary: "Gets details about the orchestrator instance." - examples: - - name: Get details of a orchestratorInstance - text: |- - az dnc orchestrator-instance-service show --resource-group "TestRG" --resource-name "testk8s1" -""" - -helps['dnc orchestrator-instance-service create'] = """ - type: command - short-summary: "Create a orchestrator instance." - examples: - - name: Create orchestrator instance - text: |- - az dnc orchestrator-instance-service create --type "SystemAssigned" --location "West US" \ ---api-server-endpoint "https://testk8s.cloudapp.net" --cluster-root-ca "ddsadsad344mfdsfdl" --id \ -"/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.DelegatedNetwork/control\ -ler/testcontroller" --orchestrator-app-id "546192d7-503f-477a-9cfe-4efc3ee2b6e1" --orchestrator-tenant-id \ -"da6192d7-503f-477a-9cfe-4efc3ee2b6c3" --priv-link-resource-id "/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/res\ -ourceGroups/TestRG/providers/Microsoft.Network/privateLinkServices/plresource1" --resource-group "TestRG" \ ---resource-name "testk8s1" -""" - -helps['dnc orchestrator-instance-service delete'] = """ - type: command - short-summary: "Deletes the Orchestrator Instance." - examples: - - name: Delete Orchestrator Instance - text: |- - az dnc orchestrator-instance-service delete --resource-group "TestRG" --resource-name "k8stest1" -""" - -helps['dnc orchestrator-instance-service wait'] = """ - type: command - short-summary: Place the CLI in a waiting state until a condition of the dnc orchestrator-instance-service is met. - examples: - - name: Pause executing next line of CLI script until the dnc orchestrator-instance-service is successfully \ -created. - text: |- - az dnc orchestrator-instance-service wait --resource-group "TestRG" --resource-name "testk8s1" \ ---created - - name: Pause executing next line of CLI script until the dnc orchestrator-instance-service is successfully \ -deleted. - text: |- - az dnc orchestrator-instance-service wait --resource-group "TestRG" --resource-name "testk8s1" \ ---deleted -""" - -helps['dnc delegated-subnet-service'] = """ - type: group - short-summary: Manage delegated subnet service with dnc -""" - -helps['dnc delegated-subnet-service show'] = """ - type: command - short-summary: "Gets details about the specified dnc DelegatedSubnet Link." - examples: - - name: Get details of a delegated subnet - text: |- - az dnc delegated-subnet-service show --resource-group "TestRG" --resource-name "delegated1" -""" - -helps['dnc delegated-subnet-service create'] = """ - type: command - short-summary: "Put delegated subnet resource." - examples: - - name: put delegated subnet - text: |- - az dnc delegated-subnet-service create --location "West US" --id "/subscriptions/613192d7-503f-477a-9cfe\ --4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.DelegatedNetwork/controller/dnctestcontroller" \ ---subnet-details-id "/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.Netw\ -ork/virtualNetworks/testvnet/subnets/testsubnet" --resource-group "TestRG" --resource-name "delegated1" -""" - -helps['dnc delegated-subnet-service delete'] = """ - type: command - short-summary: "Delete dnc DelegatedSubnet." - examples: - - name: delete delegated subnet - text: |- - az dnc delegated-subnet-service delete --resource-group "TestRG" --resource-name "delegated1" -""" - -helps['dnc delegated-subnet-service wait'] = """ - type: command - short-summary: Place the CLI in a waiting state until a condition of the dnc delegated-subnet-service is met. - examples: - - name: Pause executing next line of CLI script until the dnc delegated-subnet-service is successfully created. - text: |- - az dnc delegated-subnet-service wait --resource-group "TestRG" --resource-name "delegated1" --created - - name: Pause executing next line of CLI script until the dnc delegated-subnet-service is successfully deleted. - text: |- - az dnc delegated-subnet-service wait --resource-group "TestRG" --resource-name "delegated1" --deleted -""" diff --git a/src/dnc/azext_dnc/generated/_params.py b/src/dnc/azext_dnc/generated/_params.py deleted file mode 100644 index ae7cd3a82dc..00000000000 --- a/src/dnc/azext_dnc/generated/_params.py +++ /dev/null @@ -1,109 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=too-many-lines -# pylint: disable=too-many-statements - -from azure.cli.core.commands.parameters import ( - tags_type, - get_three_state_flag, - get_enum_type, - resource_group_name_type, - get_location_type -) -from azure.cli.core.commands.validators import get_default_location_from_resource_group - - -def load_arguments(self, _): - - with self.argument_context('dnc controller show') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('resource_name', type=str, help='The name of the resource. It must be a minimum of 3 characters, ' - 'and a maximum of 63.', id_part='name') - - with self.argument_context('dnc controller create') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('resource_name', type=str, help='The name of the resource. It must be a minimum of 3 characters, ' - 'and a maximum of 63.') - c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, - validator=get_default_location_from_resource_group) - c.argument('tags', tags_type) - - with self.argument_context('dnc controller delete') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('resource_name', type=str, help='The name of the resource. It must be a minimum of 3 characters, ' - 'and a maximum of 63.', id_part='name') - - with self.argument_context('dnc controller wait') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('resource_name', type=str, help='The name of the resource. It must be a minimum of 3 characters, ' - 'and a maximum of 63.', id_part='name') - - with self.argument_context('dnc orchestrator-instance-service show') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('resource_name', type=str, help='The name of the resource. It must be a minimum of 3 characters, ' - 'and a maximum of 63.', id_part='name') - - with self.argument_context('dnc orchestrator-instance-service create') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('resource_name', type=str, help='The name of the resource. It must be a minimum of 3 characters, ' - 'and a maximum of 63.') - c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, - validator=get_default_location_from_resource_group) - c.argument('tags', tags_type) - c.argument('type_', options_list=['--type'], arg_type=get_enum_type(['SystemAssigned', 'None']), help='The ' - 'type of identity used for orchestrator cluster. Type \'SystemAssigned\' will use an implicitly ' - 'created identity orchestrator clusters', arg_group='Identity') - c.argument('orchestrator_app_id', type=str, help='AAD ID used with apiserver') - c.argument('orchestrator_tenant_id', type=str, help='TenantID of server App ID') - c.argument('cluster_root_ca', type=str, help='RootCA certificate of kubernetes cluster base64 encoded') - c.argument('api_server_endpoint', type=str, help='K8s APIServer url. Either one of apiServerEndpoint or ' - 'privateLinkResourceId can be specified') - c.argument('private_link_resource_id', options_list=['--priv-link-resource-id'], type=str, help='private link ' - 'arm resource id. Either one of apiServerEndpoint or privateLinkResourceId can be specified') - c.argument('id_', options_list=['--id'], type=str, help='controller arm resource id', arg_group='Controller ' - 'Details') - - with self.argument_context('dnc orchestrator-instance-service delete') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('resource_name', type=str, help='The name of the resource. It must be a minimum of 3 characters, ' - 'and a maximum of 63.', id_part='name') - c.argument('force_delete', arg_type=get_three_state_flag(), help='Force delete resource') - - with self.argument_context('dnc orchestrator-instance-service wait') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('resource_name', type=str, help='The name of the resource. It must be a minimum of 3 characters, ' - 'and a maximum of 63.', id_part='name') - - with self.argument_context('dnc delegated-subnet-service show') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('resource_name', type=str, help='The name of the resource. It must be a minimum of 3 characters, ' - 'and a maximum of 63.', id_part='name') - - with self.argument_context('dnc delegated-subnet-service create') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('resource_name', type=str, help='The name of the resource. It must be a minimum of 3 characters, ' - 'and a maximum of 63.') - c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, - validator=get_default_location_from_resource_group) - c.argument('tags', tags_type) - c.argument('id_', options_list=['--id'], type=str, help='controller arm resource id', arg_group='Controller ' - 'Details') - c.argument('subnet_details_id', type=str, help='subnet arm resource id', arg_group='Subnet Details') - - with self.argument_context('dnc delegated-subnet-service delete') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('resource_name', type=str, help='The name of the resource. It must be a minimum of 3 characters, ' - 'and a maximum of 63.', id_part='name') - c.argument('force_delete', arg_type=get_three_state_flag(), help='Force delete resource') - - with self.argument_context('dnc delegated-subnet-service wait') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('resource_name', type=str, help='The name of the resource. It must be a minimum of 3 characters, ' - 'and a maximum of 63.', id_part='name') diff --git a/src/dnc/azext_dnc/generated/_validators.py b/src/dnc/azext_dnc/generated/_validators.py deleted file mode 100644 index b33a44c1ebf..00000000000 --- a/src/dnc/azext_dnc/generated/_validators.py +++ /dev/null @@ -1,9 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- diff --git a/src/dnc/azext_dnc/generated/action.py b/src/dnc/azext_dnc/generated/action.py deleted file mode 100644 index b49bfaeeefe..00000000000 --- a/src/dnc/azext_dnc/generated/action.py +++ /dev/null @@ -1,10 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=protected-access diff --git a/src/dnc/azext_dnc/generated/commands.py b/src/dnc/azext_dnc/generated/commands.py deleted file mode 100644 index 36fd497fab0..00000000000 --- a/src/dnc/azext_dnc/generated/commands.py +++ /dev/null @@ -1,54 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=too-many-statements -# pylint: disable=too-many-locals - -from azure.cli.core.commands import CliCommandType - - -def load_command_table(self, _): - - from azext_dnc.generated._client_factory import cf_controller - dnc_controller = CliCommandType( - operations_tmpl='azext_dnc.vendored_sdks.dnc.operations._controller_operations#ControllerOperations.{}', - client_factory=cf_controller) - with self.command_group('dnc controller', dnc_controller, client_factory=cf_controller) as g: - g.custom_show_command('show', 'dnc_controller_show') - g.custom_command('create', 'dnc_controller_create', supports_no_wait=True) - g.custom_command('delete', 'dnc_controller_delete', supports_no_wait=True, confirmation=True) - g.custom_wait_command('wait', 'dnc_controller_show') - - from azext_dnc.generated._client_factory import cf_orchestrator_instance_service - dnc_orchestrator_instance_service = CliCommandType( - operations_tmpl='azext_dnc.vendored_sdks.dnc.operations._orchestrator_instance_service_operations#OrchestratorI' - 'nstanceServiceOperations.{}', - client_factory=cf_orchestrator_instance_service) - with self.command_group('dnc orchestrator-instance-service', dnc_orchestrator_instance_service, - client_factory=cf_orchestrator_instance_service) as g: - g.custom_show_command('show', 'dnc_orchestrator_instance_service_show') - g.custom_command('create', 'dnc_orchestrator_instance_service_create', supports_no_wait=True) - g.custom_command('delete', 'dnc_orchestrator_instance_service_delete', supports_no_wait=True, - confirmation=True) - g.custom_wait_command('wait', 'dnc_orchestrator_instance_service_show') - - from azext_dnc.generated._client_factory import cf_delegated_subnet_service - dnc_delegated_subnet_service = CliCommandType( - operations_tmpl='azext_dnc.vendored_sdks.dnc.operations._delegated_subnet_service_operations#DelegatedSubnetSer' - 'viceOperations.{}', - client_factory=cf_delegated_subnet_service) - with self.command_group('dnc delegated-subnet-service', dnc_delegated_subnet_service, - client_factory=cf_delegated_subnet_service) as g: - g.custom_show_command('show', 'dnc_delegated_subnet_service_show') - g.custom_command('create', 'dnc_delegated_subnet_service_create', supports_no_wait=True) - g.custom_command('delete', 'dnc_delegated_subnet_service_delete', supports_no_wait=True, confirmation=True) - g.custom_wait_command('wait', 'dnc_delegated_subnet_service_show') - - with self.command_group('dnc', is_preview=True): - pass diff --git a/src/dnc/azext_dnc/generated/custom.py b/src/dnc/azext_dnc/generated/custom.py deleted file mode 100644 index fdb1bc6a46d..00000000000 --- a/src/dnc/azext_dnc/generated/custom.py +++ /dev/null @@ -1,139 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=too-many-lines - -from azure.cli.core.util import sdk_no_wait - - -def dnc_controller_show(client, - resource_group_name, - resource_name): - return client.get_details(resource_group_name=resource_group_name, - resource_name=resource_name) - - -def dnc_controller_create(client, - resource_group_name, - resource_name, - location=None, - tags=None, - no_wait=False): - parameters = {} - parameters['location'] = location - parameters['tags'] = tags - return sdk_no_wait(no_wait, - client.begin_create, - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters) - - -def dnc_controller_delete(client, - resource_group_name, - resource_name, - no_wait=False): - return sdk_no_wait(no_wait, - client.begin_delete, - resource_group_name=resource_group_name, - resource_name=resource_name) - - -def dnc_orchestrator_instance_service_show(client, - resource_group_name, - resource_name): - return client.get_details(resource_group_name=resource_group_name, - resource_name=resource_name) - - -def dnc_orchestrator_instance_service_create(client, - resource_group_name, - resource_name, - location=None, - tags=None, - type_=None, - orchestrator_app_id=None, - orchestrator_tenant_id=None, - cluster_root_ca=None, - api_server_endpoint=None, - private_link_resource_id=None, - id_=None, - no_wait=False): - parameters = {} - parameters['location'] = location - parameters['kind'] = "Kubernetes" - parameters['tags'] = tags - parameters['identity'] = {} - parameters['identity']['type'] = type_ - parameters['properties'] = {} - parameters['properties']['orchestrator_app_id'] = orchestrator_app_id - parameters['properties']['orchestrator_tenant_id'] = orchestrator_tenant_id - parameters['properties']['cluster_root_ca'] = cluster_root_ca - parameters['properties']['api_server_endpoint'] = api_server_endpoint - parameters['properties']['private_link_resource_id'] = private_link_resource_id - parameters['properties']['controller_details'] = {} - parameters['properties']['controller_details']['id'] = id_ - return sdk_no_wait(no_wait, - client.begin_create, - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters) - - -def dnc_orchestrator_instance_service_delete(client, - resource_group_name, - resource_name, - force_delete=None, - no_wait=False): - return sdk_no_wait(no_wait, - client.begin_delete, - resource_group_name=resource_group_name, - resource_name=resource_name, - force_delete=force_delete) - - -def dnc_delegated_subnet_service_show(client, - resource_group_name, - resource_name): - return client.get_details(resource_group_name=resource_group_name, - resource_name=resource_name) - - -def dnc_delegated_subnet_service_create(client, - resource_group_name, - resource_name, - location=None, - tags=None, - id_=None, - subnet_details_id=None, - no_wait=False): - parameters = {} - parameters['location'] = location - parameters['tags'] = tags - parameters['controller_details'] = {} - parameters['controller_details']['id'] = id_ - parameters['subnet_details'] = {} - parameters['subnet_details']['id'] = subnet_details_id - return sdk_no_wait(no_wait, - client.begin_put_details, - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters) - - -def dnc_delegated_subnet_service_delete(client, - resource_group_name, - resource_name, - force_delete=None, - no_wait=False): - return sdk_no_wait(no_wait, - client.begin_delete_details, - resource_group_name=resource_group_name, - resource_name=resource_name, - force_delete=force_delete) diff --git a/src/dnc/azext_dnc/manual/__init__.py b/src/dnc/azext_dnc/manual/__init__.py deleted file mode 100644 index c9cfdc73e77..00000000000 --- a/src/dnc/azext_dnc/manual/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/dnc/azext_dnc/manual/tests/latest/__init__.py b/src/dnc/azext_dnc/manual/tests/latest/__init__.py deleted file mode 100644 index c9cfdc73e77..00000000000 --- a/src/dnc/azext_dnc/manual/tests/latest/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/dnc/azext_dnc/manual/tests/latest/example_steps.py b/src/dnc/azext_dnc/manual/tests/latest/example_steps.py deleted file mode 100644 index 9d6b6ccf131..00000000000 --- a/src/dnc/azext_dnc/manual/tests/latest/example_steps.py +++ /dev/null @@ -1,179 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - - -# EXAMPLE: /Controller/put/Create controller -def step_controller_create(test, rg, rg_2, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc controller create ' - '--location "eastus2euap" ' - '--resource-group "{rg}" ' - '--resource-name "{myController}"', - checks=checks) - - -# EXAMPLE: /Controller/get/Get details of a controller -def step_controller_show(test, rg, rg_2, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc controller show ' - '--resource-group "{rg}" ' - '--resource-name "{myController}"', - checks=checks) - - -# EXAMPLE: /DelegatedSubnetService/put/put delegated subnet -def step_delegated_subnet_service_create(test, rg, rg_2, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc delegated-subnet-service create ' - '--location "eastus2euap" ' - '--id "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.DelegatedNetwork/controlle' - 'r/{myController}" ' - '--subnet-details-id "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.Network/vir' - 'tualNetworks/{vn}/subnets/default" ' - '--resource-group "{rg}" ' - '--resource-name "delegated1"', - checks=checks) - - -# EXAMPLE: /DelegatedSubnetService/get/Get details of a delegated subnet -def step_delegated_subnet_service_show(test, rg, rg_2, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc delegated-subnet-service show ' - '--resource-group "{rg}" ' - '--resource-name "delegated1"', - checks=checks) - - -# EXAMPLE: /DelegatedSubnetService/patch/patch delegated subnet -def step_delegated_subnet_service_patch_detail(test, rg, rg_2, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc delegated-subnet-service patch-detail ' - '--tags key="value" ' - '--resource-group "{rg}" ' - '--resource-name "delegated1"', - checks=checks) - - -# EXAMPLE: /OrchestratorInstanceService/put/Create orchestrator instance -def step_orchestrator_instance_service_create(test, rg, rg_2, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc orchestrator-instance-service create ' - '--type "SystemAssigned" ' - '--location "eastus2euap" ' - '--api-server-endpoint "https://testk8s.cloudapp.net" ' - '--cluster-root-ca "ddsadsad344mfdsfdl" ' - '--id "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.DelegatedNetwork/controlle' - 'r/{myController}" ' - '--orchestrator-app-id "546192d7-503f-477a-9cfe-4efc3ee2b6e1" ' - '--orchestrator-tenant-id "da6192d7-503f-477a-9cfe-4efc3ee2b6c3" ' - '--priv-link-resource-id "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.Network' - '/privateLinkServices/plresource1" ' - '--resource-group "{rg}" ' - '--resource-name "testk8s1"', - checks=checks) - -# EXAMPLE: /OrchestratorInstanceService/get/Get details of a orchestratorInstance -def step_orchestrator_instance_service_show(test, rg, rg_2, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc orchestrator-instance-service show ' - '--resource-group "{rg}" ' - '--resource-name "testk8s1"', - checks=checks) - - -# EXAMPLE: /OrchestratorInstanceService/get/Get OrchestratorInstance resources by resource group -def step_orchestrator_instance_service_list(test, rg, rg_2, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc orchestrator-instance-service list ' - '--resource-group "{rg_2}"', - checks=checks) - - -# EXAMPLE: /OrchestratorInstanceService/get/Get orchestratorInstance resources by subscription -def step_orchestrator_instance_service_list2(test, rg, rg_2, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc orchestrator-instance-service list ' - '-g ""', - checks=checks) - - -# EXAMPLE: /OrchestratorInstanceService/delete/Delete Orchestrator Instance -def step_orchestrator_instance_service_delete(test, rg, rg_2, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc orchestrator-instance-service delete -y ' - '--resource-group "{rg}" ' - '--resource-name "k8stest1"', - checks=checks) - - -# EXAMPLE: /Controller/delete/Delete controller -def step_controller_delete(test, rg, rg_2, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc controller delete -y ' - '--resource-group "{rg}" ' - '--resource-name "{myController}"', - checks=checks) - - -# EXAMPLE: /DelegatedNetwork/get/Get DelegatedController resources by subscription -def step_delegated_network_list(test, rg, rg_2, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc delegated-network list ' - '-g ""', - checks=checks) - - -# EXAMPLE: /DelegatedNetwork/get/Get DelegatedNetwork resources by resource group -def step_delegated_network_list2(test, rg, rg_2, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc delegated-network list ' - '--resource-group "{rg_2}"', - checks=checks) - - -# EXAMPLE: /DelegatedSubnetService/get/Get DelegatedSubnets resources by resource group -def step_delegated_subnet_service_list(test, rg, rg_2, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc delegated-subnet-service list ' - '--resource-group "{rg_2}"', - checks=checks) - - -# EXAMPLE: /DelegatedSubnetService/get/Get DelegatedSubnets resources by subscription -def step_delegated_subnet_service_list2(test, rg, rg_2, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc delegated-subnet-service list ' - '-g ""', - checks=checks) - - -# EXAMPLE: /DelegatedSubnetService/delete/delete delegated subnet -def step_delegated_subnet_service_delete(test, rg, rg_2, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc delegated-subnet-service delete -y ' - '--resource-group "{rg}" ' - '--resource-name "delegated1"', - checks=checks) \ No newline at end of file diff --git a/src/dnc/azext_dnc/manual/tests/latest/preparers.py b/src/dnc/azext_dnc/manual/tests/latest/preparers.py deleted file mode 100644 index 53aa6614e7e..00000000000 --- a/src/dnc/azext_dnc/manual/tests/latest/preparers.py +++ /dev/null @@ -1,113 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import os -from datetime import datetime -from azure.cli.testsdk.scenario_tests import SingleValueReplacer -from azure.cli.testsdk.preparers import NoTrafficRecordingPreparer -from azure.cli.testsdk.exceptions import CliTestError -from azure.cli.testsdk.reverse_dependency import get_dummy_cli - - -KEY_RESOURCE_GROUP = 'rg' -KEY_VIRTUAL_NETWORK = 'vnet' -KEY_VNET_SUBNET = 'subnet' -KEY_VNET_NIC = 'nic' - - -class VirtualNetworkPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): - def __init__(self, name_prefix='clitest.vn', - parameter_name='virtual_network', - resource_group_name=None, - resource_group_key=KEY_RESOURCE_GROUP, - dev_setting_name='AZURE_CLI_TEST_DEV_VIRTUAL_NETWORK_NAME', - random_name_length=24, key=KEY_VIRTUAL_NETWORK): - if ' ' in name_prefix: - raise CliTestError( - 'Error: Space character in name prefix \'%s\'' % name_prefix) - super(VirtualNetworkPreparer, self).__init__( - name_prefix, random_name_length) - self.cli_ctx = get_dummy_cli() - self.parameter_name = parameter_name - self.key = key - self.resource_group_name = resource_group_name - self.resource_group_key = resource_group_key - self.dev_setting_name = os.environ.get(dev_setting_name, None) - - def create_resource(self, name, **_): - if self.dev_setting_name: - return {self.parameter_name: self.dev_setting_name, } - - if not self.resource_group_name: - self.resource_group_name = self.test_class_instance.kwargs.get( - self.resource_group_key) - if not self.resource_group_name: - raise CliTestError("Error: No resource group configured!") - - tags = {'product': 'azurecli', 'cause': 'automation', - 'date': datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')} - if 'ENV_JOB_NAME' in os.environ: - tags['job'] = os.environ['ENV_JOB_NAME'] - tags = ' '.join(['{}={}'.format(key, value) - for key, value in tags.items()]) - template = 'az network vnet create --resource-group {} --name {} --subnet-name default --tag ' + tags - self.live_only_execute(self.cli_ctx, template.format( - self.resource_group_name, name)) - - self.test_class_instance.kwargs[self.key] = name - return {self.parameter_name: name} - - def remove_resource(self, name, **_): - # delete vnet if test is being recorded and if the vnet is not a dev rg - if not self.dev_setting_name: - self.live_only_execute( - self.cli_ctx, - 'az network vnet delete --name {} --resource-group {}'.format(name, self.resource_group_name)) - - -class VnetSubnetPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): - def __init__(self, name_prefix='clitest.vn', - parameter_name='subnet', - resource_group_key=KEY_RESOURCE_GROUP, - vnet_key=KEY_VIRTUAL_NETWORK, - address_prefixes="11.0.0.0/24", - dev_setting_name='AZURE_CLI_TEST_DEV_VNET_SUBNET_NAME', - key=KEY_VNET_SUBNET): - if ' ' in name_prefix: - raise CliTestError( - 'Error: Space character in name prefix \'%s\'' % name_prefix) - super(VnetSubnetPreparer, self).__init__(name_prefix, 15) - self.cli_ctx = get_dummy_cli() - self.parameter_name = parameter_name - self.key = key - self.resource_group = [resource_group_key, None] - self.vnet = [vnet_key, None] - self.address_prefixes = address_prefixes - self.dev_setting_name = os.environ.get(dev_setting_name, None) - - def create_resource(self, name, **_): - if self.dev_setting_name: - return {self.parameter_name: self.dev_setting_name, } - - if not self.resource_group[1]: - self.resource_group[1] = self.test_class_instance.kwargs.get( - self.resource_group[0]) - if not self.resource_group[1]: - raise CliTestError("Error: No resource group configured!") - if not self.vnet[1]: - self.vnet[1] = self.test_class_instance.kwargs.get(self.vnet[0]) - if not self.vnet[1]: - raise CliTestError("Error: No vnet configured!") - - self.test_class_instance.kwargs[self.key] = 'default' - return {self.parameter_name: name} - - def remove_resource(self, name, **_): - pass diff --git a/src/dnc/azext_dnc/manual/tests/latest/recordings/test_dnc_Scenario.yaml b/src/dnc/azext_dnc/manual/tests/latest/recordings/test_dnc_Scenario.yaml deleted file mode 100644 index b8702f66d3b..00000000000 --- a/src/dnc/azext_dnc/manual/tests/latest/recordings/test_dnc_Scenario.yaml +++ /dev/null @@ -1,300 +0,0 @@ -interactions: -- request: - body: '{"location": "eastus2euap"}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - dnc controller create - Connection: - - keep-alive - Content-Length: - - '27' - Content-Type: - - application/json - ParameterSetName: - - --location --resource-group --resource-name - User-Agent: - - AZURECLI/2.23.0 azsdk-python-mgmt-dnc/1.0.0b1 Python/3.9.5 (Windows-10-10.0.19043-SP0) - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.DelegatedNetwork/controller/testcontroller?api-version=2021-03-15 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.DelegatedNetwork/controller/testcontroller","location":"eastus2euap","name":"testcontroller","type":"Microsoft.DelegatedNetwork/controller","properties":{"controllerProperties":{"dncAppId":"a91b1853-4403-4f54-b5cb-d1ea19d90c37","dncEndpoint":"https://openai-eastus2euap.dnc.azure.com","dncTenantId":null},"resourceGuid":"5c7e26be-7ff9-4aaf-9e16-0bc759605aea","provisioningState":"Succeeded"}}' - headers: - cache-control: - - no-cache - content-length: - - '562' - content-type: - - application/json - date: - - Wed, 09 Jun 2021 00:13:53 GMT - expires: - - '-1' - pragma: - - no-cache - request-context: - - appId=cid-v1:82487bea-6925-46b8-a5c9-0bcae97f8f27 - server: - - Kestrel - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1199' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - dnc controller show - Connection: - - keep-alive - ParameterSetName: - - --resource-group --resource-name - User-Agent: - - AZURECLI/2.23.0 azsdk-python-mgmt-dnc/1.0.0b1 Python/3.9.5 (Windows-10-10.0.19043-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.DelegatedNetwork/controller/testcontroller?api-version=2021-03-15 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.DelegatedNetwork/controller/testcontroller","location":"eastus2euap","name":"testcontroller","type":"Microsoft.DelegatedNetwork/controller","properties":{"controllerProperties":{"dncAppId":"a91b1853-4403-4f54-b5cb-d1ea19d90c37","dncEndpoint":"https://openai-eastus2euap.dnc.azure.com","dncTenantId":null},"resourceGuid":"5c7e26be-7ff9-4aaf-9e16-0bc759605aea","provisioningState":"Succeeded"}}' - headers: - cache-control: - - no-cache - content-length: - - '562' - content-type: - - application/json - date: - - Wed, 09 Jun 2021 00:13:54 GMT - expires: - - '-1' - pragma: - - no-cache - request-context: - - appId=cid-v1:82487bea-6925-46b8-a5c9-0bcae97f8f27 - server: - - Kestrel - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: '{"location": "eastus2euap", "kind": "Kubernetes", "identity": {"type": - "SystemAssigned"}, "properties": {"orchestratorAppId": "546192d7-503f-477a-9cfe-4efc3ee2b6e1", - "orchestratorTenantId": "da6192d7-503f-477a-9cfe-4efc3ee2b6c3", "clusterRootCA": - "ddsadsad344mfdsfdl", "apiServerEndpoint": "https://testk8s.cloudapp.net", "privateLinkResourceId": - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Network/privateLinkServices/plresource1", - "controllerDetails": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.DelegatedNetwork/controller/testcontroller"}}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - dnc orchestrator-instance-service create - Connection: - - keep-alive - Content-Length: - - '791' - Content-Type: - - application/json - ParameterSetName: - - --type --location --api-server-endpoint --cluster-root-ca --id --orchestrator-app-id - --orchestrator-tenant-id --priv-link-resource-id --resource-group --resource-name - User-Agent: - - AZURECLI/2.23.0 azsdk-python-mgmt-dnc/1.0.0b1 Python/3.9.5 (Windows-10-10.0.19043-SP0) - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.DelegatedNetwork/orchestrators/testk8s1?api-version=2021-03-15 - response: - body: - string: '{"kind":"Kubernetes","identity":{"principalId":"72c78660-546e-4019-a4d8-d60e4a6d966c","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.DelegatedNetwork/orchestratorInstances/testk8s1","location":"eastus2euap","name":"testk8s1","type":"Microsoft.DelegatedNetwork/orchestratorInstances","properties":{"orchestratorAppId":"546192d7-503f-477a-9cfe-4efc3ee2b6e1","orchestratorTenantId":"da6192d7-503f-477a-9cfe-4efc3ee2b6c3","clusterRootCA":"ddsadsad344mfdsfdl","apiServerEndpoint":"https://testk8s.cloudapp.net","controllerDetails":{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.DelegatedNetwork/controller/testcontroller"},"resourceGuid":"27626930-d2e4-4acd-9ac8-6d8579a3b7c8","provisioningState":"Succeeded"}}' - headers: - cache-control: - - no-cache - content-length: - - '1025' - content-type: - - application/json - date: - - Wed, 09 Jun 2021 00:14:00 GMT - expires: - - '-1' - pragma: - - no-cache - request-context: - - appId=cid-v1:82487bea-6925-46b8-a5c9-0bcae97f8f27 - server: - - Kestrel - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1199' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - dnc orchestrator-instance-service show - Connection: - - keep-alive - ParameterSetName: - - --resource-group --resource-name - User-Agent: - - AZURECLI/2.23.0 azsdk-python-mgmt-dnc/1.0.0b1 Python/3.9.5 (Windows-10-10.0.19043-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.DelegatedNetwork/orchestrators/testk8s1?api-version=2021-03-15 - response: - body: - string: '{"kind":"Kubernetes","identity":{"principalId":"72c78660-546e-4019-a4d8-d60e4a6d966c","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.DelegatedNetwork/orchestratorInstances/testk8s1","location":"eastus2euap","name":"testk8s1","type":"Microsoft.DelegatedNetwork/orchestratorInstances","properties":{"orchestratorAppId":"546192d7-503f-477a-9cfe-4efc3ee2b6e1","orchestratorTenantId":"da6192d7-503f-477a-9cfe-4efc3ee2b6c3","clusterRootCA":"ddsadsad344mfdsfdl","apiServerEndpoint":"https://testk8s.cloudapp.net","controllerDetails":{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.DelegatedNetwork/controller/testcontroller"},"resourceGuid":"27626930-d2e4-4acd-9ac8-6d8579a3b7c8","provisioningState":"Succeeded"}}' - headers: - cache-control: - - no-cache - content-length: - - '1025' - content-type: - - application/json - date: - - Wed, 09 Jun 2021 00:14:02 GMT - expires: - - '-1' - pragma: - - no-cache - request-context: - - appId=cid-v1:82487bea-6925-46b8-a5c9-0bcae97f8f27 - server: - - Kestrel - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - dnc orchestrator-instance-service delete - Connection: - - keep-alive - Content-Length: - - '0' - ParameterSetName: - - -y --resource-group --resource-name - User-Agent: - - AZURECLI/2.23.0 azsdk-python-mgmt-dnc/1.0.0b1 Python/3.9.5 (Windows-10-10.0.19043-SP0) - method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.DelegatedNetwork/orchestrators/k8stest1?api-version=2021-03-15 - response: - body: - string: '' - headers: - cache-control: - - no-cache - date: - - Wed, 09 Jun 2021 00:14:02 GMT - expires: - - '-1' - pragma: - - no-cache - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-deletes: - - '14999' - status: - code: 204 - message: No Content -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - dnc controller delete - Connection: - - keep-alive - Content-Length: - - '0' - ParameterSetName: - - -y --resource-group --resource-name - User-Agent: - - AZURECLI/2.23.0 azsdk-python-mgmt-dnc/1.0.0b1 Python/3.9.5 (Windows-10-10.0.19043-SP0) - method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.DelegatedNetwork/controller/testcontroller?api-version=2021-03-15 - response: - body: - string: '' - headers: - cache-control: - - no-cache - content-length: - - '0' - content-type: - - application/json - date: - - Wed, 09 Jun 2021 00:14:05 GMT - expires: - - '-1' - pragma: - - no-cache - request-context: - - appId=cid-v1:82487bea-6925-46b8-a5c9-0bcae97f8f27 - server: - - Kestrel - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-deletes: - - '14999' - status: - code: 200 - message: OK -version: 1 diff --git a/src/dnc/azext_dnc/manual/tests/latest/test_dnc_scenario.py b/src/dnc/azext_dnc/manual/tests/latest/test_dnc_scenario.py deleted file mode 100644 index b7ea6e7dc42..00000000000 --- a/src/dnc/azext_dnc/manual/tests/latest/test_dnc_scenario.py +++ /dev/null @@ -1,77 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import os -from azure.cli.testsdk import ScenarioTest -from azure.cli.testsdk import ResourceGroupPreparer -from .preparers import VirtualNetworkPreparer -from .example_steps import step_controller_create -from .example_steps import step_controller_show -from .example_steps import step_delegated_subnet_service_create -from .example_steps import step_delegated_subnet_service_list -from .example_steps import step_delegated_subnet_service_show -from .example_steps import step_orchestrator_instance_service_create -from .example_steps import step_orchestrator_instance_service_show -from .example_steps import step_orchestrator_instance_service_list -from .example_steps import step_orchestrator_instance_service_list2 -from .example_steps import step_orchestrator_instance_service_delete -from .example_steps import step_controller_delete -from .example_steps import step_delegated_network_list -from .example_steps import step_delegated_network_list2 -from .example_steps import step_delegated_subnet_service_list2 -from .example_steps import step_delegated_subnet_service_delete - - -TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) - - -# Env setup_scenario -def setup_scenario(test, rg, rg_2): - pass - - -# Env cleanup_scenario -def cleanup_scenario(test, rg, rg_2): - pass - - -# Testcase: Scenario -def call_scenario(test, rg, rg_2): - setup_scenario(test, rg, rg_2) - step_controller_create(test, rg, rg_2, checks=[]) - step_controller_show(test, rg, rg_2, checks=[]) - step_orchestrator_instance_service_create(test, rg, rg_2, checks=[]) - step_orchestrator_instance_service_show(test, rg, rg_2, checks=[]) - step_orchestrator_instance_service_delete(test, rg, rg_2, checks=[]) - step_controller_delete(test, rg, rg_2, checks=[]) - cleanup_scenario(test, rg, rg_2) - - -# Test class for Scenario -class DncScenarioTest(ScenarioTest): - - def __init__(self, *args, **kwargs): - super(DncScenarioTest, self).__init__(*args, **kwargs) - self.kwargs.update({ - 'subscription_id': self.get_subscription_id() - }) - - self.kwargs.update({ - 'myController': 'testcontroller', - 'myController2': 'dnctestcontroller', - }) - - - @ResourceGroupPreparer(name_prefix='clitestdnc_TestRG'[:7], key='rg', parameter_name='rg') - @ResourceGroupPreparer(name_prefix='clitestdnc_testRG'[:7], key='rg_2', parameter_name='rg_2') - @VirtualNetworkPreparer(name_prefix='clitestdnc_testvnet'[:7], key='vn', resource_group_key='rg') - def test_dnc_Scenario(self, rg, rg_2): - call_scenario(self, rg, rg_2) - diff --git a/src/dnc/azext_dnc/tests/__init__.py b/src/dnc/azext_dnc/tests/__init__.py index 70488e93851..5757aea3175 100644 --- a/src/dnc/azext_dnc/tests/__init__.py +++ b/src/dnc/azext_dnc/tests/__init__.py @@ -1,116 +1,6 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. +# Licensed under the MIT License. See License.txt in the project root for license information. # -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- -import inspect -import logging -import os -import sys -import traceback -import datetime as dt - -from azure.core.exceptions import AzureError -from azure.cli.testsdk.exceptions import CliTestError, CliExecutionError, JMESPathCheckAssertionError - - -logger = logging.getLogger('azure.cli.testsdk') -logger.addHandler(logging.StreamHandler()) -__path__ = __import__('pkgutil').extend_path(__path__, __name__) -exceptions = [] -test_map = dict() -SUCCESSED = "successed" -FAILED = "failed" - - -def try_manual(func): - def import_manual_function(origin_func): - from importlib import import_module - decorated_path = inspect.getfile(origin_func).lower() - module_path = __path__[0].lower() - if not decorated_path.startswith(module_path): - raise Exception("Decorator can only be used in submodules!") - manual_path = os.path.join( - decorated_path[module_path.rfind(os.path.sep) + 1:]) - manual_file_path, manual_file_name = os.path.split(manual_path) - module_name, _ = os.path.splitext(manual_file_name) - manual_module = "..manual." + \ - ".".join(manual_file_path.split(os.path.sep) + [module_name, ]) - return getattr(import_module(manual_module, package=__name__), origin_func.__name__) - - def get_func_to_call(): - func_to_call = func - try: - func_to_call = import_manual_function(func) - logger.info("Found manual override for %s(...)", func.__name__) - except (ImportError, AttributeError): - pass - return func_to_call - - def wrapper(*args, **kwargs): - func_to_call = get_func_to_call() - logger.info("running %s()...", func.__name__) - try: - test_map[func.__name__] = dict() - test_map[func.__name__]["result"] = SUCCESSED - test_map[func.__name__]["error_message"] = "" - test_map[func.__name__]["error_stack"] = "" - test_map[func.__name__]["error_normalized"] = "" - test_map[func.__name__]["start_dt"] = dt.datetime.utcnow() - ret = func_to_call(*args, **kwargs) - except (AssertionError, AzureError, CliTestError, CliExecutionError, SystemExit, - JMESPathCheckAssertionError) as e: - use_exception_cache = os.getenv("TEST_EXCEPTION_CACHE") - if use_exception_cache is None or use_exception_cache.lower() != "true": - raise - test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() - test_map[func.__name__]["result"] = FAILED - test_map[func.__name__]["error_message"] = str(e).replace("\r\n", " ").replace("\n", " ")[:500] - test_map[func.__name__]["error_stack"] = traceback.format_exc().replace( - "\r\n", " ").replace("\n", " ")[:500] - logger.info("--------------------------------------") - logger.info("step exception: %s", e) - logger.error("--------------------------------------") - logger.error("step exception in %s: %s", func.__name__, e) - logger.info(traceback.format_exc()) - exceptions.append((func.__name__, sys.exc_info())) - else: - test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() - return ret - - if inspect.isclass(func): - return get_func_to_call() - return wrapper - - -def calc_coverage(filename): - filename = filename.split(".")[0] - coverage_name = filename + "_coverage.md" - with open(coverage_name, "w") as f: - f.write("|Scenario|Result|ErrorMessage|ErrorStack|ErrorNormalized|StartDt|EndDt|\n") - total = len(test_map) - covered = 0 - for k, v in test_map.items(): - if not k.startswith("step_"): - total -= 1 - continue - if v["result"] == SUCCESSED: - covered += 1 - f.write("|{step_name}|{result}|{error_message}|{error_stack}|{error_normalized}|{start_dt}|" - "{end_dt}|\n".format(step_name=k, **v)) - f.write("Coverage: {}/{}\n".format(covered, total)) - print("Create coverage\n", file=sys.stderr) - - -def raise_if(): - if exceptions: - if len(exceptions) <= 1: - raise exceptions[0][1][1] - message = "{}\nFollowed with exceptions in other steps:\n".format(str(exceptions[0][1][1])) - message += "\n".join(["{}: {}".format(h[0], h[1][1]) for h in exceptions[1:]]) - raise exceptions[0][1][0](message).with_traceback(exceptions[0][1][2]) +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- diff --git a/src/dnc/azext_dnc/tests/latest/__init__.py b/src/dnc/azext_dnc/tests/latest/__init__.py index c9cfdc73e77..5757aea3175 100644 --- a/src/dnc/azext_dnc/tests/latest/__init__.py +++ b/src/dnc/azext_dnc/tests/latest/__init__.py @@ -1,12 +1,6 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. +# Licensed under the MIT License. See License.txt in the project root for license information. # -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -__path__ = __import__('pkgutil').extend_path(__path__, __name__) +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- diff --git a/src/dnc/azext_dnc/tests/latest/example_steps.py b/src/dnc/azext_dnc/tests/latest/example_steps.py deleted file mode 100644 index 743f31f9e90..00000000000 --- a/src/dnc/azext_dnc/tests/latest/example_steps.py +++ /dev/null @@ -1,128 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - - -from .. import try_manual - - -# EXAMPLE: /Controller/put/Create controller -@try_manual -def step_controller_create(test, rg, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc controller create ' - '--location "West US" ' - '--resource-group "{rg}" ' - '--resource-name "{myController}"', - checks=checks) - - -# EXAMPLE: /Controller/get/Get details of a controller -@try_manual -def step_controller_show(test, rg, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc controller show ' - '--resource-group "{rg}" ' - '--resource-name "{myController}"', - checks=checks) - - -# EXAMPLE: /DelegatedSubnetService/put/put delegated subnet -@try_manual -def step_delegated_subnet_service_create(test, rg, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc delegated-subnet-service create ' - '--location "West US" ' - '--id "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.DelegatedNetwork/controlle' - 'r/{myController2}" ' - '--subnet-details-id "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.Network/vir' - 'tualNetworks/{vn}/subnets/default" ' - '--resource-group "{rg}" ' - '--resource-name "delegated1"', - checks=checks) - - -# EXAMPLE: /DelegatedSubnetService/get/Get details of a delegated subnet -@try_manual -def step_delegated_subnet_service_show(test, rg, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc delegated-subnet-service show ' - '--resource-group "{rg}" ' - '--resource-name "delegated1"', - checks=checks) - - -# EXAMPLE: /DelegatedSubnetService/delete/delete delegated subnet -@try_manual -def step_delegated_subnet_service_delete(test, rg, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc delegated-subnet-service delete -y ' - '--resource-group "{rg}" ' - '--resource-name "delegated1"', - checks=checks) - - -# EXAMPLE: /OrchestratorInstanceService/put/Create orchestrator instance -@try_manual -def step_orchestrator_instance_service_create(test, rg, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc orchestrator-instance-service create ' - '--type "SystemAssigned" ' - '--location "West US" ' - '--api-server-endpoint "https://testk8s.cloudapp.net" ' - '--cluster-root-ca "ddsadsad344mfdsfdl" ' - '--id "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.DelegatedNetwork/controlle' - 'r/{myController}" ' - '--orchestrator-app-id "546192d7-503f-477a-9cfe-4efc3ee2b6e1" ' - '--orchestrator-tenant-id "da6192d7-503f-477a-9cfe-4efc3ee2b6c3" ' - '--priv-link-resource-id "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.Network' - '/privateLinkServices/plresource1" ' - '--resource-group "{rg}" ' - '--resource-name "testk8s1"', - checks=checks) - - -# EXAMPLE: /OrchestratorInstanceService/get/Get details of a orchestratorInstance -@try_manual -def step_orchestrator_instance_service_show(test, rg, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc orchestrator-instance-service show ' - '--resource-group "{rg}" ' - '--resource-name "testk8s1"', - checks=checks) - - -# EXAMPLE: /OrchestratorInstanceService/delete/Delete Orchestrator Instance -@try_manual -def step_orchestrator_instance_service_delete(test, rg, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc orchestrator-instance-service delete -y ' - '--resource-group "{rg}" ' - '--resource-name "k8stest1"', - checks=checks) - - -# EXAMPLE: /Controller/delete/Delete controller -@try_manual -def step_controller_delete(test, rg, checks=None): - if checks is None: - checks = [] - test.cmd('az dnc controller delete -y ' - '--resource-group "{rg}" ' - '--resource-name "{myController}"', - checks=checks) - diff --git a/src/dnc/azext_dnc/tests/latest/preparers.py b/src/dnc/azext_dnc/tests/latest/preparers.py deleted file mode 100644 index 176f5b16296..00000000000 --- a/src/dnc/azext_dnc/tests/latest/preparers.py +++ /dev/null @@ -1,159 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import os -from datetime import datetime -from azure.cli.testsdk.scenario_tests import SingleValueReplacer -from azure.cli.testsdk.preparers import NoTrafficRecordingPreparer -from azure.cli.testsdk.exceptions import CliTestError -from azure.cli.testsdk.reverse_dependency import get_dummy_cli - - -KEY_RESOURCE_GROUP = 'rg' -KEY_VIRTUAL_NETWORK = 'vnet' -KEY_VNET_SUBNET = 'subnet' -KEY_VNET_NIC = 'nic' - - -class VirtualNetworkPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): - def __init__(self, name_prefix='clitest.vn', - parameter_name='virtual_network', - resource_group_name=None, - resource_group_key=KEY_RESOURCE_GROUP, - dev_setting_name='AZURE_CLI_TEST_DEV_VIRTUAL_NETWORK_NAME', - random_name_length=24, key=KEY_VIRTUAL_NETWORK): - if ' ' in name_prefix: - raise CliTestError( - 'Error: Space character in name prefix \'%s\'' % name_prefix) - super(VirtualNetworkPreparer, self).__init__( - name_prefix, random_name_length) - self.cli_ctx = get_dummy_cli() - self.parameter_name = parameter_name - self.key = key - self.resource_group_name = resource_group_name - self.resource_group_key = resource_group_key - self.dev_setting_name = os.environ.get(dev_setting_name, None) - - def create_resource(self, name, **_): - if self.dev_setting_name: - return {self.parameter_name: self.dev_setting_name, } - - if not self.resource_group_name: - self.resource_group_name = self.test_class_instance.kwargs.get( - self.resource_group_key) - if not self.resource_group_name: - raise CliTestError("Error: No resource group configured!") - - tags = {'product': 'azurecli', 'cause': 'automation', - 'date': datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')} - if 'ENV_JOB_NAME' in os.environ: - tags['job'] = os.environ['ENV_JOB_NAME'] - tags = ' '.join(['{}={}'.format(key, value) - for key, value in tags.items()]) - template = 'az network vnet create --resource-group {} --name {} --subnet-name default --tag ' + tags - self.live_only_execute(self.cli_ctx, template.format( - self.resource_group_name, name)) - - self.test_class_instance.kwargs[self.key] = name - return {self.parameter_name: name} - - def remove_resource(self, name, **_): - # delete vnet if test is being recorded and if the vnet is not a dev rg - if not self.dev_setting_name: - self.live_only_execute( - self.cli_ctx, - 'az network vnet delete --name {} --resource-group {}'.format(name, self.resource_group_name)) - - -class VnetSubnetPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): - def __init__(self, name_prefix='clitest.vn', - parameter_name='subnet', - resource_group_key=KEY_RESOURCE_GROUP, - vnet_key=KEY_VIRTUAL_NETWORK, - address_prefixes="11.0.0.0/24", - dev_setting_name='AZURE_CLI_TEST_DEV_VNET_SUBNET_NAME', - key=KEY_VNET_SUBNET): - if ' ' in name_prefix: - raise CliTestError( - 'Error: Space character in name prefix \'%s\'' % name_prefix) - super(VnetSubnetPreparer, self).__init__(name_prefix, 15) - self.cli_ctx = get_dummy_cli() - self.parameter_name = parameter_name - self.key = key - self.resource_group = [resource_group_key, None] - self.vnet = [vnet_key, None] - self.address_prefixes = address_prefixes - self.dev_setting_name = os.environ.get(dev_setting_name, None) - - def create_resource(self, name, **_): - if self.dev_setting_name: - return {self.parameter_name: self.dev_setting_name, } - - if not self.resource_group[1]: - self.resource_group[1] = self.test_class_instance.kwargs.get( - self.resource_group[0]) - if not self.resource_group[1]: - raise CliTestError("Error: No resource group configured!") - if not self.vnet[1]: - self.vnet[1] = self.test_class_instance.kwargs.get(self.vnet[0]) - if not self.vnet[1]: - raise CliTestError("Error: No vnet configured!") - - self.test_class_instance.kwargs[self.key] = 'default' - return {self.parameter_name: name} - - def remove_resource(self, name, **_): - pass - - -class VnetNicPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): - def __init__(self, name_prefix='clitest.nic', - parameter_name='subnet', - resource_group_key=KEY_RESOURCE_GROUP, - vnet_key=KEY_VIRTUAL_NETWORK, - dev_setting_name='AZURE_CLI_TEST_DEV_VNET_NIC_NAME', - key=KEY_VNET_NIC): - if ' ' in name_prefix: - raise CliTestError( - 'Error: Space character in name prefix \'%s\'' % name_prefix) - super(VnetNicPreparer, self).__init__(name_prefix, 15) - self.cli_ctx = get_dummy_cli() - self.parameter_name = parameter_name - self.key = key - self.resource_group = [resource_group_key, None] - self.vnet = [vnet_key, None] - self.dev_setting_name = os.environ.get(dev_setting_name, None) - - def create_resource(self, name, **_): - if self.dev_setting_name: - return {self.parameter_name: self.dev_setting_name, } - - if not self.resource_group[1]: - self.resource_group[1] = self.test_class_instance.kwargs.get( - self.resource_group[0]) - if not self.resource_group[1]: - raise CliTestError("Error: No resource group configured!") - if not self.vnet[1]: - self.vnet[1] = self.test_class_instance.kwargs.get(self.vnet[0]) - if not self.vnet[1]: - raise CliTestError("Error: No vnet configured!") - - template = 'az network nic create --resource-group {} --name {} --vnet-name {} --subnet default ' - self.live_only_execute(self.cli_ctx, template.format( - self.resource_group[1], name, self.vnet[1])) - - self.test_class_instance.kwargs[self.key] = name - return {self.parameter_name: name} - - def remove_resource(self, name, **_): - if not self.dev_setting_name: - self.live_only_execute( - self.cli_ctx, - 'az network nic delete --name {} --resource-group {}'.format(name, self.resource_group[1])) diff --git a/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_Scenario.yaml b/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_Scenario.yaml deleted file mode 100644 index b8aa382f14e..00000000000 --- a/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_Scenario.yaml +++ /dev/null @@ -1,159 +0,0 @@ -interactions: -- request: - body: '{"location": "eastus2euap"}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - dnc controller create - Connection: - - keep-alive - Content-Length: - - '27' - Content-Type: - - application/json - ParameterSetName: - - --location --resource-group --resource-name - User-Agent: - - AZURECLI/2.23.0 azsdk-python-mgmt-dnc/1.0.0b1 Python/3.9.5 (Windows-10-10.0.19043-SP0) - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.DelegatedNetwork/controller/testcontroller?api-version=2021-03-15 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.DelegatedNetwork/controller/testcontroller","location":"eastus2euap","name":"testcontroller","type":"Microsoft.DelegatedNetwork/controller","properties":{"controllerProperties":{"dncAppId":"a91b1853-4403-4f54-b5cb-d1ea19d90c37","dncEndpoint":"https://openai-eastus2euap.dnc.azure.com","dncTenantId":null},"resourceGuid":"5c7e26be-7ff9-4aaf-9e16-0bc759605aea","provisioningState":"Succeeded"}}' - headers: - cache-control: - - no-cache - content-length: - - '562' - content-type: - - application/json - date: - - Wed, 09 Jun 2021 00:08:16 GMT - expires: - - '-1' - pragma: - - no-cache - request-context: - - appId=cid-v1:82487bea-6925-46b8-a5c9-0bcae97f8f27 - server: - - Kestrel - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1199' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - dnc controller show - Connection: - - keep-alive - ParameterSetName: - - --resource-group --resource-name - User-Agent: - - AZURECLI/2.23.0 azsdk-python-mgmt-dnc/1.0.0b1 Python/3.9.5 (Windows-10-10.0.19043-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.DelegatedNetwork/controller/testcontroller?api-version=2021-03-15 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.DelegatedNetwork/controller/testcontroller","location":"eastus2euap","name":"testcontroller","type":"Microsoft.DelegatedNetwork/controller","properties":{"controllerProperties":{"dncAppId":"a91b1853-4403-4f54-b5cb-d1ea19d90c37","dncEndpoint":"https://openai-eastus2euap.dnc.azure.com","dncTenantId":null},"resourceGuid":"5c7e26be-7ff9-4aaf-9e16-0bc759605aea","provisioningState":"Succeeded"}}' - headers: - cache-control: - - no-cache - content-length: - - '562' - content-type: - - application/json - date: - - Wed, 09 Jun 2021 00:08:18 GMT - expires: - - '-1' - pragma: - - no-cache - request-context: - - appId=cid-v1:82487bea-6925-46b8-a5c9-0bcae97f8f27 - server: - - Kestrel - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: '{"location": "eastus2euap", "properties": {"subnetDetails": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Network/virtualNetworks/clitest000003/subnets/default"}, - "controllerDetails": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.DelegatedNetwork/controller/testcontroller"}}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - dnc delegated-subnet-service create - Connection: - - keep-alive - Content-Length: - - '537' - Content-Type: - - application/json - ParameterSetName: - - --location --id --subnet-details-id --resource-group --resource-name - User-Agent: - - AZURECLI/2.23.0 azsdk-python-mgmt-dnc/1.0.0b1 Python/3.9.5 (Windows-10-10.0.19043-SP0) - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.DelegatedNetwork/delegatedSubnets/delegated1?api-version=2021-03-15 - response: - body: - string: '{"ErrorResponse":{"error":{"code":"400","message":"Error in API: PutDelegateSubnetResourceId: - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Network/virtualNetworks/clitest000003 - is created in a different location: westus, Expected Location: eastus2euapInternalErrorCode: - InvalidVirtualNetworkLocation. ResourceId: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Network/virtualNetworks/clitest000003 - is created in a different location: westus, Expected Location: eastus2euap","details":null}}}' - headers: - cache-control: - - no-cache - content-length: - - '747' - content-type: - - application/json - date: - - Wed, 09 Jun 2021 00:08:22 GMT - expires: - - '-1' - pragma: - - no-cache - request-context: - - appId=cid-v1:82487bea-6925-46b8-a5c9-0bcae97f8f27 - server: - - Kestrel - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1199' - status: - code: 400 - message: Bad Request -version: 1 diff --git a/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_controller_create.yaml b/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_controller_create.yaml new file mode 100644 index 00000000000..f76bb1048ae --- /dev/null +++ b/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_controller_create.yaml @@ -0,0 +1,56 @@ +interactions: +- request: + body: '{"location": "centraluseuap", "properties": {"purpose": "prod"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - dnc controller create + Connection: + - keep-alive + Content-Length: + - '64' + Content-Type: + - application/json + ParameterSetName: + - --location --resource-name --resource-group + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/controller/clitestcontroller?api-version=2023-05-18-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/controller/clitestcontroller","location":"centraluseuap","name":"clitestcontroller","type":"Microsoft.DelegatedNetwork/controller","properties":{"dncAppId":"a91b1853-4403-4f54-b5cb-d1ea19d90c37","dncEndpoint":"https://openai-centraluseuap.dnc.azure.com","controllerProperties":{"dncAppId":"a91b1853-4403-4f54-b5cb-d1ea19d90c37","dncEndpoint":"https://openai-centraluseuap.dnc.azure.com","dncTenantId":null},"resourceGuid":"5c7e26be-7ff9-4aaf-9e16-0bc759605aea","provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '624' + content-type: + - application/json + date: + - Fri, 28 Jul 2023 20:49:02 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:82487bea-6925-46b8-a5c9-0bcae97f8f27 + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK +version: 1 diff --git a/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_controller_create_test_purpose.yaml b/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_controller_create_test_purpose.yaml new file mode 100644 index 00000000000..370b2d9d154 --- /dev/null +++ b/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_controller_create_test_purpose.yaml @@ -0,0 +1,56 @@ +interactions: +- request: + body: '{"location": "centraluseuap", "properties": {"purpose": "test"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - dnc controller create + Connection: + - keep-alive + Content-Length: + - '64' + Content-Type: + - application/json + ParameterSetName: + - --location --resource-name --resource-group --purpose + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/controller/clitestcontroller?api-version=2023-05-18-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/controller/clitestcontroller","location":"centraluseuap","name":"clitestcontroller","type":"Microsoft.DelegatedNetwork/controller","properties":{"dncAppId":"a91b1853-4403-4f54-b5cb-d1ea19d90c37","dncEndpoint":"https://openai-centraluseuap.dnc.azure.com","controllerProperties":{"dncAppId":"a91b1853-4403-4f54-b5cb-d1ea19d90c37","dncEndpoint":"https://openai-centraluseuap.dnc.azure.com","dncTenantId":null},"resourceGuid":"33b2d4dd-1290-4810-8e16-8283177b4538","provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '624' + content-type: + - application/json + date: + - Fri, 28 Jul 2023 20:49:02 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:82487bea-6925-46b8-a5c9-0bcae97f8f27 + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +version: 1 diff --git a/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_controller_delete.yaml b/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_controller_delete.yaml new file mode 100644 index 00000000000..6be042c0df8 --- /dev/null +++ b/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_controller_delete.yaml @@ -0,0 +1,42 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - dnc controller delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --resource-name --resource-group --yes + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/controller/clitestcontroller?api-version=2023-05-18-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + date: + - Fri, 28 Jul 2023 20:49:01 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 204 + message: No Content +version: 1 diff --git a/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_controller_show.yaml b/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_controller_show.yaml new file mode 100644 index 00000000000..3a17d749aad --- /dev/null +++ b/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_controller_show.yaml @@ -0,0 +1,104 @@ +interactions: +- request: + body: '{"location": "centraluseuap", "properties": {"purpose": "prod"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - dnc controller create + Connection: + - keep-alive + Content-Length: + - '64' + Content-Type: + - application/json + ParameterSetName: + - --location --resource-name --resource-group + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/controller/clitestcontroller?api-version=2023-05-18-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/controller/clitestcontroller","location":"centraluseuap","name":"clitestcontroller","type":"Microsoft.DelegatedNetwork/controller","properties":{"dncAppId":"a91b1853-4403-4f54-b5cb-d1ea19d90c37","dncEndpoint":"https://openai-centraluseuap.dnc.azure.com","controllerProperties":{"dncAppId":"a91b1853-4403-4f54-b5cb-d1ea19d90c37","dncEndpoint":"https://openai-centraluseuap.dnc.azure.com","dncTenantId":null},"resourceGuid":"5c7e26be-7ff9-4aaf-9e16-0bc759605aea","provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '624' + content-type: + - application/json + date: + - Fri, 28 Jul 2023 20:49:02 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:82487bea-6925-46b8-a5c9-0bcae97f8f27 + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - dnc controller show + Connection: + - keep-alive + ParameterSetName: + - --resource-name --resource-group + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/controller/clitestcontroller?api-version=2023-05-18-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/controller/clitestcontroller","location":"centraluseuap","name":"clitestcontroller","type":"Microsoft.DelegatedNetwork/controller","properties":{"dncAppId":"a91b1853-4403-4f54-b5cb-d1ea19d90c37","dncEndpoint":"https://openai-centraluseuap.dnc.azure.com","controllerProperties":{"dncAppId":"a91b1853-4403-4f54-b5cb-d1ea19d90c37","dncEndpoint":"https://openai-centraluseuap.dnc.azure.com","dncTenantId":null},"resourceGuid":"5c7e26be-7ff9-4aaf-9e16-0bc759605aea","provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '624' + content-type: + - application/json + date: + - Fri, 28 Jul 2023 20:49:03 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:82487bea-6925-46b8-a5c9-0bcae97f8f27 + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +version: 1 diff --git a/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_delegated_subnet_service_create.yaml b/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_delegated_subnet_service_create.yaml new file mode 100644 index 00000000000..0052deaa08d --- /dev/null +++ b/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_delegated_subnet_service_create.yaml @@ -0,0 +1,524 @@ +interactions: +- request: + body: '{"location": "centraluseuap", "properties": {"purpose": "prod"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - dnc controller create + Connection: + - keep-alive + Content-Length: + - '64' + Content-Type: + - application/json + ParameterSetName: + - --location --resource-name --resource-group + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/controller/clitestcontroller?api-version=2023-05-18-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/controller/clitestcontroller","location":"centraluseuap","name":"clitestcontroller","type":"Microsoft.DelegatedNetwork/controller","properties":{"dncAppId":"a91b1853-4403-4f54-b5cb-d1ea19d90c37","dncEndpoint":"https://openai-centraluseuap.dnc.azure.com","controllerProperties":{"dncAppId":"a91b1853-4403-4f54-b5cb-d1ea19d90c37","dncEndpoint":"https://openai-centraluseuap.dnc.azure.com","dncTenantId":null},"resourceGuid":"5c7e26be-7ff9-4aaf-9e16-0bc759605aea","provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '624' + content-type: + - application/json + date: + - Fri, 28 Jul 2023 20:49:14 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:82487bea-6925-46b8-a5c9-0bcae97f8f27 + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: '{"location": "centraluseuap", "properties": {"controllerDetails": {"id": + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/controller/clitestcontroller"}, + "subnetDetails": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.Network/virtualNetworks/cli_test_dnc000002/subnets/default"}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - dnc delegated-subnet-service create + Connection: + - keep-alive + Content-Length: + - '422' + Content-Type: + - application/json + ParameterSetName: + - --location --id --subnet-details-id --resource-group --resource-name + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/delegatedSubnets/delegated1?api-version=2023-05-18-preview + response: + body: + string: '{"ErrorResponse":{"error":{"code":"500","message":"Error in API: PutDelegateSubnetSAL + creation failed:Microsoft.Azure.ContainerNetworking.DncRP.ErrorResponseMessageException: + Failed to create SAL token, salRequest: ServiceAssociationLink: Id: , Name: Properties: + ServiceAssociationLinkProperties: ProvisioningState: LinkedResourceType: + Microsoft.DelegatedNetwork/controller ParentResourceGuid: 7290cf68-2875-486a-a2c4-153fa6d445e6 + Locations: centraluseuap Details: ServiceAssociationLinkDetail: Id: , Name: + ManagedDNCDetail, Properties: ServiceAssociationLinkDetailProperties: ProvisioningState: + , PrimaryContextRequestId: a1650b48-deae-4795-9377-b66553b1d94b, SecondaryContextRequestId: + 6cf1d661-6e94-4afa-878d-cd2f53f54098,PrimaryContextId: SecondaryContextId: + , subnetResourceId:/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.Network/virtualNetworks/cli_test_dnc000002/subnets/default + internal ex: System.Exception: ResponseMessage: System.Net.Http.HttpConnectionResponseContent, + status code BadRequest, Reason: Bad Request, internal exception: System.Net.Http.HttpRequestException: + Response status code does not indicate success: 400 (Bad Request).\n at + System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.SendRequestAndGetJsonAsync[T](HttpRequestMessage + requestMessage, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 66\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.CallServerAndGetAsync[TRequest,TResponse](String + tenantId, HttpMethod httpMethod, Uri requestUri, TRequest requestBody) in + /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 239\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.PutResourceAsync[T](String + tenantId, String resourceId, String apiVersion, T requestBody) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 134\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreateServiceAssociationLinkAsync(String + tenantId, String vnetResourceId, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 188.\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreateServiceAssociationLinkAsync(String + tenantId, String vnetResourceId, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 208\n at Microsoft.Azure.ContainerNetworking.DncRP.DelegateSubnetController.CreateSubnetTokenAsync(String + tenantId, String vnetName, String subnetName, String delegatedSubnetGuid, + String vnetResourceGuid, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/Controllers/DelegateSubnetController.cs:line + 392InternalErrorCode: ServiceAssociationLinkFailed. SAL creation failed:Microsoft.Azure.ContainerNetworking.DncRP.ErrorResponseMessageException: + Failed to create SAL token, salRequest: ServiceAssociationLink: Id: , Name: Properties: + ServiceAssociationLinkProperties: ProvisioningState: LinkedResourceType: + Microsoft.DelegatedNetwork/controller ParentResourceGuid: 7290cf68-2875-486a-a2c4-153fa6d445e6 + Locations: centraluseuap Details: ServiceAssociationLinkDetail: Id: , Name: + ManagedDNCDetail, Properties: ServiceAssociationLinkDetailProperties: ProvisioningState: + , PrimaryContextRequestId: a1650b48-deae-4795-9377-b66553b1d94b, SecondaryContextRequestId: + 6cf1d661-6e94-4afa-878d-cd2f53f54098,PrimaryContextId: SecondaryContextId: + , subnetResourceId:/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.Network/virtualNetworks/cli_test_dnc000002/subnets/default + internal ex: System.Exception: ResponseMessage: System.Net.Http.HttpConnectionResponseContent, + status code BadRequest, Reason: Bad Request, internal exception: System.Net.Http.HttpRequestException: + Response status code does not indicate success: 400 (Bad Request).\n at + System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.SendRequestAndGetJsonAsync[T](HttpRequestMessage + requestMessage, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 66\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.CallServerAndGetAsync[TRequest,TResponse](String + tenantId, HttpMethod httpMethod, Uri requestUri, TRequest requestBody) in + /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 239\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.PutResourceAsync[T](String + tenantId, String resourceId, String apiVersion, T requestBody) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 134\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreateServiceAssociationLinkAsync(String + tenantId, String vnetResourceId, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 188.\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreateServiceAssociationLinkAsync(String + tenantId, String vnetResourceId, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 208\n at Microsoft.Azure.ContainerNetworking.DncRP.DelegateSubnetController.CreateSubnetTokenAsync(String + tenantId, String vnetName, String subnetName, String delegatedSubnetGuid, + String vnetResourceGuid, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/Controllers/DelegateSubnetController.cs:line + 392","details":null}}}' + headers: + cache-control: + - no-cache + connection: + - close + content-length: + - '6774' + content-type: + - application/json + date: + - Fri, 28 Jul 2023 20:49:17 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:82487bea-6925-46b8-a5c9-0bcae97f8f27 + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-failure-cause: + - service + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 500 + message: Internal Server Error +- request: + body: '{"location": "centraluseuap", "properties": {"controllerDetails": {"id": + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/controller/clitestcontroller"}, + "subnetDetails": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.Network/virtualNetworks/cli_test_dnc000002/subnets/default"}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - dnc delegated-subnet-service create + Connection: + - keep-alive + Content-Length: + - '422' + Content-Type: + - application/json + ParameterSetName: + - --location --id --subnet-details-id --resource-group --resource-name + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/delegatedSubnets/delegated1?api-version=2023-05-18-preview + response: + body: + string: '{"ErrorResponse":{"error":{"code":"500","message":"Error in API: PutDelegateSubnetSAL + creation failed:Microsoft.Azure.ContainerNetworking.DncRP.ErrorResponseMessageException: + Failed to create SAL token, salRequest: ServiceAssociationLink: Id: , Name: Properties: + ServiceAssociationLinkProperties: ProvisioningState: LinkedResourceType: + Microsoft.DelegatedNetwork/controller ParentResourceGuid: 7290cf68-2875-486a-a2c4-153fa6d445e6 + Locations: centraluseuap Details: ServiceAssociationLinkDetail: Id: , Name: + ManagedDNCDetail, Properties: ServiceAssociationLinkDetailProperties: ProvisioningState: + , PrimaryContextRequestId: fd748dad-b21c-4a4b-bc01-940f0b3c93c5, SecondaryContextRequestId: + fc549b33-e48b-4536-b3c5-334f6ecfb9e6,PrimaryContextId: SecondaryContextId: + , subnetResourceId:/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.Network/virtualNetworks/cli_test_dnc000002/subnets/default + internal ex: System.Exception: ResponseMessage: System.Net.Http.HttpConnectionResponseContent, + status code BadRequest, Reason: Bad Request, internal exception: System.Net.Http.HttpRequestException: + Response status code does not indicate success: 400 (Bad Request).\n at + System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.SendRequestAndGetJsonAsync[T](HttpRequestMessage + requestMessage, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 66\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.CallServerAndGetAsync[TRequest,TResponse](String + tenantId, HttpMethod httpMethod, Uri requestUri, TRequest requestBody) in + /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 239\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.PutResourceAsync[T](String + tenantId, String resourceId, String apiVersion, T requestBody) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 134\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreateServiceAssociationLinkAsync(String + tenantId, String vnetResourceId, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 188.\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreateServiceAssociationLinkAsync(String + tenantId, String vnetResourceId, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 208\n at Microsoft.Azure.ContainerNetworking.DncRP.DelegateSubnetController.CreateSubnetTokenAsync(String + tenantId, String vnetName, String subnetName, String delegatedSubnetGuid, + String vnetResourceGuid, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/Controllers/DelegateSubnetController.cs:line + 392InternalErrorCode: ServiceAssociationLinkFailed. SAL creation failed:Microsoft.Azure.ContainerNetworking.DncRP.ErrorResponseMessageException: + Failed to create SAL token, salRequest: ServiceAssociationLink: Id: , Name: Properties: + ServiceAssociationLinkProperties: ProvisioningState: LinkedResourceType: + Microsoft.DelegatedNetwork/controller ParentResourceGuid: 7290cf68-2875-486a-a2c4-153fa6d445e6 + Locations: centraluseuap Details: ServiceAssociationLinkDetail: Id: , Name: + ManagedDNCDetail, Properties: ServiceAssociationLinkDetailProperties: ProvisioningState: + , PrimaryContextRequestId: fd748dad-b21c-4a4b-bc01-940f0b3c93c5, SecondaryContextRequestId: + fc549b33-e48b-4536-b3c5-334f6ecfb9e6,PrimaryContextId: SecondaryContextId: + , subnetResourceId:/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.Network/virtualNetworks/cli_test_dnc000002/subnets/default + internal ex: System.Exception: ResponseMessage: System.Net.Http.HttpConnectionResponseContent, + status code BadRequest, Reason: Bad Request, internal exception: System.Net.Http.HttpRequestException: + Response status code does not indicate success: 400 (Bad Request).\n at + System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.SendRequestAndGetJsonAsync[T](HttpRequestMessage + requestMessage, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 66\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.CallServerAndGetAsync[TRequest,TResponse](String + tenantId, HttpMethod httpMethod, Uri requestUri, TRequest requestBody) in + /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 239\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.PutResourceAsync[T](String + tenantId, String resourceId, String apiVersion, T requestBody) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 134\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreateServiceAssociationLinkAsync(String + tenantId, String vnetResourceId, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 188.\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreateServiceAssociationLinkAsync(String + tenantId, String vnetResourceId, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 208\n at Microsoft.Azure.ContainerNetworking.DncRP.DelegateSubnetController.CreateSubnetTokenAsync(String + tenantId, String vnetName, String subnetName, String delegatedSubnetGuid, + String vnetResourceGuid, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/Controllers/DelegateSubnetController.cs:line + 392","details":null}}}' + headers: + cache-control: + - no-cache + connection: + - close + content-length: + - '6774' + content-type: + - application/json + date: + - Fri, 28 Jul 2023 20:49:17 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:82487bea-6925-46b8-a5c9-0bcae97f8f27 + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-failure-cause: + - service + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 500 + message: Internal Server Error +- request: + body: '{"location": "centraluseuap", "properties": {"controllerDetails": {"id": + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/controller/clitestcontroller"}, + "subnetDetails": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.Network/virtualNetworks/cli_test_dnc000002/subnets/default"}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - dnc delegated-subnet-service create + Connection: + - keep-alive + Content-Length: + - '422' + Content-Type: + - application/json + ParameterSetName: + - --location --id --subnet-details-id --resource-group --resource-name + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/delegatedSubnets/delegated1?api-version=2023-05-18-preview + response: + body: + string: '{"ErrorResponse":{"error":{"code":"500","message":"Error in API: PutDelegateSubnetSAL + creation failed:Microsoft.Azure.ContainerNetworking.DncRP.ErrorResponseMessageException: + Failed to create SAL token, salRequest: ServiceAssociationLink: Id: , Name: Properties: + ServiceAssociationLinkProperties: ProvisioningState: LinkedResourceType: + Microsoft.DelegatedNetwork/controller ParentResourceGuid: 7290cf68-2875-486a-a2c4-153fa6d445e6 + Locations: centraluseuap Details: ServiceAssociationLinkDetail: Id: , Name: + ManagedDNCDetail, Properties: ServiceAssociationLinkDetailProperties: ProvisioningState: + , PrimaryContextRequestId: b758037b-84c7-444d-bba1-f384e0f3b805, SecondaryContextRequestId: + 84efa3d0-14ed-4cd1-bf2e-faf561e44671,PrimaryContextId: SecondaryContextId: + , subnetResourceId:/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.Network/virtualNetworks/cli_test_dnc000002/subnets/default + internal ex: System.Exception: ResponseMessage: System.Net.Http.HttpConnectionResponseContent, + status code BadRequest, Reason: Bad Request, internal exception: System.Net.Http.HttpRequestException: + Response status code does not indicate success: 400 (Bad Request).\n at + System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.SendRequestAndGetJsonAsync[T](HttpRequestMessage + requestMessage, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 66\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.CallServerAndGetAsync[TRequest,TResponse](String + tenantId, HttpMethod httpMethod, Uri requestUri, TRequest requestBody) in + /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 239\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.PutResourceAsync[T](String + tenantId, String resourceId, String apiVersion, T requestBody) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 134\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreateServiceAssociationLinkAsync(String + tenantId, String vnetResourceId, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 188.\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreateServiceAssociationLinkAsync(String + tenantId, String vnetResourceId, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 208\n at Microsoft.Azure.ContainerNetworking.DncRP.DelegateSubnetController.CreateSubnetTokenAsync(String + tenantId, String vnetName, String subnetName, String delegatedSubnetGuid, + String vnetResourceGuid, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/Controllers/DelegateSubnetController.cs:line + 410InternalErrorCode: ServiceAssociationLinkFailed. SAL creation failed:Microsoft.Azure.ContainerNetworking.DncRP.ErrorResponseMessageException: + Failed to create SAL token, salRequest: ServiceAssociationLink: Id: , Name: Properties: + ServiceAssociationLinkProperties: ProvisioningState: LinkedResourceType: + Microsoft.DelegatedNetwork/controller ParentResourceGuid: 7290cf68-2875-486a-a2c4-153fa6d445e6 + Locations: centraluseuap Details: ServiceAssociationLinkDetail: Id: , Name: + ManagedDNCDetail, Properties: ServiceAssociationLinkDetailProperties: ProvisioningState: + , PrimaryContextRequestId: b758037b-84c7-444d-bba1-f384e0f3b805, SecondaryContextRequestId: + 84efa3d0-14ed-4cd1-bf2e-faf561e44671,PrimaryContextId: SecondaryContextId: + , subnetResourceId:/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.Network/virtualNetworks/cli_test_dnc000002/subnets/default + internal ex: System.Exception: ResponseMessage: System.Net.Http.HttpConnectionResponseContent, + status code BadRequest, Reason: Bad Request, internal exception: System.Net.Http.HttpRequestException: + Response status code does not indicate success: 400 (Bad Request).\n at + System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.SendRequestAndGetJsonAsync[T](HttpRequestMessage + requestMessage, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 66\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.CallServerAndGetAsync[TRequest,TResponse](String + tenantId, HttpMethod httpMethod, Uri requestUri, TRequest requestBody) in + /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 239\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.PutResourceAsync[T](String + tenantId, String resourceId, String apiVersion, T requestBody) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 134\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreateServiceAssociationLinkAsync(String + tenantId, String vnetResourceId, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 188.\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreateServiceAssociationLinkAsync(String + tenantId, String vnetResourceId, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 208\n at Microsoft.Azure.ContainerNetworking.DncRP.DelegateSubnetController.CreateSubnetTokenAsync(String + tenantId, String vnetName, String subnetName, String delegatedSubnetGuid, + String vnetResourceGuid, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/Controllers/DelegateSubnetController.cs:line + 410","details":null}}}' + headers: + cache-control: + - no-cache + connection: + - close + content-length: + - '6774' + content-type: + - application/json + date: + - Fri, 28 Jul 2023 20:49:21 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:82487bea-6925-46b8-a5c9-0bcae97f8f27 + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-failure-cause: + - service + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 500 + message: Internal Server Error +- request: + body: '{"location": "centraluseuap", "properties": {"controllerDetails": {"id": + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/controller/clitestcontroller"}, + "subnetDetails": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.Network/virtualNetworks/cli_test_dnc000002/subnets/default"}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - dnc delegated-subnet-service create + Connection: + - keep-alive + Content-Length: + - '422' + Content-Type: + - application/json + ParameterSetName: + - --location --id --subnet-details-id --resource-group --resource-name + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/delegatedSubnets/delegated1?api-version=2023-05-18-preview + response: + body: + string: '{"ErrorResponse":{"error":{"code":"500","message":"Error in API: PutDelegateSubnetSAL + creation failed:Microsoft.Azure.ContainerNetworking.DncRP.ErrorResponseMessageException: + Failed to create SAL token, salRequest: ServiceAssociationLink: Id: , Name: Properties: + ServiceAssociationLinkProperties: ProvisioningState: LinkedResourceType: + Microsoft.DelegatedNetwork/controller ParentResourceGuid: 7290cf68-2875-486a-a2c4-153fa6d445e6 + Locations: centraluseuap Details: ServiceAssociationLinkDetail: Id: , Name: + ManagedDNCDetail, Properties: ServiceAssociationLinkDetailProperties: ProvisioningState: + , PrimaryContextRequestId: 074e360e-20d4-42d3-b151-f614ca62957d, SecondaryContextRequestId: + 25eba8b0-1ecd-4646-9700-11522036dcfb,PrimaryContextId: SecondaryContextId: + , subnetResourceId:/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.Network/virtualNetworks/cli_test_dnc000002/subnets/default + internal ex: System.Exception: ResponseMessage: System.Net.Http.HttpConnectionResponseContent, + status code BadRequest, Reason: Bad Request, internal exception: System.Net.Http.HttpRequestException: + Response status code does not indicate success: 400 (Bad Request).\n at + System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.SendRequestAndGetJsonAsync[T](HttpRequestMessage + requestMessage, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 66\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.CallServerAndGetAsync[TRequest,TResponse](String + tenantId, HttpMethod httpMethod, Uri requestUri, TRequest requestBody) in + /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 239\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.PutResourceAsync[T](String + tenantId, String resourceId, String apiVersion, T requestBody) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 134\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreateServiceAssociationLinkAsync(String + tenantId, String vnetResourceId, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 214.\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreateServiceAssociationLinkAsync(String + tenantId, String vnetResourceId, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 214\n at Microsoft.Azure.ContainerNetworking.DncRP.DelegateSubnetController.CreateSubnetTokenAsync(String + tenantId, String vnetName, String subnetName, String delegatedSubnetGuid, + String vnetResourceGuid, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/Controllers/DelegateSubnetController.cs:line + 410InternalErrorCode: ServiceAssociationLinkFailed. SAL creation failed:Microsoft.Azure.ContainerNetworking.DncRP.ErrorResponseMessageException: + Failed to create SAL token, salRequest: ServiceAssociationLink: Id: , Name: Properties: + ServiceAssociationLinkProperties: ProvisioningState: LinkedResourceType: + Microsoft.DelegatedNetwork/controller ParentResourceGuid: 7290cf68-2875-486a-a2c4-153fa6d445e6 + Locations: centraluseuap Details: ServiceAssociationLinkDetail: Id: , Name: + ManagedDNCDetail, Properties: ServiceAssociationLinkDetailProperties: ProvisioningState: + , PrimaryContextRequestId: 074e360e-20d4-42d3-b151-f614ca62957d, SecondaryContextRequestId: + 25eba8b0-1ecd-4646-9700-11522036dcfb,PrimaryContextId: SecondaryContextId: + , subnetResourceId:/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.Network/virtualNetworks/cli_test_dnc000002/subnets/default + internal ex: System.Exception: ResponseMessage: System.Net.Http.HttpConnectionResponseContent, + status code BadRequest, Reason: Bad Request, internal exception: System.Net.Http.HttpRequestException: + Response status code does not indicate success: 400 (Bad Request).\n at + System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.SendRequestAndGetJsonAsync[T](HttpRequestMessage + requestMessage, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 66\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.CallServerAndGetAsync[TRequest,TResponse](String + tenantId, HttpMethod httpMethod, Uri requestUri, TRequest requestBody) in + /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 239\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.PutResourceAsync[T](String + tenantId, String resourceId, String apiVersion, T requestBody) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 134\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreateServiceAssociationLinkAsync(String + tenantId, String vnetResourceId, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 214.\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreateServiceAssociationLinkAsync(String + tenantId, String vnetResourceId, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 214\n at Microsoft.Azure.ContainerNetworking.DncRP.DelegateSubnetController.CreateSubnetTokenAsync(String + tenantId, String vnetName, String subnetName, String delegatedSubnetGuid, + String vnetResourceGuid, String subnetResourceId) in /usr/local/Networking-Aquarius/src/DncRP/Server/Controllers/DelegateSubnetController.cs:line + 410","details":null}}}' + headers: + cache-control: + - no-cache + connection: + - close + content-length: + - '6774' + content-type: + - application/json + date: + - Fri, 28 Jul 2023 20:49:25 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:82487bea-6925-46b8-a5c9-0bcae97f8f27 + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-failure-cause: + - service + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 500 + message: Internal Server Error +version: 1 diff --git a/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_delegated_subnet_service_delete.yaml b/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_delegated_subnet_service_delete.yaml new file mode 100644 index 00000000000..fc310d7f61c --- /dev/null +++ b/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_delegated_subnet_service_delete.yaml @@ -0,0 +1,42 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - dnc delegated-subnet-service delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --resource-name --resource-group --yes + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/delegatedSubnets/delegated1?api-version=2023-05-18-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + date: + - Fri, 28 Jul 2023 20:49:01 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 204 + message: No Content +version: 1 diff --git a/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_delegated_subnet_service_show.yaml b/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_delegated_subnet_service_show.yaml new file mode 100644 index 00000000000..405f291684a --- /dev/null +++ b/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_delegated_subnet_service_show.yaml @@ -0,0 +1,46 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - dnc delegated-subnet-service show + Connection: + - keep-alive + ParameterSetName: + - --resource-name --resource-group + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/delegatedSubnets/delegated1?api-version=2023-05-18-preview + response: + body: + string: '{"error":{"code":"ResourceNotFound","message":"The Resource ''Microsoft.DelegatedNetwork/delegatedSubnets/delegated1'' + under resource group ''cli_test_dnc000001'' was not found. For more details + please go to https://aka.ms/ARMResourceNotFoundFix"}}' + headers: + cache-control: + - no-cache + content-length: + - '244' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 28 Jul 2023 20:49:01 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-failure-cause: + - gateway + status: + code: 404 + message: Not Found +version: 1 diff --git a/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_orchestrator_instance_service_create.yaml b/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_orchestrator_instance_service_create.yaml new file mode 100644 index 00000000000..402d6b251d8 --- /dev/null +++ b/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_orchestrator_instance_service_create.yaml @@ -0,0 +1,444 @@ +interactions: +- request: + body: '{"location": "centraluseuap", "properties": {"purpose": "prod"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - dnc controller create + Connection: + - keep-alive + Content-Length: + - '64' + Content-Type: + - application/json + ParameterSetName: + - --location --resource-name --resource-group + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/controller/clitestcontroller?api-version=2023-05-18-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/controller/clitestcontroller","location":"centraluseuap","name":"clitestcontroller","type":"Microsoft.DelegatedNetwork/controller","properties":{"dncAppId":"a91b1853-4403-4f54-b5cb-d1ea19d90c37","dncEndpoint":"https://openai-centraluseuap.dnc.azure.com","controllerProperties":{"dncAppId":"a91b1853-4403-4f54-b5cb-d1ea19d90c37","dncEndpoint":"https://openai-centraluseuap.dnc.azure.com","dncTenantId":null},"resourceGuid":"5c7e26be-7ff9-4aaf-9e16-0bc759605aea","provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '624' + content-type: + - application/json + date: + - Fri, 28 Jul 2023 20:49:01 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:82487bea-6925-46b8-a5c9-0bcae97f8f27 + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: '{"identity": {"type": "SystemAssigned"}, "kind": "Kubernetes", "location": + "centraluseuap", "properties": {"apiServerEndpoint": "https://testk8s.cloudapp.net", + "clusterRootCA": "ddsadsad344mfdsfdl", "controllerDetails": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/controller/clitestcontroller"}, + "orchestratorAppId": "546192d7-503f-477a-9cfe-4efc3ee2b6e1", "orchestratorTenantId": + "72f988bf-86f1-41af-91ab-2d7cd011db47", "privateLinkResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.Network/privateLinkServices/plresource1"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - dnc orchestrator-instance-service create + Connection: + - keep-alive + Content-Length: + - '682' + Content-Type: + - application/json + ParameterSetName: + - --type --location --api-server-endpoint --cluster-root-ca --id --orchestrator-app-id + --orchestrator-tenant-id --priv-link-resource-id --resource-group --resource-name + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/orchestrators/testk8s1?api-version=2023-05-18-preview + response: + body: + string: '{"ErrorResponse":{"error":{"code":"500","message":"Error in API: PutOrchestratorPrivate + endpoint creation failed: System.Exception: ResponseMessage: System.Net.Http.HttpConnectionResponseContent, + status code BadRequest, Reason: Bad Request, internal exception: System.Net.Http.HttpRequestException: + Response status code does not indicate success: 400 (Bad Request).\n at + System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.SendRequestAndGetJsonAsync[T](HttpRequestMessage + requestMessage, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 66\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.CallServerAndGetAsync[TRequest,TResponse](String + tenantId, HttpMethod httpMethod, Uri requestUri, TRequest requestBody) in + /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 239\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.PutResourceAsync[T](String + tenantId, String resourceId, String apiVersion, T requestBody) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 134\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreatePrivateEndpoint(String + privateLinkResourceId, String privateEndpointName) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 333\n at Microsoft.Azure.ContainerNetworking.DncRP.OrchestratorController.ExecutePutOrchestratorAsync(String + subscriptionId, String resourceGroupName, String resourceName) in /usr/local/Networking-Aquarius/src/DncRP/Server/Controllers/OrchestratorController.cs:line + 154InternalErrorCode: PrivateEndpointCreateFailed. Private endpoint creation + failed: System.Exception: ResponseMessage: System.Net.Http.HttpConnectionResponseContent, + status code BadRequest, Reason: Bad Request, internal exception: System.Net.Http.HttpRequestException: + Response status code does not indicate success: 400 (Bad Request).\n at + System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.SendRequestAndGetJsonAsync[T](HttpRequestMessage + requestMessage, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 66\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.CallServerAndGetAsync[TRequest,TResponse](String + tenantId, HttpMethod httpMethod, Uri requestUri, TRequest requestBody) in + /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 239\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.PutResourceAsync[T](String + tenantId, String resourceId, String apiVersion, T requestBody) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 134\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreatePrivateEndpoint(String + privateLinkResourceId, String privateEndpointName) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 333\n at Microsoft.Azure.ContainerNetworking.DncRP.OrchestratorController.ExecutePutOrchestratorAsync(String + subscriptionId, String resourceGroupName, String resourceName) in /usr/local/Networking-Aquarius/src/DncRP/Server/Controllers/OrchestratorController.cs:line + 154","details":null}}}' + headers: + cache-control: + - no-cache + connection: + - close + content-length: + - '4395' + content-type: + - application/json + date: + - Fri, 28 Jul 2023 20:49:05 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:82487bea-6925-46b8-a5c9-0bcae97f8f27 + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-failure-cause: + - service + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 500 + message: Internal Server Error +- request: + body: '{"identity": {"type": "SystemAssigned"}, "kind": "Kubernetes", "location": + "centraluseuap", "properties": {"apiServerEndpoint": "https://testk8s.cloudapp.net", + "clusterRootCA": "ddsadsad344mfdsfdl", "controllerDetails": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/controller/clitestcontroller"}, + "orchestratorAppId": "546192d7-503f-477a-9cfe-4efc3ee2b6e1", "orchestratorTenantId": + "72f988bf-86f1-41af-91ab-2d7cd011db47", "privateLinkResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.Network/privateLinkServices/plresource1"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - dnc orchestrator-instance-service create + Connection: + - keep-alive + Content-Length: + - '682' + Content-Type: + - application/json + ParameterSetName: + - --type --location --api-server-endpoint --cluster-root-ca --id --orchestrator-app-id + --orchestrator-tenant-id --priv-link-resource-id --resource-group --resource-name + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/orchestrators/testk8s1?api-version=2023-05-18-preview + response: + body: + string: '{"ErrorResponse":{"error":{"code":"500","message":"Error in API: PutOrchestratorPrivate + endpoint creation failed: System.Exception: ResponseMessage: System.Net.Http.HttpConnectionResponseContent, + status code BadRequest, Reason: Bad Request, internal exception: System.Net.Http.HttpRequestException: + Response status code does not indicate success: 400 (Bad Request).\n at + System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.SendRequestAndGetJsonAsync[T](HttpRequestMessage + requestMessage, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 66\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.CallServerAndGetAsync[TRequest,TResponse](String + tenantId, HttpMethod httpMethod, Uri requestUri, TRequest requestBody) in + /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 239\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.PutResourceAsync[T](String + tenantId, String resourceId, String apiVersion, T requestBody) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 134\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreatePrivateEndpoint(String + privateLinkResourceId, String privateEndpointName) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 333\n at Microsoft.Azure.ContainerNetworking.DncRP.OrchestratorController.ExecutePutOrchestratorAsync(String + subscriptionId, String resourceGroupName, String resourceName) in /usr/local/Networking-Aquarius/src/DncRP/Server/Controllers/OrchestratorController.cs:line + 207InternalErrorCode: PrivateEndpointCreateFailed. Private endpoint creation + failed: System.Exception: ResponseMessage: System.Net.Http.HttpConnectionResponseContent, + status code BadRequest, Reason: Bad Request, internal exception: System.Net.Http.HttpRequestException: + Response status code does not indicate success: 400 (Bad Request).\n at + System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.SendRequestAndGetJsonAsync[T](HttpRequestMessage + requestMessage, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 66\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.CallServerAndGetAsync[TRequest,TResponse](String + tenantId, HttpMethod httpMethod, Uri requestUri, TRequest requestBody) in + /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 239\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.PutResourceAsync[T](String + tenantId, String resourceId, String apiVersion, T requestBody) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 134\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreatePrivateEndpoint(String + privateLinkResourceId, String privateEndpointName) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 333\n at Microsoft.Azure.ContainerNetworking.DncRP.OrchestratorController.ExecutePutOrchestratorAsync(String + subscriptionId, String resourceGroupName, String resourceName) in /usr/local/Networking-Aquarius/src/DncRP/Server/Controllers/OrchestratorController.cs:line + 207","details":null}}}' + headers: + cache-control: + - no-cache + connection: + - close + content-length: + - '4395' + content-type: + - application/json + date: + - Fri, 28 Jul 2023 20:49:06 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:82487bea-6925-46b8-a5c9-0bcae97f8f27 + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-failure-cause: + - service + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 500 + message: Internal Server Error +- request: + body: '{"identity": {"type": "SystemAssigned"}, "kind": "Kubernetes", "location": + "centraluseuap", "properties": {"apiServerEndpoint": "https://testk8s.cloudapp.net", + "clusterRootCA": "ddsadsad344mfdsfdl", "controllerDetails": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/controller/clitestcontroller"}, + "orchestratorAppId": "546192d7-503f-477a-9cfe-4efc3ee2b6e1", "orchestratorTenantId": + "72f988bf-86f1-41af-91ab-2d7cd011db47", "privateLinkResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.Network/privateLinkServices/plresource1"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - dnc orchestrator-instance-service create + Connection: + - keep-alive + Content-Length: + - '682' + Content-Type: + - application/json + ParameterSetName: + - --type --location --api-server-endpoint --cluster-root-ca --id --orchestrator-app-id + --orchestrator-tenant-id --priv-link-resource-id --resource-group --resource-name + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/orchestrators/testk8s1?api-version=2023-05-18-preview + response: + body: + string: '{"ErrorResponse":{"error":{"code":"500","message":"Error in API: PutOrchestratorPrivate + endpoint creation failed: System.Exception: ResponseMessage: System.Net.Http.HttpConnectionResponseContent, + status code BadRequest, Reason: Bad Request, internal exception: System.Net.Http.HttpRequestException: + Response status code does not indicate success: 400 (Bad Request).\n at + System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.SendRequestAndGetJsonAsync[T](HttpRequestMessage + requestMessage, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 66\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.CallServerAndGetAsync[TRequest,TResponse](String + tenantId, HttpMethod httpMethod, Uri requestUri, TRequest requestBody) in + /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 239\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.PutResourceAsync[T](String + tenantId, String resourceId, String apiVersion, T requestBody) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 134\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreatePrivateEndpoint(String + privateLinkResourceId, String privateEndpointName) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 346\n at Microsoft.Azure.ContainerNetworking.DncRP.OrchestratorController.ExecutePutOrchestratorAsync(String + subscriptionId, String resourceGroupName, String resourceName) in /usr/local/Networking-Aquarius/src/DncRP/Server/Controllers/OrchestratorController.cs:line + 207InternalErrorCode: PrivateEndpointCreateFailed. Private endpoint creation + failed: System.Exception: ResponseMessage: System.Net.Http.HttpConnectionResponseContent, + status code BadRequest, Reason: Bad Request, internal exception: System.Net.Http.HttpRequestException: + Response status code does not indicate success: 400 (Bad Request).\n at + System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.SendRequestAndGetJsonAsync[T](HttpRequestMessage + requestMessage, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 66\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.CallServerAndGetAsync[TRequest,TResponse](String + tenantId, HttpMethod httpMethod, Uri requestUri, TRequest requestBody) in + /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 239\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.PutResourceAsync[T](String + tenantId, String resourceId, String apiVersion, T requestBody) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 134\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreatePrivateEndpoint(String + privateLinkResourceId, String privateEndpointName) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 346\n at Microsoft.Azure.ContainerNetworking.DncRP.OrchestratorController.ExecutePutOrchestratorAsync(String + subscriptionId, String resourceGroupName, String resourceName) in /usr/local/Networking-Aquarius/src/DncRP/Server/Controllers/OrchestratorController.cs:line + 207","details":null}}}' + headers: + cache-control: + - no-cache + connection: + - close + content-length: + - '4395' + content-type: + - application/json + date: + - Fri, 28 Jul 2023 20:49:09 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:82487bea-6925-46b8-a5c9-0bcae97f8f27 + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-failure-cause: + - service + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 500 + message: Internal Server Error +- request: + body: '{"identity": {"type": "SystemAssigned"}, "kind": "Kubernetes", "location": + "centraluseuap", "properties": {"apiServerEndpoint": "https://testk8s.cloudapp.net", + "clusterRootCA": "ddsadsad344mfdsfdl", "controllerDetails": {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/controller/clitestcontroller"}, + "orchestratorAppId": "546192d7-503f-477a-9cfe-4efc3ee2b6e1", "orchestratorTenantId": + "72f988bf-86f1-41af-91ab-2d7cd011db47", "privateLinkResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.Network/privateLinkServices/plresource1"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - dnc orchestrator-instance-service create + Connection: + - keep-alive + Content-Length: + - '682' + Content-Type: + - application/json + ParameterSetName: + - --type --location --api-server-endpoint --cluster-root-ca --id --orchestrator-app-id + --orchestrator-tenant-id --priv-link-resource-id --resource-group --resource-name + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/orchestrators/testk8s1?api-version=2023-05-18-preview + response: + body: + string: '{"ErrorResponse":{"error":{"code":"500","message":"Error in API: PutOrchestratorPrivate + endpoint creation failed: System.Exception: ResponseMessage: System.Net.Http.HttpConnectionResponseContent, + status code BadRequest, Reason: Bad Request, internal exception: System.Net.Http.HttpRequestException: + Response status code does not indicate success: 400 (Bad Request).\n at + System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.SendRequestAndGetJsonAsync[T](HttpRequestMessage + requestMessage, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 66\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.CallServerAndGetAsync[TRequest,TResponse](String + tenantId, HttpMethod httpMethod, Uri requestUri, TRequest requestBody) in + /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 239\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.PutResourceAsync[T](String + tenantId, String resourceId, String apiVersion, T requestBody) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 134\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreatePrivateEndpoint(String + privateLinkResourceId, String privateEndpointName) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 346\n at Microsoft.Azure.ContainerNetworking.DncRP.OrchestratorController.ExecutePutOrchestratorAsync(String + subscriptionId, String resourceGroupName, String resourceName) in /usr/local/Networking-Aquarius/src/DncRP/Server/Controllers/OrchestratorController.cs:line + 207InternalErrorCode: PrivateEndpointCreateFailed. Private endpoint creation + failed: System.Exception: ResponseMessage: System.Net.Http.HttpConnectionResponseContent, + status code BadRequest, Reason: Bad Request, internal exception: System.Net.Http.HttpRequestException: + Response status code does not indicate success: 400 (Bad Request).\n at + System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.ParseHttpResponse[T](HttpResponseMessage + httpResponse, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 142\n at Microsoft.Azure.ContainerNetworking.CoreLib.HttpUtility.SendRequestAndGetJsonAsync[T](HttpRequestMessage + requestMessage, JsonSerializerSettings deserializeSettings) in /usr/local/Networking-Aquarius/src/Common/CoreLib/HttpUtility.cs:line + 66\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.CallServerAndGetAsync[TRequest,TResponse](String + tenantId, HttpMethod httpMethod, Uri requestUri, TRequest requestBody) in + /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 239\n at Microsoft.Azure.ContainerNetworking.DncRP.AzResourceBroker.PutResourceAsync[T](String + tenantId, String resourceId, String apiVersion, T requestBody) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzResourceBroker.cs:line + 134\n at Microsoft.Azure.ContainerNetworking.DncRP.AzVNetBroker.GetOrCreatePrivateEndpoint(String + privateLinkResourceId, String privateEndpointName) in /usr/local/Networking-Aquarius/src/DncRP/Server/AzResourceBroker/AzVNetBroker.cs:line + 346\n at Microsoft.Azure.ContainerNetworking.DncRP.OrchestratorController.ExecutePutOrchestratorAsync(String + subscriptionId, String resourceGroupName, String resourceName) in /usr/local/Networking-Aquarius/src/DncRP/Server/Controllers/OrchestratorController.cs:line + 207","details":null}}}' + headers: + cache-control: + - no-cache + connection: + - close + content-length: + - '4395' + content-type: + - application/json + date: + - Fri, 28 Jul 2023 20:49:14 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:82487bea-6925-46b8-a5c9-0bcae97f8f27 + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-failure-cause: + - service + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 500 + message: Internal Server Error +version: 1 diff --git a/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_orchestrator_instance_service_delete.yaml b/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_orchestrator_instance_service_delete.yaml new file mode 100644 index 00000000000..27afd6ec19c --- /dev/null +++ b/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_orchestrator_instance_service_delete.yaml @@ -0,0 +1,42 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - dnc orchestrator-instance-service delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --resource-name --resource-group --yes + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/orchestrators/testk8s1?api-version=2023-05-18-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + date: + - Fri, 28 Jul 2023 20:49:05 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 204 + message: No Content +version: 1 diff --git a/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_orchestrator_instance_service_show.yaml b/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_orchestrator_instance_service_show.yaml new file mode 100644 index 00000000000..4e79601bc73 --- /dev/null +++ b/src/dnc/azext_dnc/tests/latest/recordings/test_dnc_orchestrator_instance_service_show.yaml @@ -0,0 +1,46 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - dnc orchestrator-instance-service show + Connection: + - keep-alive + ParameterSetName: + - --resource-name --resource-group + User-Agent: + - AZURECLI/2.50.0 (AAZ) azsdk-python-core/1.26.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_dnc000001/providers/Microsoft.DelegatedNetwork/orchestrators/testk8s1?api-version=2023-05-18-preview + response: + body: + string: '{"error":{"code":"ResourceNotFound","message":"The Resource ''Microsoft.DelegatedNetwork/orchestrators/testk8s1'' + under resource group ''cli_test_dnc000001'' was not found. For more details + please go to https://aka.ms/ARMResourceNotFoundFix"}}' + headers: + cache-control: + - no-cache + content-length: + - '239' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 28 Jul 2023 20:49:05 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-failure-cause: + - gateway + status: + code: 404 + message: Not Found +version: 1 diff --git a/src/dnc/azext_dnc/tests/latest/test_dnc.py b/src/dnc/azext_dnc/tests/latest/test_dnc.py new file mode 100644 index 00000000000..aef6d81c44a --- /dev/null +++ b/src/dnc/azext_dnc/tests/latest/test_dnc.py @@ -0,0 +1,174 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +from azure.cli.testsdk import * +from azure.core.exceptions import (HttpResponseError, ResourceNotFoundError) + + +class DncScenario(ScenarioTest): + + ### + # Controller tests + ### + + @ResourceGroupPreparer(name_prefix='cli_test_dnc', location='centraluseuap') + def test_dnc_controller_create(self, resource_group): + self.kwargs.update({ + 'controllerName': 'clitestcontroller', + 'rg': resource_group + }) + + self.cmd('dnc controller create --location "centraluseuap" --resource-name {controllerName} --resource-group {rg}', checks=[ + self.check('name', '{controllerName}'), + self.check('properties.provisioningState', 'Succeeded'), + self.exists('properties.resourceGuid'), + self.exists('properties.dncAppId'), + self.exists('properties.dncEndpoint') + ]) + + @ResourceGroupPreparer(name_prefix='cli_test_dnc', location='centraluseuap') + def test_dnc_controller_create_test_purpose(self, resource_group): + self.kwargs.update({ + 'controllerName': 'clitestcontroller', + 'rg': resource_group + }) + + self.cmd('dnc controller create --location "centraluseuap" --resource-name {controllerName} --resource-group {rg} --purpose "test"', checks=[ + self.check('name', '{controllerName}'), + self.check('properties.provisioningState', 'Succeeded'), + self.exists('properties.resourceGuid'), + self.exists('properties.dncAppId'), + self.exists('properties.dncEndpoint') + ]) + + @ResourceGroupPreparer(name_prefix='cli_test_dnc', location='centraluseuap') + def test_dnc_controller_delete(self, resource_group): + self.kwargs.update({ + 'controllerName': 'clitestcontroller', + 'rg': resource_group + }) + + self.cmd('dnc controller delete --resource-name {controllerName} --resource-group {rg} --yes') + + @ResourceGroupPreparer(name_prefix='cli_test_dnc', location='centraluseuap') + def test_dnc_controller_show(self, resource_group): + self.kwargs.update({ + 'controllerName': 'clitestcontroller', + 'rg': resource_group + }) + + # setup + self.cmd('dnc controller create --location "centraluseuap" --resource-name {controllerName} --resource-group {rg}', checks=[ + self.check('name', '{controllerName}'), + self.check('properties.provisioningState', 'Succeeded'), + self.exists('properties.resourceGuid'), + self.exists('properties.dncAppId'), + self.exists('properties.dncEndpoint') + ]) + + self.cmd('dnc controller show --resource-name {controllerName} --resource-group {rg}', checks=[ + self.check('name', '{controllerName}'), + self.check('properties.provisioningState', 'Succeeded'), + self.exists('properties.resourceGuid'), + self.exists('properties.dncAppId'), + self.exists('properties.dncEndpoint') + ]) + + + ### + # Delegated subnet service tests + ### + + @ResourceGroupPreparer(name_prefix='cli_test_dnc', location='centraluseuap') + @VirtualNetworkPreparer(name_prefix='cli_test_dnc', location='centraluseuap') + def test_dnc_delegated_subnet_service_create(self, resource_group, virtual_network): + self.kwargs.update({ + 'controllerName': 'clitestcontroller', + 'rg': resource_group, + 'vn': virtual_network, + 'sid': self.get_subscription_id() + }) + + controllerDetailsId = self.cmd('dnc controller create --location "centraluseuap" --resource-name {controllerName} --resource-group {rg}').get_output_in_json()['id'] + subnetDetailsId = '/subscriptions/{sid}/resourceGroups/{rg}/providers/Microsoft.Network/virtualNetworks/{vn}/subnets/default' + + with self.assertRaises(HttpResponseError) as err: + self.cmd(f'dnc delegated-subnet-service create --location "centraluseuap" --id {controllerDetailsId} --subnet-details-id {subnetDetailsId} --resource-group {self.kwargs["rg"]} --resource-name delegated1') + + # We expect this since we can't create one without a PrivateLinkService. We expect SAL creation to fail. + # In this test we want to make sure the schema for the CLI arguments are correctly generated. + self.assertIn("SAL creation failed", str(err.exception)) + + @ResourceGroupPreparer(name_prefix='cli_test_dnc', location='centraluseuap') + def test_dnc_delegated_subnet_service_delete(self, resource_group): + self.kwargs.update({ + 'controllerName': 'clitestcontroller', + 'rg': resource_group, + }) + + self.cmd('dnc delegated-subnet-service delete --resource-name delegated1 --resource-group {rg} --yes') + + @ResourceGroupPreparer(name_prefix='cli_test_dnc', location='centraluseuap') + def test_dnc_delegated_subnet_service_show(self, resource_group): + self.kwargs.update({ + 'controllerName': 'clitestcontroller', + 'rg': resource_group, + }) + + with self.assertRaises(ResourceNotFoundError) as err: + self.cmd('dnc delegated-subnet-service show --resource-name delegated1 --resource-group {rg}') + + # We expect this because we can't create one without a PrivateLinkService. + # In this test we want to make sure the schema for the CLI arguments are correctly generated. + self.assertIn("ResourceNotFound", str(err.exception)) + + + ### + # Orchestrator Instance Service tests + ### + + @ResourceGroupPreparer(name_prefix='cli_test_dnc', location='centraluseuap') + def test_dnc_orchestrator_instance_service_create(self, resource_group): + tenantId = self.cmd("az account show").get_output_in_json()["tenantId"] + self.kwargs.update({ + 'controllerName': 'clitestcontroller', + 'rg': resource_group, + 'sid': self.get_subscription_id(), + 'tid': tenantId + }) + + # setup + self.cmd('dnc controller create --location "centraluseuap" --resource-name {controllerName} --resource-group {rg}') + + with self.assertRaises(HttpResponseError) as err: + # --kind "Kubernetes" is implicit as default + self.cmd('dnc orchestrator-instance-service create --type "SystemAssigned" --location "centraluseuap" --api-server-endpoint "https://testk8s.cloudapp.net" --cluster-root-ca "ddsadsad344mfdsfdl" --id "/subscriptions/{sid}/resourceGroups/{rg}/providers/Microsoft.DelegatedNetwork/controller/{controllerName}" --orchestrator-app-id "546192d7-503f-477a-9cfe-4efc3ee2b6e1" --orchestrator-tenant-id {tid} --priv-link-resource-id "/subscriptions/{sid}/resourceGroups/{rg}/providers/Microsoft.Network/privateLinkServices/plresource1" --resource-group {rg} --resource-name "testk8s1"') + + # We expect this because we don't have dependencies set up for the Kubernetes API server endpoint and private link resource. + # In this test we want to make sure the schema for the CLI arguments are correctly generated. + self.assertIn("Internal Server Error", str(err.exception)) + + @ResourceGroupPreparer(name_prefix='cli_test_dnc', location='centraluseuap') + def test_dnc_orchestrator_instance_service_delete(self, resource_group): + self.kwargs.update({ + 'rg': resource_group + }) + + self.cmd('dnc orchestrator-instance-service delete --resource-name testk8s1 --resource-group {rg} --yes') + + @ResourceGroupPreparer(name_prefix='cli_test_dnc', location='centraluseuap') + def test_dnc_orchestrator_instance_service_show(self, resource_group): + self.kwargs.update({ + 'rg': resource_group + }) + + with self.assertRaises(ResourceNotFoundError) as err: + self.cmd('dnc orchestrator-instance-service show --resource-name testk8s1 --resource-group {rg}') + + # We expect this because we can't create one without real dependencies. + # In this test we want to make sure the schema for the CLI arguments are correctly generated. + self.assertIn("ResourceNotFound", str(err.exception)) \ No newline at end of file diff --git a/src/dnc/azext_dnc/tests/latest/test_dnc_scenario.py b/src/dnc/azext_dnc/tests/latest/test_dnc_scenario.py deleted file mode 100644 index d15bca44d1d..00000000000 --- a/src/dnc/azext_dnc/tests/latest/test_dnc_scenario.py +++ /dev/null @@ -1,84 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import os -from azure.cli.testsdk import ScenarioTest -from azure.cli.testsdk import ResourceGroupPreparer -from .preparers import VirtualNetworkPreparer -from .example_steps import step_controller_create -from .example_steps import step_controller_show -from .example_steps import step_delegated_subnet_service_create -from .example_steps import step_delegated_subnet_service_show -from .example_steps import step_delegated_subnet_service_delete -from .example_steps import step_orchestrator_instance_service_create -from .example_steps import step_orchestrator_instance_service_show -from .example_steps import step_orchestrator_instance_service_delete -from .example_steps import step_controller_delete -from .. import ( - try_manual, - raise_if, - calc_coverage -) - - -TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) - - -# Env setup_scenario -@try_manual -def setup_scenario(test, rg): - pass - - -# Env cleanup_scenario -@try_manual -def cleanup_scenario(test, rg): - pass - - -# Testcase: Scenario -@try_manual -def call_scenario(test, rg): - setup_scenario(test, rg) - step_controller_create(test, rg, checks=[]) - step_controller_show(test, rg, checks=[]) - step_delegated_subnet_service_create(test, rg, checks=[]) - step_delegated_subnet_service_show(test, rg, checks=[]) - step_delegated_subnet_service_delete(test, rg, checks=[]) - step_orchestrator_instance_service_create(test, rg, checks=[]) - step_orchestrator_instance_service_show(test, rg, checks=[]) - step_orchestrator_instance_service_delete(test, rg, checks=[]) - step_controller_delete(test, rg, checks=[]) - cleanup_scenario(test, rg) - - -# Test class for Scenario -@try_manual -class DncScenarioTest(ScenarioTest): - - def __init__(self, *args, **kwargs): - super(DncScenarioTest, self).__init__(*args, **kwargs) - self.kwargs.update({ - 'subscription_id': self.get_subscription_id() - }) - - self.kwargs.update({ - 'myController': 'testcontroller', - 'myController2': 'dnctestcontroller', - }) - - - @ResourceGroupPreparer(name_prefix='clitestdnc_TestRG'[:7], key='rg', parameter_name='rg') - @VirtualNetworkPreparer(name_prefix='clitestdnc_testvnet'[:7], key='vn', resource_group_key='rg') - def test_dnc_Scenario(self, rg): - call_scenario(self, rg) - calc_coverage(__file__) - raise_if() - diff --git a/src/dnc/azext_dnc/vendored_sdks/__init__.py b/src/dnc/azext_dnc/vendored_sdks/__init__.py deleted file mode 100644 index c9cfdc73e77..00000000000 --- a/src/dnc/azext_dnc/vendored_sdks/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/dnc/azext_dnc/vendored_sdks/dnc/__init__.py b/src/dnc/azext_dnc/vendored_sdks/dnc/__init__.py deleted file mode 100644 index 17177114514..00000000000 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._dnc import DNC -from ._version import VERSION - -__version__ = VERSION -__all__ = ['DNC'] - -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass diff --git a/src/dnc/azext_dnc/vendored_sdks/dnc/_configuration.py b/src/dnc/azext_dnc/vendored_sdks/dnc/_configuration.py deleted file mode 100644 index 2e1bb8a30c8..00000000000 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/_configuration.py +++ /dev/null @@ -1,71 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any - - from azure.core.credentials import TokenCredential - - -class DNCConfiguration(Configuration): - """Configuration for DNC. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. - :type subscription_id: str - """ - - def __init__( - self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - super(DNCConfiguration, self).__init__(**kwargs) - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2021-03-15" - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-dnc/{}'.format(VERSION)) - self._configure(**kwargs) - - def _configure( - self, - **kwargs # type: Any - ): - # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') - if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/dnc/azext_dnc/vendored_sdks/dnc/_dnc.py b/src/dnc/azext_dnc/vendored_sdks/dnc/_dnc.py deleted file mode 100644 index 1bc9b9160fb..00000000000 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/_dnc.py +++ /dev/null @@ -1,90 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import TYPE_CHECKING - -from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - - from azure.core.credentials import TokenCredential - -from ._configuration import DNCConfiguration -from .operations import ControllerOperations -from .operations import DelegatedNetworkOperations -from .operations import OrchestratorInstanceServiceOperations -from .operations import DelegatedSubnetServiceOperations -from .operations import Operations -from . import models - - -class DNC(object): - """DNC web api provides way to create, get and delete dnc controller. - - :ivar controller: ControllerOperations operations - :vartype controller: dnc.operations.ControllerOperations - :ivar delegated_network: DelegatedNetworkOperations operations - :vartype delegated_network: dnc.operations.DelegatedNetworkOperations - :ivar orchestrator_instance_service: OrchestratorInstanceServiceOperations operations - :vartype orchestrator_instance_service: dnc.operations.OrchestratorInstanceServiceOperations - :ivar delegated_subnet_service: DelegatedSubnetServiceOperations operations - :vartype delegated_subnet_service: dnc.operations.DelegatedSubnetServiceOperations - :ivar operations: Operations operations - :vartype operations: dnc.operations.Operations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. - :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - """ - - def __init__( - self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = DNCConfiguration(credential, subscription_id, **kwargs) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False - self._deserialize = Deserializer(client_models) - - self.controller = ControllerOperations( - self._client, self._config, self._serialize, self._deserialize) - self.delegated_network = DelegatedNetworkOperations( - self._client, self._config, self._serialize, self._deserialize) - self.orchestrator_instance_service = OrchestratorInstanceServiceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.delegated_subnet_service = DelegatedSubnetServiceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - - def close(self): - # type: () -> None - self._client.close() - - def __enter__(self): - # type: () -> DNC - self._client.__enter__() - return self - - def __exit__(self, *exc_details): - # type: (Any) -> None - self._client.__exit__(*exc_details) diff --git a/src/dnc/azext_dnc/vendored_sdks/dnc/aio/_configuration.py b/src/dnc/azext_dnc/vendored_sdks/dnc/aio/_configuration.py deleted file mode 100644 index 778374290af..00000000000 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/aio/_configuration.py +++ /dev/null @@ -1,67 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class DNCConfiguration(Configuration): - """Configuration for DNC. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. - :type subscription_id: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - super(DNCConfiguration, self).__init__(**kwargs) - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2021-03-15" - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-dnc/{}'.format(VERSION)) - self._configure(**kwargs) - - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') - if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/dnc/azext_dnc/vendored_sdks/dnc/aio/_dnc.py b/src/dnc/azext_dnc/vendored_sdks/dnc/aio/_dnc.py deleted file mode 100644 index dc49d9ea1d7..00000000000 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/aio/_dnc.py +++ /dev/null @@ -1,84 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, Optional, TYPE_CHECKING - -from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -from ._configuration import DNCConfiguration -from .operations import ControllerOperations -from .operations import DelegatedNetworkOperations -from .operations import OrchestratorInstanceServiceOperations -from .operations import DelegatedSubnetServiceOperations -from .operations import Operations -from .. import models - - -class DNC(object): - """DNC web api provides way to create, get and delete dnc controller. - - :ivar controller: ControllerOperations operations - :vartype controller: dnc.aio.operations.ControllerOperations - :ivar delegated_network: DelegatedNetworkOperations operations - :vartype delegated_network: dnc.aio.operations.DelegatedNetworkOperations - :ivar orchestrator_instance_service: OrchestratorInstanceServiceOperations operations - :vartype orchestrator_instance_service: dnc.aio.operations.OrchestratorInstanceServiceOperations - :ivar delegated_subnet_service: DelegatedSubnetServiceOperations operations - :vartype delegated_subnet_service: dnc.aio.operations.DelegatedSubnetServiceOperations - :ivar operations: Operations operations - :vartype operations: dnc.aio.operations.Operations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. - :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: Optional[str] = None, - **kwargs: Any - ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = DNCConfiguration(credential, subscription_id, **kwargs) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False - self._deserialize = Deserializer(client_models) - - self.controller = ControllerOperations( - self._client, self._config, self._serialize, self._deserialize) - self.delegated_network = DelegatedNetworkOperations( - self._client, self._config, self._serialize, self._deserialize) - self.orchestrator_instance_service = OrchestratorInstanceServiceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.delegated_subnet_service = DelegatedSubnetServiceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "DNC": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details) -> None: - await self._client.__aexit__(*exc_details) diff --git a/src/dnc/azext_dnc/vendored_sdks/dnc/aio/operations/__init__.py b/src/dnc/azext_dnc/vendored_sdks/dnc/aio/operations/__init__.py deleted file mode 100644 index bd4224d51ca..00000000000 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/aio/operations/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._controller_operations import ControllerOperations -from ._delegated_network_operations import DelegatedNetworkOperations -from ._orchestrator_instance_service_operations import OrchestratorInstanceServiceOperations -from ._delegated_subnet_service_operations import DelegatedSubnetServiceOperations -from ._operations import Operations - -__all__ = [ - 'ControllerOperations', - 'DelegatedNetworkOperations', - 'OrchestratorInstanceServiceOperations', - 'DelegatedSubnetServiceOperations', - 'Operations', -] diff --git a/src/dnc/azext_dnc/vendored_sdks/dnc/aio/operations/_controller_operations.py b/src/dnc/azext_dnc/vendored_sdks/dnc/aio/operations/_controller_operations.py deleted file mode 100644 index 467aed74b2b..00000000000 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/aio/operations/_controller_operations.py +++ /dev/null @@ -1,411 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ControllerOperations: - """ControllerOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~dnc.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def get_details( - self, - resource_group_name: str, - resource_name: str, - **kwargs - ) -> "models.DelegatedController": - """Gets details about the specified dnc controller. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DelegatedController, or the result of cls(response) - :rtype: ~dnc.models.DelegatedController - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedController"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - # Construct URL - url = self.get_details.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DelegatedController', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/controller/{resourceName}'} # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: "models.DelegatedController", - **kwargs - ) -> "models.DelegatedController": - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedController"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DelegatedController') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('DelegatedController', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('DelegatedController', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/controller/{resourceName}'} # type: ignore - - async def begin_create( - self, - resource_group_name: str, - resource_name: str, - parameters: "models.DelegatedController", - **kwargs - ) -> AsyncLROPoller["models.DelegatedController"]: - """Create a dnc controller. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :param parameters: controller type parameters. - :type parameters: ~dnc.models.DelegatedController - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DelegatedController or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~dnc.models.DelegatedController] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedController"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('DelegatedController', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/controller/{resourceName}'} # type: ignore - - async def _delete_initial( - self, - resource_group_name: str, - resource_name: str, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/controller/{resourceName}'} # type: ignore - - async def begin_delete( - self, - resource_group_name: str, - resource_name: str, - **kwargs - ) -> AsyncLROPoller[None]: - """Deletes the DNC controller. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/controller/{resourceName}'} # type: ignore - - async def patch( - self, - resource_group_name: str, - resource_name: str, - parameters: "models.ControllerResourceUpdateParameters", - **kwargs - ) -> "models.DelegatedController": - """Update dnc controller. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :param parameters: controller type parameters. - :type parameters: ~dnc.models.ControllerResourceUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DelegatedController, or the result of cls(response) - :rtype: ~dnc.models.DelegatedController - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedController"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ControllerResourceUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DelegatedController', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/controller/{resourceName}'} # type: ignore diff --git a/src/dnc/azext_dnc/vendored_sdks/dnc/aio/operations/_delegated_network_operations.py b/src/dnc/azext_dnc/vendored_sdks/dnc/aio/operations/_delegated_network_operations.py deleted file mode 100644 index a3871fbcd24..00000000000 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/aio/operations/_delegated_network_operations.py +++ /dev/null @@ -1,180 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class DelegatedNetworkOperations: - """DelegatedNetworkOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~dnc.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list_by_subscription( - self, - **kwargs - ) -> AsyncIterable["models.DelegatedControllers"]: - """Get all the delegatedController resources in a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DelegatedControllers or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~dnc.models.DelegatedControllers] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedControllers"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('DelegatedControllers', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DelegatedNetwork/controllers'} # type: ignore - - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs - ) -> AsyncIterable["models.DelegatedControllers"]: - """Get all the delegatedController resources in a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DelegatedControllers or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~dnc.models.DelegatedControllers] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedControllers"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('DelegatedControllers', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/controllers'} # type: ignore diff --git a/src/dnc/azext_dnc/vendored_sdks/dnc/aio/operations/_delegated_subnet_service_operations.py b/src/dnc/azext_dnc/vendored_sdks/dnc/aio/operations/_delegated_subnet_service_operations.py deleted file mode 100644 index e5a3803ff5b..00000000000 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/aio/operations/_delegated_subnet_service_operations.py +++ /dev/null @@ -1,615 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class DelegatedSubnetServiceOperations: - """DelegatedSubnetServiceOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~dnc.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def get_details( - self, - resource_group_name: str, - resource_name: str, - **kwargs - ) -> "models.DelegatedSubnet": - """Gets details about the specified dnc DelegatedSubnet Link. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DelegatedSubnet, or the result of cls(response) - :rtype: ~dnc.models.DelegatedSubnet - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedSubnet"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - # Construct URL - url = self.get_details.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DelegatedSubnet', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/delegatedSubnets/{resourceName}'} # type: ignore - - async def _put_details_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: "models.DelegatedSubnet", - **kwargs - ) -> "models.DelegatedSubnet": - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedSubnet"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._put_details_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DelegatedSubnet') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('DelegatedSubnet', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('DelegatedSubnet', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _put_details_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/delegatedSubnets/{resourceName}'} # type: ignore - - async def begin_put_details( - self, - resource_group_name: str, - resource_name: str, - parameters: "models.DelegatedSubnet", - **kwargs - ) -> AsyncLROPoller["models.DelegatedSubnet"]: - """Put delegated subnet resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :param parameters: Delegated subnet details. - :type parameters: ~dnc.models.DelegatedSubnet - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DelegatedSubnet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~dnc.models.DelegatedSubnet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedSubnet"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._put_details_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('DelegatedSubnet', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/delegatedSubnets/{resourceName}'} # type: ignore - - async def _patch_details_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: "models.ResourceUpdateParameters", - **kwargs - ) -> "models.DelegatedSubnet": - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedSubnet"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._patch_details_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ResourceUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DelegatedSubnet', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _patch_details_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/delegatedSubnets/{resourceName}'} # type: ignore - - async def begin_patch_details( - self, - resource_group_name: str, - resource_name: str, - parameters: "models.ResourceUpdateParameters", - **kwargs - ) -> AsyncLROPoller["models.DelegatedSubnet"]: - """Patch delegated subnet resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :param parameters: Delegated subnet details. - :type parameters: ~dnc.models.ResourceUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DelegatedSubnet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~dnc.models.DelegatedSubnet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedSubnet"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._patch_details_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('DelegatedSubnet', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_patch_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/delegatedSubnets/{resourceName}'} # type: ignore - - async def _delete_details_initial( - self, - resource_group_name: str, - resource_name: str, - force_delete: Optional[bool] = None, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - # Construct URL - url = self._delete_details_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_details_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/delegatedSubnets/{resourceName}'} # type: ignore - - async def begin_delete_details( - self, - resource_group_name: str, - resource_name: str, - force_delete: Optional[bool] = None, - **kwargs - ) -> AsyncLROPoller[None]: - """Delete dnc DelegatedSubnet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :param force_delete: Force delete resource. - :type force_delete: bool - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_details_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - force_delete=force_delete, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/delegatedSubnets/{resourceName}'} # type: ignore - - def list_by_subscription( - self, - **kwargs - ) -> AsyncIterable["models.DelegatedSubnets"]: - """Get all the DelegatedSubnets resources in a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DelegatedSubnets or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~dnc.models.DelegatedSubnets] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedSubnets"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('DelegatedSubnets', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DelegatedNetwork/delegatedSubnets'} # type: ignore - - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs - ) -> AsyncIterable["models.DelegatedSubnets"]: - """Get all the DelegatedSubnets resources in a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DelegatedSubnets or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~dnc.models.DelegatedSubnets] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedSubnets"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('DelegatedSubnets', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/delegatedSubnets'} # type: ignore diff --git a/src/dnc/azext_dnc/vendored_sdks/dnc/aio/operations/_operations.py b/src/dnc/azext_dnc/vendored_sdks/dnc/aio/operations/_operations.py deleted file mode 100644 index 04b3994e6bb..00000000000 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/aio/operations/_operations.py +++ /dev/null @@ -1,105 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~dnc.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - **kwargs - ) -> AsyncIterable["models.OperationListResult"]: - """Lists all of the available DelegatedNetwork service REST API operations. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~dnc.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/providers/Microsoft.DelegatedNetwork/operations'} # type: ignore diff --git a/src/dnc/azext_dnc/vendored_sdks/dnc/aio/operations/_orchestrator_instance_service_operations.py b/src/dnc/azext_dnc/vendored_sdks/dnc/aio/operations/_orchestrator_instance_service_operations.py deleted file mode 100644 index 46e26af63e0..00000000000 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/aio/operations/_orchestrator_instance_service_operations.py +++ /dev/null @@ -1,557 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class OrchestratorInstanceServiceOperations: - """OrchestratorInstanceServiceOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~dnc.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def get_details( - self, - resource_group_name: str, - resource_name: str, - **kwargs - ) -> "models.Orchestrator": - """Gets details about the orchestrator instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Orchestrator, or the result of cls(response) - :rtype: ~dnc.models.Orchestrator - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Orchestrator"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - # Construct URL - url = self.get_details.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Orchestrator', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/orchestrators/{resourceName}'} # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: "models.Orchestrator", - **kwargs - ) -> "models.Orchestrator": - cls = kwargs.pop('cls', None) # type: ClsType["models.Orchestrator"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Orchestrator') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('Orchestrator', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('Orchestrator', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/orchestrators/{resourceName}'} # type: ignore - - async def begin_create( - self, - resource_group_name: str, - resource_name: str, - parameters: "models.Orchestrator", - **kwargs - ) -> AsyncLROPoller["models.Orchestrator"]: - """Create a orchestrator instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :param parameters: OrchestratorInstance type parameters. - :type parameters: ~dnc.models.Orchestrator - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Orchestrator or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~dnc.models.Orchestrator] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Orchestrator"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Orchestrator', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/orchestrators/{resourceName}'} # type: ignore - - async def _delete_initial( - self, - resource_group_name: str, - resource_name: str, - force_delete: Optional[bool] = None, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/orchestrators/{resourceName}'} # type: ignore - - async def begin_delete( - self, - resource_group_name: str, - resource_name: str, - force_delete: Optional[bool] = None, - **kwargs - ) -> AsyncLROPoller[None]: - """Deletes the Orchestrator Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :param force_delete: Force delete resource. - :type force_delete: bool - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - force_delete=force_delete, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/orchestrators/{resourceName}'} # type: ignore - - async def patch( - self, - resource_group_name: str, - resource_name: str, - parameters: "models.OrchestratorResourceUpdateParameters", - **kwargs - ) -> "models.Orchestrator": - """Update Orchestrator Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :param parameters: OrchestratorInstance update parameters. - :type parameters: ~dnc.models.OrchestratorResourceUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Orchestrator, or the result of cls(response) - :rtype: ~dnc.models.Orchestrator - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Orchestrator"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'OrchestratorResourceUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Orchestrator', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/orchestrators/{resourceName}'} # type: ignore - - def list_by_subscription( - self, - **kwargs - ) -> AsyncIterable["models.Orchestrators"]: - """Get all the orchestratorInstance resources in a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Orchestrators or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~dnc.models.Orchestrators] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Orchestrators"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('Orchestrators', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DelegatedNetwork/orchestrators'} # type: ignore - - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs - ) -> AsyncIterable["models.Orchestrators"]: - """Get all the OrchestratorInstances resources in a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Orchestrators or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~dnc.models.Orchestrators] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Orchestrators"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('Orchestrators', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/orchestrators'} # type: ignore diff --git a/src/dnc/azext_dnc/vendored_sdks/dnc/models/__init__.py b/src/dnc/azext_dnc/vendored_sdks/dnc/models/__init__.py deleted file mode 100644 index 6dcdd368f6b..00000000000 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/models/__init__.py +++ /dev/null @@ -1,99 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -try: - from ._models_py3 import ControllerDetails - from ._models_py3 import ControllerResource - from ._models_py3 import ControllerResourceUpdateParameters - from ._models_py3 import DelegatedController - from ._models_py3 import DelegatedControllerProperties - from ._models_py3 import DelegatedControllers - from ._models_py3 import DelegatedSubnet - from ._models_py3 import DelegatedSubnetResource - from ._models_py3 import DelegatedSubnets - from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorDetail - from ._models_py3 import ErrorResponse - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import Orchestrator - from ._models_py3 import OrchestratorIdentity - from ._models_py3 import OrchestratorResource - from ._models_py3 import OrchestratorResourceProperties - from ._models_py3 import OrchestratorResourceUpdateParameters - from ._models_py3 import Orchestrators - from ._models_py3 import ResourceUpdateParameters - from ._models_py3 import SubnetDetails -except (SyntaxError, ImportError): - from ._models import ControllerDetails # type: ignore - from ._models import ControllerResource # type: ignore - from ._models import ControllerResourceUpdateParameters # type: ignore - from ._models import DelegatedController # type: ignore - from ._models import DelegatedControllerProperties # type: ignore - from ._models import DelegatedControllers # type: ignore - from ._models import DelegatedSubnet # type: ignore - from ._models import DelegatedSubnetResource # type: ignore - from ._models import DelegatedSubnets # type: ignore - from ._models import ErrorAdditionalInfo # type: ignore - from ._models import ErrorDetail # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import Orchestrator # type: ignore - from ._models import OrchestratorIdentity # type: ignore - from ._models import OrchestratorResource # type: ignore - from ._models import OrchestratorResourceProperties # type: ignore - from ._models import OrchestratorResourceUpdateParameters # type: ignore - from ._models import Orchestrators # type: ignore - from ._models import ResourceUpdateParameters # type: ignore - from ._models import SubnetDetails # type: ignore - -from ._dnc_enums import ( - ActionType, - ControllerState, - DelegatedSubnetState, - OrchestratorInstanceState, - OrchestratorKind, - Origin, - ResourceIdentityType, -) - -__all__ = [ - 'ControllerDetails', - 'ControllerResource', - 'ControllerResourceUpdateParameters', - 'DelegatedController', - 'DelegatedControllerProperties', - 'DelegatedControllers', - 'DelegatedSubnet', - 'DelegatedSubnetResource', - 'DelegatedSubnets', - 'ErrorAdditionalInfo', - 'ErrorDetail', - 'ErrorResponse', - 'Operation', - 'OperationDisplay', - 'OperationListResult', - 'Orchestrator', - 'OrchestratorIdentity', - 'OrchestratorResource', - 'OrchestratorResourceProperties', - 'OrchestratorResourceUpdateParameters', - 'Orchestrators', - 'ResourceUpdateParameters', - 'SubnetDetails', - 'ActionType', - 'ControllerState', - 'DelegatedSubnetState', - 'OrchestratorInstanceState', - 'OrchestratorKind', - 'Origin', - 'ResourceIdentityType', -] diff --git a/src/dnc/azext_dnc/vendored_sdks/dnc/models/_dnc_enums.py b/src/dnc/azext_dnc/vendored_sdks/dnc/models/_dnc_enums.py deleted file mode 100644 index 4a50acbaa78..00000000000 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/models/_dnc_enums.py +++ /dev/null @@ -1,83 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum, EnumMeta -from six import with_metaclass - -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - """ - - INTERNAL = "Internal" - -class ControllerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The current state of dnc controller resource. - """ - - DELETING = "Deleting" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - PROVISIONING = "Provisioning" - -class DelegatedSubnetState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The current state of dnc delegated subnet resource. - """ - - DELETING = "Deleting" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - PROVISIONING = "Provisioning" - -class OrchestratorInstanceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The current state of orchestratorInstance resource. - """ - - DELETING = "Deleting" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - PROVISIONING = "Provisioning" - -class OrchestratorKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The kind of workbook. Choices are user and shared. - """ - - KUBERNETES = "Kubernetes" - -class Origin(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit - logs UX. Default value is "user,system" - """ - - USER = "user" - SYSTEM = "system" - USER_SYSTEM = "user,system" - -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The type of identity used for orchestrator cluster. Type 'SystemAssigned' will use an - implicitly created identity orchestrator clusters - """ - - SYSTEM_ASSIGNED = "SystemAssigned" - NONE = "None" diff --git a/src/dnc/azext_dnc/vendored_sdks/dnc/models/_models.py b/src/dnc/azext_dnc/vendored_sdks/dnc/models/_models.py deleted file mode 100644 index 1c2d5252031..00000000000 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/models/_models.py +++ /dev/null @@ -1,855 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class ControllerDetails(msrest.serialization.Model): - """controller details. - - :param id: controller arm resource id. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ControllerDetails, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class ControllerResource(msrest.serialization.Model): - """Represents an instance of a resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: An identifier that represents the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of resource. - :vartype type: str - :param location: Location of the resource. - :type location: str - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(ControllerResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - - -class ControllerResourceUpdateParameters(msrest.serialization.Model): - """Parameters for updating a resource. - - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(ControllerResourceUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class DelegatedController(ControllerResource): - """Represents an instance of a DNC controller. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: An identifier that represents the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of resource. - :vartype type: str - :param location: Location of the resource. - :type location: str - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - :ivar properties: Properties of the provision operation request. - :vartype properties: ~dnc.models.DelegatedControllerProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'properties': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'DelegatedControllerProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(DelegatedController, self).__init__(**kwargs) - self.properties = None - - -class DelegatedControllerProperties(msrest.serialization.Model): - """Properties of Delegated controller resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_guid: Resource guid. - :vartype resource_guid: str - :ivar provisioning_state: The current state of dnc controller resource. Possible values - include: "Deleting", "Succeeded", "Failed", "Provisioning". - :vartype provisioning_state: str or ~dnc.models.ControllerState - :ivar dnc_app_id: dnc application id should be used by customer to authenticate with dnc - gateway. - :vartype dnc_app_id: str - :ivar dnc_tenant_id: tenant id of dnc application id. - :vartype dnc_tenant_id: str - :ivar dnc_endpoint: dnc endpoint url that customers can use to connect to. - :vartype dnc_endpoint: str - """ - - _validation = { - 'resource_guid': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'dnc_app_id': {'readonly': True}, - 'dnc_tenant_id': {'readonly': True}, - 'dnc_endpoint': {'readonly': True}, - } - - _attribute_map = { - 'resource_guid': {'key': 'resourceGuid', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'dnc_app_id': {'key': 'dncAppId', 'type': 'str'}, - 'dnc_tenant_id': {'key': 'dncTenantId', 'type': 'str'}, - 'dnc_endpoint': {'key': 'dncEndpoint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DelegatedControllerProperties, self).__init__(**kwargs) - self.resource_guid = None - self.provisioning_state = None - self.dnc_app_id = None - self.dnc_tenant_id = None - self.dnc_endpoint = None - - -class DelegatedControllers(msrest.serialization.Model): - """An array of Delegated controller resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. An array of Delegated controller resources. - :type value: list[~dnc.models.DelegatedController] - :ivar next_link: The URL to get the next set of controllers. - :vartype next_link: str - """ - - _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DelegatedController]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DelegatedControllers, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = None - - -class DelegatedSubnetResource(msrest.serialization.Model): - """Represents an instance of a resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: An identifier that represents the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of resource. - :vartype type: str - :param location: Location of the resource. - :type location: str - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(DelegatedSubnetResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - - -class DelegatedSubnet(DelegatedSubnetResource): - """Represents an instance of a orchestrator. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: An identifier that represents the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of resource. - :vartype type: str - :param location: Location of the resource. - :type location: str - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - :ivar resource_guid: Resource guid. - :vartype resource_guid: str - :ivar provisioning_state: The current state of dnc delegated subnet resource. Possible values - include: "Deleting", "Succeeded", "Failed", "Provisioning". - :vartype provisioning_state: str or ~dnc.models.DelegatedSubnetState - :param subnet_details: subnet details. - :type subnet_details: ~dnc.models.SubnetDetails - :param controller_details: Properties of the controller. - :type controller_details: ~dnc.models.ControllerDetails - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'resource_guid': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'resource_guid': {'key': 'properties.resourceGuid', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'subnet_details': {'key': 'properties.subnetDetails', 'type': 'SubnetDetails'}, - 'controller_details': {'key': 'properties.controllerDetails', 'type': 'ControllerDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(DelegatedSubnet, self).__init__(**kwargs) - self.resource_guid = None - self.provisioning_state = None - self.subnet_details = kwargs.get('subnet_details', None) - self.controller_details = kwargs.get('controller_details', None) - - -class DelegatedSubnets(msrest.serialization.Model): - """An array of DelegatedSubnet resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. An array of DelegatedSubnet resources. - :type value: list[~dnc.models.DelegatedSubnet] - :ivar next_link: The URL to get the next set of DelegatedSubnet resources. - :vartype next_link: str - """ - - _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DelegatedSubnet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DelegatedSubnets, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = None - - -class ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: object - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(msrest.serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~dnc.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~dnc.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetail]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(msrest.serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - - :param error: The error object. - :type error: ~dnc.models.ErrorDetail - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class Operation(msrest.serialization.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for data- - plane operations and "false" for ARM/control-plane operations. - :vartype is_data_action: bool - :param display: Localized display information for this particular operation. - :type display: ~dnc.models.OperationDisplay - :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", - "system", "user,system". - :vartype origin: str or ~dnc.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. Possible values include: "Internal". - :vartype action_type: str or ~dnc.models.ActionType - """ - - _validation = { - 'name': {'readonly': True}, - 'is_data_action': {'readonly': True}, - 'origin': {'readonly': True}, - 'action_type': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'action_type': {'key': 'actionType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = None - self.is_data_action = None - self.display = kwargs.get('display', None) - self.origin = None - self.action_type = None - - -class OperationDisplay(msrest.serialization.Model): - """Localized display information for this particular operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str - """ - - _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, - 'description': {'readonly': True}, - } - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None - - -class OperationListResult(msrest.serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~dnc.models.Operation] - :ivar next_link: URL to get the next set of operation list results (if there are any). - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class OrchestratorResource(msrest.serialization.Model): - """Represents an instance of a resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: An identifier that represents the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of resource. - :vartype type: str - :param location: Location of the resource. - :type location: str - :param kind: Required. The kind of workbook. Choices are user and shared. Possible values - include: "Kubernetes". - :type kind: str or ~dnc.models.OrchestratorKind - :param identity: The identity of the orchestrator. - :type identity: ~dnc.models.OrchestratorIdentity - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'OrchestratorIdentity'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(OrchestratorResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs.get('location', None) - self.kind = kwargs['kind'] - self.identity = kwargs.get('identity', None) - self.tags = kwargs.get('tags', None) - - -class Orchestrator(OrchestratorResource): - """Represents an instance of a orchestrator. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: An identifier that represents the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of resource. - :vartype type: str - :param location: Location of the resource. - :type location: str - :param kind: Required. The kind of workbook. Choices are user and shared. Possible values - include: "Kubernetes". - :type kind: str or ~dnc.models.OrchestratorKind - :param identity: The identity of the orchestrator. - :type identity: ~dnc.models.OrchestratorIdentity - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - :param properties: Properties of the provision operation request. - :type properties: ~dnc.models.OrchestratorResourceProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'OrchestratorIdentity'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'OrchestratorResourceProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Orchestrator, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class OrchestratorIdentity(msrest.serialization.Model): - """OrchestratorIdentity. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal id of the system assigned identity which is used by - orchestrator. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the system assigned identity which is used by orchestrator. - :vartype tenant_id: str - :param type: The type of identity used for orchestrator cluster. Type 'SystemAssigned' will use - an implicitly created identity orchestrator clusters. Possible values include: - "SystemAssigned", "None". - :type type: str or ~dnc.models.ResourceIdentityType - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OrchestratorIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -class OrchestratorResourceProperties(msrest.serialization.Model): - """Properties of orchestrator. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar resource_guid: Resource guid. - :vartype resource_guid: str - :ivar provisioning_state: The current state of orchestratorInstance resource. Possible values - include: "Deleting", "Succeeded", "Failed", "Provisioning". - :vartype provisioning_state: str or ~dnc.models.OrchestratorInstanceState - :param orchestrator_app_id: AAD ID used with apiserver. - :type orchestrator_app_id: str - :param orchestrator_tenant_id: TenantID of server App ID. - :type orchestrator_tenant_id: str - :param cluster_root_ca: RootCA certificate of kubernetes cluster base64 encoded. - :type cluster_root_ca: str - :param api_server_endpoint: K8s APIServer url. Either one of apiServerEndpoint or - privateLinkResourceId can be specified. - :type api_server_endpoint: str - :param private_link_resource_id: private link arm resource id. Either one of apiServerEndpoint - or privateLinkResourceId can be specified. - :type private_link_resource_id: str - :param controller_details: Required. Properties of the controller. - :type controller_details: ~dnc.models.ControllerDetails - """ - - _validation = { - 'resource_guid': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'controller_details': {'required': True}, - } - - _attribute_map = { - 'resource_guid': {'key': 'resourceGuid', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'orchestrator_app_id': {'key': 'orchestratorAppId', 'type': 'str'}, - 'orchestrator_tenant_id': {'key': 'orchestratorTenantId', 'type': 'str'}, - 'cluster_root_ca': {'key': 'clusterRootCA', 'type': 'str'}, - 'api_server_endpoint': {'key': 'apiServerEndpoint', 'type': 'str'}, - 'private_link_resource_id': {'key': 'privateLinkResourceId', 'type': 'str'}, - 'controller_details': {'key': 'controllerDetails', 'type': 'ControllerDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(OrchestratorResourceProperties, self).__init__(**kwargs) - self.resource_guid = None - self.provisioning_state = None - self.orchestrator_app_id = kwargs.get('orchestrator_app_id', None) - self.orchestrator_tenant_id = kwargs.get('orchestrator_tenant_id', None) - self.cluster_root_ca = kwargs.get('cluster_root_ca', None) - self.api_server_endpoint = kwargs.get('api_server_endpoint', None) - self.private_link_resource_id = kwargs.get('private_link_resource_id', None) - self.controller_details = kwargs['controller_details'] - - -class OrchestratorResourceUpdateParameters(msrest.serialization.Model): - """Parameters for updating a resource. - - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(OrchestratorResourceUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class Orchestrators(msrest.serialization.Model): - """An array of OrchestratorInstance resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. An array of OrchestratorInstance resources. - :type value: list[~dnc.models.Orchestrator] - :ivar next_link: The URL to get the next set of orchestrators. - :vartype next_link: str - """ - - _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Orchestrator]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Orchestrators, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = None - - -class ResourceUpdateParameters(msrest.serialization.Model): - """Parameters for updating a resource. - - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class SubnetDetails(msrest.serialization.Model): - """Properties of orchestrator. - - :param id: subnet arm resource id. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SubnetDetails, self).__init__(**kwargs) - self.id = kwargs.get('id', None) diff --git a/src/dnc/azext_dnc/vendored_sdks/dnc/models/_models_py3.py b/src/dnc/azext_dnc/vendored_sdks/dnc/models/_models_py3.py deleted file mode 100644 index 740650a1fae..00000000000 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/models/_models_py3.py +++ /dev/null @@ -1,913 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Dict, List, Optional, Union - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - -from ._dnc_enums import * - - -class ControllerDetails(msrest.serialization.Model): - """controller details. - - :param id: controller arm resource id. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): - super(ControllerDetails, self).__init__(**kwargs) - self.id = id - - -class ControllerResource(msrest.serialization.Model): - """Represents an instance of a resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: An identifier that represents the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of resource. - :vartype type: str - :param location: Location of the resource. - :type location: str - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - super(ControllerResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - - -class ControllerResourceUpdateParameters(msrest.serialization.Model): - """Parameters for updating a resource. - - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - super(ControllerResourceUpdateParameters, self).__init__(**kwargs) - self.tags = tags - - -class DelegatedController(ControllerResource): - """Represents an instance of a DNC controller. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: An identifier that represents the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of resource. - :vartype type: str - :param location: Location of the resource. - :type location: str - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - :ivar properties: Properties of the provision operation request. - :vartype properties: ~dnc.models.DelegatedControllerProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'properties': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'DelegatedControllerProperties'}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - super(DelegatedController, self).__init__(location=location, tags=tags, **kwargs) - self.properties = None - - -class DelegatedControllerProperties(msrest.serialization.Model): - """Properties of Delegated controller resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_guid: Resource guid. - :vartype resource_guid: str - :ivar provisioning_state: The current state of dnc controller resource. Possible values - include: "Deleting", "Succeeded", "Failed", "Provisioning". - :vartype provisioning_state: str or ~dnc.models.ControllerState - :ivar dnc_app_id: dnc application id should be used by customer to authenticate with dnc - gateway. - :vartype dnc_app_id: str - :ivar dnc_tenant_id: tenant id of dnc application id. - :vartype dnc_tenant_id: str - :ivar dnc_endpoint: dnc endpoint url that customers can use to connect to. - :vartype dnc_endpoint: str - """ - - _validation = { - 'resource_guid': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'dnc_app_id': {'readonly': True}, - 'dnc_tenant_id': {'readonly': True}, - 'dnc_endpoint': {'readonly': True}, - } - - _attribute_map = { - 'resource_guid': {'key': 'resourceGuid', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'dnc_app_id': {'key': 'dncAppId', 'type': 'str'}, - 'dnc_tenant_id': {'key': 'dncTenantId', 'type': 'str'}, - 'dnc_endpoint': {'key': 'dncEndpoint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DelegatedControllerProperties, self).__init__(**kwargs) - self.resource_guid = None - self.provisioning_state = None - self.dnc_app_id = None - self.dnc_tenant_id = None - self.dnc_endpoint = None - - -class DelegatedControllers(msrest.serialization.Model): - """An array of Delegated controller resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. An array of Delegated controller resources. - :type value: list[~dnc.models.DelegatedController] - :ivar next_link: The URL to get the next set of controllers. - :vartype next_link: str - """ - - _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DelegatedController]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: List["DelegatedController"], - **kwargs - ): - super(DelegatedControllers, self).__init__(**kwargs) - self.value = value - self.next_link = None - - -class DelegatedSubnetResource(msrest.serialization.Model): - """Represents an instance of a resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: An identifier that represents the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of resource. - :vartype type: str - :param location: Location of the resource. - :type location: str - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - super(DelegatedSubnetResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - - -class DelegatedSubnet(DelegatedSubnetResource): - """Represents an instance of a orchestrator. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: An identifier that represents the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of resource. - :vartype type: str - :param location: Location of the resource. - :type location: str - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - :ivar resource_guid: Resource guid. - :vartype resource_guid: str - :ivar provisioning_state: The current state of dnc delegated subnet resource. Possible values - include: "Deleting", "Succeeded", "Failed", "Provisioning". - :vartype provisioning_state: str or ~dnc.models.DelegatedSubnetState - :param subnet_details: subnet details. - :type subnet_details: ~dnc.models.SubnetDetails - :param controller_details: Properties of the controller. - :type controller_details: ~dnc.models.ControllerDetails - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'resource_guid': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'resource_guid': {'key': 'properties.resourceGuid', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'subnet_details': {'key': 'properties.subnetDetails', 'type': 'SubnetDetails'}, - 'controller_details': {'key': 'properties.controllerDetails', 'type': 'ControllerDetails'}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - subnet_details: Optional["SubnetDetails"] = None, - controller_details: Optional["ControllerDetails"] = None, - **kwargs - ): - super(DelegatedSubnet, self).__init__(location=location, tags=tags, **kwargs) - self.resource_guid = None - self.provisioning_state = None - self.subnet_details = subnet_details - self.controller_details = controller_details - - -class DelegatedSubnets(msrest.serialization.Model): - """An array of DelegatedSubnet resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. An array of DelegatedSubnet resources. - :type value: list[~dnc.models.DelegatedSubnet] - :ivar next_link: The URL to get the next set of DelegatedSubnet resources. - :vartype next_link: str - """ - - _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DelegatedSubnet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: List["DelegatedSubnet"], - **kwargs - ): - super(DelegatedSubnets, self).__init__(**kwargs) - self.value = value - self.next_link = None - - -class ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: object - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(msrest.serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~dnc.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~dnc.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetail]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(msrest.serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - - :param error: The error object. - :type error: ~dnc.models.ErrorDetail - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - *, - error: Optional["ErrorDetail"] = None, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = error - - -class Operation(msrest.serialization.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for data- - plane operations and "false" for ARM/control-plane operations. - :vartype is_data_action: bool - :param display: Localized display information for this particular operation. - :type display: ~dnc.models.OperationDisplay - :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", - "system", "user,system". - :vartype origin: str or ~dnc.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. Possible values include: "Internal". - :vartype action_type: str or ~dnc.models.ActionType - """ - - _validation = { - 'name': {'readonly': True}, - 'is_data_action': {'readonly': True}, - 'origin': {'readonly': True}, - 'action_type': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'action_type': {'key': 'actionType', 'type': 'str'}, - } - - def __init__( - self, - *, - display: Optional["OperationDisplay"] = None, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = None - self.is_data_action = None - self.display = display - self.origin = None - self.action_type = None - - -class OperationDisplay(msrest.serialization.Model): - """Localized display information for this particular operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str - """ - - _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, - 'description': {'readonly': True}, - } - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None - - -class OperationListResult(msrest.serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~dnc.models.Operation] - :ivar next_link: URL to get the next set of operation list results (if there are any). - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class OrchestratorResource(msrest.serialization.Model): - """Represents an instance of a resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: An identifier that represents the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of resource. - :vartype type: str - :param location: Location of the resource. - :type location: str - :param kind: Required. The kind of workbook. Choices are user and shared. Possible values - include: "Kubernetes". - :type kind: str or ~dnc.models.OrchestratorKind - :param identity: The identity of the orchestrator. - :type identity: ~dnc.models.OrchestratorIdentity - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'OrchestratorIdentity'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - kind: Union[str, "OrchestratorKind"], - location: Optional[str] = None, - identity: Optional["OrchestratorIdentity"] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - super(OrchestratorResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.kind = kind - self.identity = identity - self.tags = tags - - -class Orchestrator(OrchestratorResource): - """Represents an instance of a orchestrator. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: An identifier that represents the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of resource. - :vartype type: str - :param location: Location of the resource. - :type location: str - :param kind: Required. The kind of workbook. Choices are user and shared. Possible values - include: "Kubernetes". - :type kind: str or ~dnc.models.OrchestratorKind - :param identity: The identity of the orchestrator. - :type identity: ~dnc.models.OrchestratorIdentity - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - :param properties: Properties of the provision operation request. - :type properties: ~dnc.models.OrchestratorResourceProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'OrchestratorIdentity'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'OrchestratorResourceProperties'}, - } - - def __init__( - self, - *, - kind: Union[str, "OrchestratorKind"], - location: Optional[str] = None, - identity: Optional["OrchestratorIdentity"] = None, - tags: Optional[Dict[str, str]] = None, - properties: Optional["OrchestratorResourceProperties"] = None, - **kwargs - ): - super(Orchestrator, self).__init__(location=location, kind=kind, identity=identity, tags=tags, **kwargs) - self.properties = properties - - -class OrchestratorIdentity(msrest.serialization.Model): - """OrchestratorIdentity. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal id of the system assigned identity which is used by - orchestrator. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the system assigned identity which is used by orchestrator. - :vartype tenant_id: str - :param type: The type of identity used for orchestrator cluster. Type 'SystemAssigned' will use - an implicitly created identity orchestrator clusters. Possible values include: - "SystemAssigned", "None". - :type type: str or ~dnc.models.ResourceIdentityType - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - **kwargs - ): - super(OrchestratorIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type - - -class OrchestratorResourceProperties(msrest.serialization.Model): - """Properties of orchestrator. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar resource_guid: Resource guid. - :vartype resource_guid: str - :ivar provisioning_state: The current state of orchestratorInstance resource. Possible values - include: "Deleting", "Succeeded", "Failed", "Provisioning". - :vartype provisioning_state: str or ~dnc.models.OrchestratorInstanceState - :param orchestrator_app_id: AAD ID used with apiserver. - :type orchestrator_app_id: str - :param orchestrator_tenant_id: TenantID of server App ID. - :type orchestrator_tenant_id: str - :param cluster_root_ca: RootCA certificate of kubernetes cluster base64 encoded. - :type cluster_root_ca: str - :param api_server_endpoint: K8s APIServer url. Either one of apiServerEndpoint or - privateLinkResourceId can be specified. - :type api_server_endpoint: str - :param private_link_resource_id: private link arm resource id. Either one of apiServerEndpoint - or privateLinkResourceId can be specified. - :type private_link_resource_id: str - :param controller_details: Required. Properties of the controller. - :type controller_details: ~dnc.models.ControllerDetails - """ - - _validation = { - 'resource_guid': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'controller_details': {'required': True}, - } - - _attribute_map = { - 'resource_guid': {'key': 'resourceGuid', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'orchestrator_app_id': {'key': 'orchestratorAppId', 'type': 'str'}, - 'orchestrator_tenant_id': {'key': 'orchestratorTenantId', 'type': 'str'}, - 'cluster_root_ca': {'key': 'clusterRootCA', 'type': 'str'}, - 'api_server_endpoint': {'key': 'apiServerEndpoint', 'type': 'str'}, - 'private_link_resource_id': {'key': 'privateLinkResourceId', 'type': 'str'}, - 'controller_details': {'key': 'controllerDetails', 'type': 'ControllerDetails'}, - } - - def __init__( - self, - *, - controller_details: "ControllerDetails", - orchestrator_app_id: Optional[str] = None, - orchestrator_tenant_id: Optional[str] = None, - cluster_root_ca: Optional[str] = None, - api_server_endpoint: Optional[str] = None, - private_link_resource_id: Optional[str] = None, - **kwargs - ): - super(OrchestratorResourceProperties, self).__init__(**kwargs) - self.resource_guid = None - self.provisioning_state = None - self.orchestrator_app_id = orchestrator_app_id - self.orchestrator_tenant_id = orchestrator_tenant_id - self.cluster_root_ca = cluster_root_ca - self.api_server_endpoint = api_server_endpoint - self.private_link_resource_id = private_link_resource_id - self.controller_details = controller_details - - -class OrchestratorResourceUpdateParameters(msrest.serialization.Model): - """Parameters for updating a resource. - - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - super(OrchestratorResourceUpdateParameters, self).__init__(**kwargs) - self.tags = tags - - -class Orchestrators(msrest.serialization.Model): - """An array of OrchestratorInstance resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. An array of OrchestratorInstance resources. - :type value: list[~dnc.models.Orchestrator] - :ivar next_link: The URL to get the next set of orchestrators. - :vartype next_link: str - """ - - _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Orchestrator]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: List["Orchestrator"], - **kwargs - ): - super(Orchestrators, self).__init__(**kwargs) - self.value = value - self.next_link = None - - -class ResourceUpdateParameters(msrest.serialization.Model): - """Parameters for updating a resource. - - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - super(ResourceUpdateParameters, self).__init__(**kwargs) - self.tags = tags - - -class SubnetDetails(msrest.serialization.Model): - """Properties of orchestrator. - - :param id: subnet arm resource id. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): - super(SubnetDetails, self).__init__(**kwargs) - self.id = id diff --git a/src/dnc/azext_dnc/vendored_sdks/dnc/operations/__init__.py b/src/dnc/azext_dnc/vendored_sdks/dnc/operations/__init__.py deleted file mode 100644 index bd4224d51ca..00000000000 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/operations/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._controller_operations import ControllerOperations -from ._delegated_network_operations import DelegatedNetworkOperations -from ._orchestrator_instance_service_operations import OrchestratorInstanceServiceOperations -from ._delegated_subnet_service_operations import DelegatedSubnetServiceOperations -from ._operations import Operations - -__all__ = [ - 'ControllerOperations', - 'DelegatedNetworkOperations', - 'OrchestratorInstanceServiceOperations', - 'DelegatedSubnetServiceOperations', - 'Operations', -] diff --git a/src/dnc/azext_dnc/vendored_sdks/dnc/operations/_controller_operations.py b/src/dnc/azext_dnc/vendored_sdks/dnc/operations/_controller_operations.py deleted file mode 100644 index 86a49c80540..00000000000 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/operations/_controller_operations.py +++ /dev/null @@ -1,421 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ControllerOperations(object): - """ControllerOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~dnc.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def get_details( - self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.DelegatedController" - """Gets details about the specified dnc controller. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DelegatedController, or the result of cls(response) - :rtype: ~dnc.models.DelegatedController - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedController"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - # Construct URL - url = self.get_details.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DelegatedController', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/controller/{resourceName}'} # type: ignore - - def _create_initial( - self, - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "models.DelegatedController" - **kwargs # type: Any - ): - # type: (...) -> "models.DelegatedController" - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedController"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DelegatedController') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('DelegatedController', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('DelegatedController', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/controller/{resourceName}'} # type: ignore - - def begin_create( - self, - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "models.DelegatedController" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["models.DelegatedController"] - """Create a dnc controller. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :param parameters: controller type parameters. - :type parameters: ~dnc.models.DelegatedController - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DelegatedController or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~dnc.models.DelegatedController] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedController"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('DelegatedController', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/controller/{resourceName}'} # type: ignore - - def _delete_initial( - self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/controller/{resourceName}'} # type: ignore - - def begin_delete( - self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """Deletes the DNC controller. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/controller/{resourceName}'} # type: ignore - - def patch( - self, - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "models.ControllerResourceUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "models.DelegatedController" - """Update dnc controller. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :param parameters: controller type parameters. - :type parameters: ~dnc.models.ControllerResourceUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DelegatedController, or the result of cls(response) - :rtype: ~dnc.models.DelegatedController - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedController"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ControllerResourceUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DelegatedController', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/controller/{resourceName}'} # type: ignore diff --git a/src/dnc/azext_dnc/vendored_sdks/dnc/operations/_delegated_network_operations.py b/src/dnc/azext_dnc/vendored_sdks/dnc/operations/_delegated_network_operations.py deleted file mode 100644 index c28211421af..00000000000 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/operations/_delegated_network_operations.py +++ /dev/null @@ -1,186 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class DelegatedNetworkOperations(object): - """DelegatedNetworkOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~dnc.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list_by_subscription( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.DelegatedControllers"] - """Get all the delegatedController resources in a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DelegatedControllers or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~dnc.models.DelegatedControllers] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedControllers"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('DelegatedControllers', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DelegatedNetwork/controllers'} # type: ignore - - def list_by_resource_group( - self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.DelegatedControllers"] - """Get all the delegatedController resources in a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DelegatedControllers or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~dnc.models.DelegatedControllers] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedControllers"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('DelegatedControllers', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/controllers'} # type: ignore diff --git a/src/dnc/azext_dnc/vendored_sdks/dnc/operations/_delegated_subnet_service_operations.py b/src/dnc/azext_dnc/vendored_sdks/dnc/operations/_delegated_subnet_service_operations.py deleted file mode 100644 index b40173b5946..00000000000 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/operations/_delegated_subnet_service_operations.py +++ /dev/null @@ -1,628 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class DelegatedSubnetServiceOperations(object): - """DelegatedSubnetServiceOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~dnc.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def get_details( - self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.DelegatedSubnet" - """Gets details about the specified dnc DelegatedSubnet Link. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DelegatedSubnet, or the result of cls(response) - :rtype: ~dnc.models.DelegatedSubnet - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedSubnet"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - # Construct URL - url = self.get_details.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DelegatedSubnet', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/delegatedSubnets/{resourceName}'} # type: ignore - - def _put_details_initial( - self, - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "models.DelegatedSubnet" - **kwargs # type: Any - ): - # type: (...) -> "models.DelegatedSubnet" - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedSubnet"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._put_details_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DelegatedSubnet') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('DelegatedSubnet', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('DelegatedSubnet', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _put_details_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/delegatedSubnets/{resourceName}'} # type: ignore - - def begin_put_details( - self, - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "models.DelegatedSubnet" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["models.DelegatedSubnet"] - """Put delegated subnet resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :param parameters: Delegated subnet details. - :type parameters: ~dnc.models.DelegatedSubnet - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DelegatedSubnet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~dnc.models.DelegatedSubnet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedSubnet"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._put_details_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('DelegatedSubnet', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/delegatedSubnets/{resourceName}'} # type: ignore - - def _patch_details_initial( - self, - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "models.ResourceUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "models.DelegatedSubnet" - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedSubnet"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._patch_details_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ResourceUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DelegatedSubnet', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _patch_details_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/delegatedSubnets/{resourceName}'} # type: ignore - - def begin_patch_details( - self, - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "models.ResourceUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["models.DelegatedSubnet"] - """Patch delegated subnet resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :param parameters: Delegated subnet details. - :type parameters: ~dnc.models.ResourceUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DelegatedSubnet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~dnc.models.DelegatedSubnet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedSubnet"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._patch_details_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('DelegatedSubnet', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_patch_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/delegatedSubnets/{resourceName}'} # type: ignore - - def _delete_details_initial( - self, - resource_group_name, # type: str - resource_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - # Construct URL - url = self._delete_details_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_details_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/delegatedSubnets/{resourceName}'} # type: ignore - - def begin_delete_details( - self, - resource_group_name, # type: str - resource_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """Delete dnc DelegatedSubnet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :param force_delete: Force delete resource. - :type force_delete: bool - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_details_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - force_delete=force_delete, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/delegatedSubnets/{resourceName}'} # type: ignore - - def list_by_subscription( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.DelegatedSubnets"] - """Get all the DelegatedSubnets resources in a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DelegatedSubnets or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~dnc.models.DelegatedSubnets] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedSubnets"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('DelegatedSubnets', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DelegatedNetwork/delegatedSubnets'} # type: ignore - - def list_by_resource_group( - self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.DelegatedSubnets"] - """Get all the DelegatedSubnets resources in a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DelegatedSubnets or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~dnc.models.DelegatedSubnets] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DelegatedSubnets"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('DelegatedSubnets', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/delegatedSubnets'} # type: ignore diff --git a/src/dnc/azext_dnc/vendored_sdks/dnc/operations/_operations.py b/src/dnc/azext_dnc/vendored_sdks/dnc/operations/_operations.py deleted file mode 100644 index 63a086b1dcb..00000000000 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/operations/_operations.py +++ /dev/null @@ -1,110 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~dnc.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.OperationListResult"] - """Lists all of the available DelegatedNetwork service REST API operations. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~dnc.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/providers/Microsoft.DelegatedNetwork/operations'} # type: ignore diff --git a/src/dnc/azext_dnc/vendored_sdks/dnc/operations/_orchestrator_instance_service_operations.py b/src/dnc/azext_dnc/vendored_sdks/dnc/operations/_orchestrator_instance_service_operations.py deleted file mode 100644 index 7f1135684ba..00000000000 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/operations/_orchestrator_instance_service_operations.py +++ /dev/null @@ -1,569 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class OrchestratorInstanceServiceOperations(object): - """OrchestratorInstanceServiceOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~dnc.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def get_details( - self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.Orchestrator" - """Gets details about the orchestrator instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Orchestrator, or the result of cls(response) - :rtype: ~dnc.models.Orchestrator - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Orchestrator"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - # Construct URL - url = self.get_details.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Orchestrator', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/orchestrators/{resourceName}'} # type: ignore - - def _create_initial( - self, - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "models.Orchestrator" - **kwargs # type: Any - ): - # type: (...) -> "models.Orchestrator" - cls = kwargs.pop('cls', None) # type: ClsType["models.Orchestrator"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Orchestrator') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('Orchestrator', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('Orchestrator', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/orchestrators/{resourceName}'} # type: ignore - - def begin_create( - self, - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "models.Orchestrator" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["models.Orchestrator"] - """Create a orchestrator instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :param parameters: OrchestratorInstance type parameters. - :type parameters: ~dnc.models.Orchestrator - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either Orchestrator or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~dnc.models.Orchestrator] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Orchestrator"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Orchestrator', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/orchestrators/{resourceName}'} # type: ignore - - def _delete_initial( - self, - resource_group_name, # type: str - resource_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/orchestrators/{resourceName}'} # type: ignore - - def begin_delete( - self, - resource_group_name, # type: str - resource_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """Deletes the Orchestrator Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :param force_delete: Force delete resource. - :type force_delete: bool - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - force_delete=force_delete, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/orchestrators/{resourceName}'} # type: ignore - - def patch( - self, - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "models.OrchestratorResourceUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "models.Orchestrator" - """Update Orchestrator Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param resource_name: The name of the resource. It must be a minimum of 3 characters, and a - maximum of 63. - :type resource_name: str - :param parameters: OrchestratorInstance update parameters. - :type parameters: ~dnc.models.OrchestratorResourceUpdateParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Orchestrator, or the result of cls(response) - :rtype: ~dnc.models.Orchestrator - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Orchestrator"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=63, min_length=3, pattern=r'^[a-z][a-z0-9]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'OrchestratorResourceUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Orchestrator', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/orchestrators/{resourceName}'} # type: ignore - - def list_by_subscription( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.Orchestrators"] - """Get all the orchestratorInstance resources in a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Orchestrators or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~dnc.models.Orchestrators] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Orchestrators"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('Orchestrators', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DelegatedNetwork/orchestrators'} # type: ignore - - def list_by_resource_group( - self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.Orchestrators"] - """Get all the OrchestratorInstances resources in a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Orchestrators or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~dnc.models.Orchestrators] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Orchestrators"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-15" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('Orchestrators', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DelegatedNetwork/orchestrators'} # type: ignore diff --git a/src/dnc/azext_dnc/vendored_sdks/dnc/py.typed b/src/dnc/azext_dnc/vendored_sdks/dnc/py.typed deleted file mode 100644 index e5aff4f83af..00000000000 --- a/src/dnc/azext_dnc/vendored_sdks/dnc/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/src/dnc/report.md b/src/dnc/report.md deleted file mode 100644 index 8013ff996e7..00000000000 --- a/src/dnc/report.md +++ /dev/null @@ -1,175 +0,0 @@ -# Azure CLI Module Creation Report - -## EXTENSION -|CLI Extension|Command Groups| -|---------|------------| -|az dnc|[groups](#CommandGroups) - -## GROUPS -### Command groups in `az dnc` extension -|CLI Command Group|Group Swagger name|Commands| -|---------|------------|--------| -|az dnc controller|Controller|[commands](#CommandsInController)| -|az dnc orchestrator-instance-service|OrchestratorInstanceService|[commands](#CommandsInOrchestratorInstanceService)| -|az dnc delegated-subnet-service|DelegatedSubnetService|[commands](#CommandsInDelegatedSubnetService)| - -## COMMANDS -### Commands in `az dnc controller` group -|CLI Command|Operation Swagger name|Parameters|Examples| -|---------|------------|--------|-----------| -|[az dnc controller show](#ControllerGetDetails)|GetDetails|[Parameters](#ParametersControllerGetDetails)|[Example](#ExamplesControllerGetDetails)| -|[az dnc controller create](#ControllerCreate)|Create|[Parameters](#ParametersControllerCreate)|[Example](#ExamplesControllerCreate)| -|[az dnc controller delete](#ControllerDelete)|Delete|[Parameters](#ParametersControllerDelete)|[Example](#ExamplesControllerDelete)| - -### Commands in `az dnc delegated-subnet-service` group -|CLI Command|Operation Swagger name|Parameters|Examples| -|---------|------------|--------|-----------| -|[az dnc delegated-subnet-service show](#DelegatedSubnetServiceGetDetails)|GetDetails|[Parameters](#ParametersDelegatedSubnetServiceGetDetails)|[Example](#ExamplesDelegatedSubnetServiceGetDetails)| -|[az dnc delegated-subnet-service create](#DelegatedSubnetServicePutDetails)|PutDetails|[Parameters](#ParametersDelegatedSubnetServicePutDetails)|[Example](#ExamplesDelegatedSubnetServicePutDetails)| -|[az dnc delegated-subnet-service delete](#DelegatedSubnetServiceDeleteDetails)|DeleteDetails|[Parameters](#ParametersDelegatedSubnetServiceDeleteDetails)|[Example](#ExamplesDelegatedSubnetServiceDeleteDetails)| - -### Commands in `az dnc orchestrator-instance-service` group -|CLI Command|Operation Swagger name|Parameters|Examples| -|---------|------------|--------|-----------| -|[az dnc orchestrator-instance-service show](#OrchestratorInstanceServiceGetDetails)|GetDetails|[Parameters](#ParametersOrchestratorInstanceServiceGetDetails)|[Example](#ExamplesOrchestratorInstanceServiceGetDetails)| -|[az dnc orchestrator-instance-service create](#OrchestratorInstanceServiceCreate)|Create|[Parameters](#ParametersOrchestratorInstanceServiceCreate)|[Example](#ExamplesOrchestratorInstanceServiceCreate)| -|[az dnc orchestrator-instance-service delete](#OrchestratorInstanceServiceDelete)|Delete|[Parameters](#ParametersOrchestratorInstanceServiceDelete)|[Example](#ExamplesOrchestratorInstanceServiceDelete)| - - -## COMMAND DETAILS - -### group `az dnc controller` -#### Command `az dnc controller show` - -##### Example -``` -az dnc controller show --resource-group "TestRG" --resource-name "testcontroller" -``` -##### Parameters -|Option|Type|Description|Path (SDK)|Swagger name| -|------|----|-----------|----------|------------| -|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| -|**--resource-name**|string|The name of the resource. It must be a minimum of 3 characters, and a maximum of 63.|resource_name|resourceName| - -#### Command `az dnc controller create` - -##### Example -``` -az dnc controller create --location "West US" --resource-group "TestRG" --resource-name "testcontroller" -``` -##### Parameters -|Option|Type|Description|Path (SDK)|Swagger name| -|------|----|-----------|----------|------------| -|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| -|**--resource-name**|string|The name of the resource. It must be a minimum of 3 characters, and a maximum of 63.|resource_name|resourceName| -|**--location**|string|Location of the resource.|location|location| -|**--tags**|dictionary|The resource tags.|tags|tags| - -#### Command `az dnc controller delete` - -##### Example -``` -az dnc controller delete --resource-group "TestRG" --resource-name "testcontroller" -``` -##### Parameters -|Option|Type|Description|Path (SDK)|Swagger name| -|------|----|-----------|----------|------------| -|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| -|**--resource-name**|string|The name of the resource. It must be a minimum of 3 characters, and a maximum of 63.|resource_name|resourceName| - -### group `az dnc delegated-subnet-service` -#### Command `az dnc delegated-subnet-service show` - -##### Example -``` -az dnc delegated-subnet-service show --resource-group "TestRG" --resource-name "delegated1" -``` -##### Parameters -|Option|Type|Description|Path (SDK)|Swagger name| -|------|----|-----------|----------|------------| -|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| -|**--resource-name**|string|The name of the resource. It must be a minimum of 3 characters, and a maximum of 63.|resource_name|resourceName| - -#### Command `az dnc delegated-subnet-service create` - -##### Example -``` -az dnc delegated-subnet-service create --location "West US" --id "/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/r\ -esourceGroups/TestRG/providers/Microsoft.DelegatedNetwork/controller/dnctestcontroller" --subnet-details-id \ -"/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.Network/virtualNetworks/\ -testvnet/subnets/testsubnet" --resource-group "TestRG" --resource-name "delegated1" -``` -##### Parameters -|Option|Type|Description|Path (SDK)|Swagger name| -|------|----|-----------|----------|------------| -|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| -|**--resource-name**|string|The name of the resource. It must be a minimum of 3 characters, and a maximum of 63.|resource_name|resourceName| -|**--location**|string|Location of the resource.|location|location| -|**--tags**|dictionary|The resource tags.|tags|tags| -|**--id**|string|controller arm resource id|id|id| -|**--subnet-details-id**|string|subnet arm resource id|subnet_details_id|id| - -#### Command `az dnc delegated-subnet-service delete` - -##### Example -``` -az dnc delegated-subnet-service delete --resource-group "TestRG" --resource-name "delegated1" -``` -##### Parameters -|Option|Type|Description|Path (SDK)|Swagger name| -|------|----|-----------|----------|------------| -|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| -|**--resource-name**|string|The name of the resource. It must be a minimum of 3 characters, and a maximum of 63.|resource_name|resourceName| -|**--force-delete**|boolean|Force delete resource|force_delete|forceDelete| - -### group `az dnc orchestrator-instance-service` -#### Command `az dnc orchestrator-instance-service show` - -##### Example -``` -az dnc orchestrator-instance-service show --resource-group "TestRG" --resource-name "testk8s1" -``` -##### Parameters -|Option|Type|Description|Path (SDK)|Swagger name| -|------|----|-----------|----------|------------| -|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| -|**--resource-name**|string|The name of the resource. It must be a minimum of 3 characters, and a maximum of 63.|resource_name|resourceName| - -#### Command `az dnc orchestrator-instance-service create` - -##### Example -``` -az dnc orchestrator-instance-service create --type "SystemAssigned" --location "West US" --api-server-endpoint \ -"https://testk8s.cloudapp.net" --cluster-root-ca "ddsadsad344mfdsfdl" --id "/subscriptions/613192d7-503f-477a-9cfe-4efc\ -3ee2bd60/resourceGroups/TestRG/providers/Microsoft.DelegatedNetwork/controller/testcontroller" --orchestrator-app-id \ -"546192d7-503f-477a-9cfe-4efc3ee2b6e1" --orchestrator-tenant-id "da6192d7-503f-477a-9cfe-4efc3ee2b6c3" \ ---priv-link-resource-id "/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.\ -Network/privateLinkServices/plresource1" --resource-group "TestRG" --resource-name "testk8s1" -``` -##### Parameters -|Option|Type|Description|Path (SDK)|Swagger name| -|------|----|-----------|----------|------------| -|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| -|**--resource-name**|string|The name of the resource. It must be a minimum of 3 characters, and a maximum of 63.|resource_name|resourceName| -|**--location**|string|Location of the resource.|location|location| -|**--tags**|dictionary|The resource tags.|tags|tags| -|**--type**|sealed-choice|The type of identity used for orchestrator cluster. Type 'SystemAssigned' will use an implicitly created identity orchestrator clusters|type|type| -|**--orchestrator-app-id**|string|AAD ID used with apiserver|orchestrator_app_id|orchestratorAppId| -|**--orchestrator-tenant-id**|string|TenantID of server App ID|orchestrator_tenant_id|orchestratorTenantId| -|**--cluster-root-ca**|string|RootCA certificate of kubernetes cluster base64 encoded|cluster_root_ca|clusterRootCA| -|**--api-server-endpoint**|string|K8s APIServer url. Either one of apiServerEndpoint or privateLinkResourceId can be specified|api_server_endpoint|apiServerEndpoint| -|**--private-link-resource-id**|string|private link arm resource id. Either one of apiServerEndpoint or privateLinkResourceId can be specified|private_link_resource_id|privateLinkResourceId| -|**--id**|string|controller arm resource id|id|id| - -#### Command `az dnc orchestrator-instance-service delete` - -##### Example -``` -az dnc orchestrator-instance-service delete --resource-group "TestRG" --resource-name "k8stest1" -``` -##### Parameters -|Option|Type|Description|Path (SDK)|Swagger name| -|------|----|-----------|----------|------------| -|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| -|**--resource-name**|string|The name of the resource. It must be a minimum of 3 characters, and a maximum of 63.|resource_name|resourceName| -|**--force-delete**|boolean|Force delete resource|force_delete|forceDelete| diff --git a/src/dnc/setup.py b/src/dnc/setup.py index 36c6c1188a3..ef51c6b4c85 100644 --- a/src/dnc/setup.py +++ b/src/dnc/setup.py @@ -1,20 +1,16 @@ -#!/usr/bin/env python - # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools # -------------------------------------------------------------------------------------------- - from codecs import open from setuptools import setup, find_packages + # HISTORY.rst entry. -VERSION = '0.1.3' -try: - from azext_dnc.manual.version import VERSION -except ImportError: - pass +VERSION = '0.2.0' # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers @@ -24,19 +20,14 @@ 'Intended Audience :: System Administrators', 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', 'License :: OSI Approved :: MIT License', ] DEPENDENCIES = [] -try: - from azext_dnc.manual.dependency import DEPENDENCIES -except ImportError: - pass - with open('README.md', 'r', encoding='utf-8') as f: README = f.read() with open('HISTORY.rst', 'r', encoding='utf-8') as f: @@ -45,14 +36,14 @@ setup( name='dnc', version=VERSION, - description='Microsoft Azure Command-Line Tools DNC Extension', + description='Microsoft Azure Command-Line Tools Dnc Extension.', + long_description=README + '\n\n' + HISTORY, + license='MIT', author='Microsoft Corporation', author_email='azpycli@microsoft.com', url='https://github.com/Azure/azure-cli-extensions/tree/main/src/dnc', - long_description=README + '\n\n' + HISTORY, - license='MIT', classifiers=CLASSIFIERS, - packages=find_packages(), - install_requires=DEPENDENCIES, + packages=find_packages(exclude=["tests"]), package_data={'azext_dnc': ['azext_metadata.json']}, + install_requires=DEPENDENCIES )