From 800fd33e6c1624b564538d813dfb22b667f35217 Mon Sep 17 00:00:00 2001 From: Vivian Thiebaut Date: Fri, 17 Mar 2023 11:31:56 -0400 Subject: [PATCH] Generate AAZ hybridconnectivity SDK and remove vendored sdk --- src/ssh/azext_ssh/_client_factory.py | 10 - .../latest/hybrid_connectivity/__cmd_group.py | 20 + .../latest/hybrid_connectivity/__init__.py | 11 + .../endpoint/__cmd_group.py | 20 + .../hybrid_connectivity/endpoint/__init__.py | 13 + .../hybrid_connectivity/endpoint/_create.py | 239 +++++++++ .../endpoint/_list_credential.py | 193 ++++++++ src/ssh/azext_ssh/connectivity_utils.py | 49 +- .../hybridconnectivity/__init__.py | 16 - .../hybridconnectivity/_configuration.py | 68 --- .../_hybrid_connectivity_management_api.py | 71 --- .../hybridconnectivity/aio/__init__.py | 10 - .../hybridconnectivity/aio/_configuration.py | 60 --- .../_hybrid_connectivity_management_api.py | 64 --- .../aio/operations/__init__.py | 15 - .../aio/operations/_endpoints_operations.py | 426 ---------------- .../aio/operations/_operations.py | 105 ---- .../hybridconnectivity/models/__init__.py | 57 --- ...ybrid_connectivity_management_api_enums.py | 58 --- .../hybridconnectivity/models/_models.py | 438 ----------------- .../hybridconnectivity/models/_models_py3.py | 464 ------------------ .../hybridconnectivity/operations/__init__.py | 15 - .../operations/_endpoints_operations.py | 189 ------- .../operations/_operations.py | 110 ----- .../vendored_sdks/hybridconnectivity/py.typed | 1 - 25 files changed, 524 insertions(+), 2198 deletions(-) create mode 100644 src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/__cmd_group.py create mode 100644 src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/__init__.py create mode 100644 src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/endpoint/__cmd_group.py create mode 100644 src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/endpoint/__init__.py create mode 100644 src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/endpoint/_create.py create mode 100644 src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/endpoint/_list_credential.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/__init__.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/_configuration.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/_hybrid_connectivity_management_api.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/aio/__init__.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/aio/_configuration.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/aio/_hybrid_connectivity_management_api.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/aio/operations/__init__.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/aio/operations/_endpoints_operations.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/aio/operations/_operations.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/models/__init__.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/models/_hybrid_connectivity_management_api_enums.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/models/_models.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/models/_models_py3.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/operations/__init__.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/operations/_endpoints_operations.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/operations/_operations.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/py.typed diff --git a/src/ssh/azext_ssh/_client_factory.py b/src/ssh/azext_ssh/_client_factory.py index 8c33c6f3ccb..e41008e5462 100644 --- a/src/ssh/azext_ssh/_client_factory.py +++ b/src/ssh/azext_ssh/_client_factory.py @@ -11,16 +11,6 @@ from azure.cli.core.commands.client_factory import get_mgmt_service_client -def cf_hybridconnectivity_cl(cli_ctx, *_): - from azext_ssh.vendored_sdks.hybridconnectivity import HybridConnectivityManagementAPI - return get_mgmt_service_client(cli_ctx, - HybridConnectivityManagementAPI) - - -def cf_endpoint(cli_ctx, *_): - return cf_hybridconnectivity_cl(cli_ctx).endpoints - - def cf_connectedmachine_cl(cli_ctx, *_): from azext_ssh.vendored_sdks.connectedmachine import ConnectedMachine return get_mgmt_service_client(cli_ctx, diff --git a/src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/__cmd_group.py b/src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/__cmd_group.py new file mode 100644 index 00000000000..daaf4f9fbd4 --- /dev/null +++ b/src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/__cmd_group.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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 * + + +class __CMDGroup(AAZCommandGroup): + """Command group for operations on the Hybrid Connectivity RP. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/__init__.py b/src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/__init__.py new file mode 100644 index 00000000000..5a9d61963d6 --- /dev/null +++ b/src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/__init__.py @@ -0,0 +1,11 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * diff --git a/src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/endpoint/__cmd_group.py b/src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/endpoint/__cmd_group.py new file mode 100644 index 00000000000..d9c09375b2c --- /dev/null +++ b/src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/endpoint/__cmd_group.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# 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 * + + +class __CMDGroup(AAZCommandGroup): + """Endpoint Operations on Hybrid Connectivity RP + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/endpoint/__init__.py b/src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/endpoint/__init__.py new file mode 100644 index 00000000000..3427b0d8b94 --- /dev/null +++ b/src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/endpoint/__init__.py @@ -0,0 +1,13 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._list_credential import * diff --git a/src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/endpoint/_create.py b/src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/endpoint/_create.py new file mode 100644 index 00000000000..e193b5195b7 --- /dev/null +++ b/src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/endpoint/_create.py @@ -0,0 +1,239 @@ +# -------------------------------------------------------------------------------------------- +# 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 * + + +class Create(AAZCommand): + """Create the endpoint to the target resource. + """ + + _aaz_info = { + "version": "2022-05-01-preview", + "resources": [ + ["mgmt-plane", "/{resourceuri}/providers/microsoft.hybridconnectivity/endpoints/{}", "2022-05-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.endpoint_name = AAZStrArg( + options=["--endpoint-name"], + help="The endpoint name.", + required=True, + ) + _args_schema.resource_uri = AAZStrArg( + options=["--resource-uri"], + help="The fully qualified Azure Resource manager identifier of the resource to be connected.", + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.resource_id = AAZStrArg( + options=["--resource-id"], + arg_group="Properties", + help="The resource Id of the connectivity endpoint (optional).", + ) + _args_schema.type = AAZStrArg( + options=["--type"], + arg_group="Properties", + help="The type of endpoint.", + enum={"custom": "custom", "default": "default"}, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.EndpointsCreateOrUpdate(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 EndpointsCreateOrUpdate(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( + "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}", + **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( + "endpointName", self.ctx.args.endpoint_name, + skip_quote=True, + required=True, + ), + **self.serialize_url_param( + "resourceUri", self.ctx.args.resource_uri, + skip_quote=True, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-05-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("resourceId", AAZStrType, ".resource_id") + properties.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"client_flatten": True, "read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.resource_id = AAZStrType( + serialized_name="resourceId", + ) + properties.type = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/endpoint/_list_credential.py b/src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/endpoint/_list_credential.py new file mode 100644 index 00000000000..2ee9e43f2a3 --- /dev/null +++ b/src/ssh/azext_ssh/aaz/latest/hybrid_connectivity/endpoint/_list_credential.py @@ -0,0 +1,193 @@ +# -------------------------------------------------------------------------------------------- +# 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 * + + +class ListCredential(AAZCommand): + """Gets the endpoint access credentials to the resource. + """ + + _aaz_info = { + "version": "2022-05-01-preview", + "resources": [ + ["mgmt-plane", "/{resourceuri}/providers/microsoft.hybridconnectivity/endpoints/{}/listcredentials", "2022-05-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.endpoint_name = AAZStrArg( + options=["--endpoint-name"], + help="The endpoint name.", + required=True, + ) + _args_schema.resource_uri = AAZStrArg( + options=["--resource-uri"], + help="The fully qualified Azure Resource manager identifier of the resource to be connected.", + required=True, + ) + _args_schema.expiresin = AAZIntArg( + options=["--expiresin"], + help="The is how long the endpoint access token is valid (in seconds).", + default=10800, + fmt=AAZIntArgFormat( + maximum=10800, + minimum=600, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.EndpointsListCredentials(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 EndpointsListCredentials(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( + "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listCredentials", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "endpointName", self.ctx.args.endpoint_name, + skip_quote=True, + required=True, + ), + **self.serialize_url_param( + "resourceUri", self.ctx.args.resource_uri, + skip_quote=True, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "expiresin", self.ctx.args.expiresin, + ), + **self.serialize_query_param( + "api-version", "2022-05-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.relay = AAZObjectType( + flags={"client_flatten": True}, + ) + + relay = cls._schema_on_200.relay + relay.access_key = AAZStrType( + serialized_name="accessKey", + flags={"read_only": True}, + ) + relay.expires_on = AAZIntType( + serialized_name="expiresOn", + ) + relay.hybrid_connection_name = AAZStrType( + serialized_name="hybridConnectionName", + flags={"required": True}, + ) + relay.namespace_name = AAZStrType( + serialized_name="namespaceName", + flags={"required": True}, + ) + relay.namespace_name_suffix = AAZStrType( + serialized_name="namespaceNameSuffix", + flags={"required": True}, + ) + + return cls._schema_on_200 + + +class _ListCredentialHelper: + """Helper class for ListCredential""" + + +__all__ = ["ListCredential"] diff --git a/src/ssh/azext_ssh/connectivity_utils.py b/src/ssh/azext_ssh/connectivity_utils.py index 9e99a026f46..b15df91e302 100644 --- a/src/ssh/azext_ssh/connectivity_utils.py +++ b/src/ssh/azext_ssh/connectivity_utils.py @@ -29,28 +29,34 @@ # Get the Access Details to connect to Arc Connectivity platform from the HybridConnectivity RP def get_relay_information(cmd, resource_group, vm_name, resource_type, certificate_validity_in_seconds): - from azext_ssh._client_factory import cf_endpoint - client = cf_endpoint(cmd.cli_ctx) + from .aaz.latest.hybrid_connectivity.endpoint import ListCredential if not certificate_validity_in_seconds or \ certificate_validity_in_seconds > consts.RELAY_INFO_MAXIMUM_DURATION_IN_SECONDS: certificate_validity_in_seconds = consts.RELAY_INFO_MAXIMUM_DURATION_IN_SECONDS + namespace = resource_type.split('/', 1)[0] + arc_type = resource_type.split('/', 1)[1] + az_resource_id = resource_id(subscription=get_subscription_id(cmd.cli_ctx), resource_group=resource_group, + namespace=namespace, type=arc_type, name=vm_name) + + get_args = { + 'resource_uri': az_resource_id, + 'endpoint_name': "default", + 'expiresin': certificate_validity_in_seconds + } + try: t0 = time.time() - result = client.list_credentials(resource_group_name=resource_group, machine_name=vm_name, - resource_type=resource_type, endpoint_name="default", - expiresin=certificate_validity_in_seconds) + result = ListCredential(cli_ctx=cmd.cli_ctx)(command_args=get_args) time_elapsed = time.time() - t0 telemetry.add_extension_event('ssh', {'Context.Default.AzureCLI.SSHListCredentialsTime': time_elapsed}) except ResourceNotFoundError: logger.debug("Default Endpoint couldn't be found. Trying to create Default Endpoint.") - _create_default_endpoint(cmd, resource_group, vm_name, resource_type, client) + _create_default_endpoint(cmd, az_resource_id, vm_name, resource_group) try: t0 = time.time() - result = client.list_credentials(resource_group_name=resource_group, machine_name=vm_name, - resource_type=resource_type, endpoint_name="default", - expiresin=certificate_validity_in_seconds) + result = ListCredential(cli_ctx=cmd.cli_ctx)(command_args=get_args) time_elapsed = time.time() - t0 telemetry.add_extension_event('ssh', {'Context.Default.AzureCLI.SSHListCredentialsTime': time_elapsed}) except Exception as e: @@ -60,14 +66,15 @@ def get_relay_information(cmd, resource_group, vm_name, resource_type, certifica return result -def _create_default_endpoint(cmd, resource_group, vm_name, resource_type, client): - namespace = resource_type.split('/', 1)[0] - arc_type = resource_type.split('/', 1)[1] - az_resource_id = resource_id(subscription=get_subscription_id(cmd.cli_ctx), resource_group=resource_group, - namespace=namespace, type=arc_type, name=vm_name) - endpoint_resource = {"id": az_resource_id, "type_properties_type": "default"} +def _create_default_endpoint(cmd, az_resource_id, vm_name, resource_group): + from .aaz.latest.hybrid_connectivity.endpoint import Create as CreateEndpoint try: - client.create_or_update(resource_group, vm_name, resource_type, "default", endpoint_resource) + get_args = { + 'resource_uri': az_resource_id, + 'endpoint_name': 'default', + 'type': 'default' + } + CreateEndpoint(cli_ctx=cmd.cli_ctx)(command_args=get_args) except Exception as e: colorama.init() raise azclierror.UnauthorizedError(f"Unable to create Default Endpoint for {vm_name} in {resource_group}." @@ -163,11 +170,11 @@ def format_relay_info_string(relay_info): relay_info_string = json.dumps( { "relay": { - "namespaceName": relay_info.namespace_name, - "namespaceNameSuffix": relay_info.namespace_name_suffix, - "hybridConnectionName": relay_info.hybrid_connection_name, - "accessKey": relay_info.access_key, - "expiresOn": relay_info.expires_on + "namespaceName": relay_info["namespaceName"], + "namespaceNameSuffix": relay_info["namespaceNameSuffix"], + "hybridConnectionName": relay_info["hybridConnectionName"], + "accessKey": relay_info["accessKey"], + "expiresOn": relay_info["expiresOn"] } }) result_bytes = relay_info_string.encode("ascii") diff --git a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/__init__.py b/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/__init__.py deleted file mode 100644 index 9d5f8048ff1..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/__init__.py +++ /dev/null @@ -1,16 +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 ._hybrid_connectivity_management_api import HybridConnectivityManagementAPI -__all__ = ['HybridConnectivityManagementAPI'] - -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass diff --git a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/_configuration.py b/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/_configuration.py deleted file mode 100644 index 3d6b6c94096..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/_configuration.py +++ /dev/null @@ -1,68 +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any - - from azure.core.credentials import TokenCredential - -VERSION = "unknown" - -class HybridConnectivityManagementAPIConfiguration(Configuration): - """Configuration for HybridConnectivityManagementAPI. - - 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 - """ - - 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(HybridConnectivityManagementAPIConfiguration, self).__init__(**kwargs) - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2021-10-06-preview" - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'hybridconnectivitymanagementapi/{}'.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/ssh/azext_ssh/vendored_sdks/hybridconnectivity/_hybrid_connectivity_management_api.py b/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/_hybrid_connectivity_management_api.py deleted file mode 100644 index 7b1c37cd7ea..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/_hybrid_connectivity_management_api.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.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 HybridConnectivityManagementAPIConfiguration -from .operations import Operations -from .operations import EndpointsOperations -from . import models - - -class HybridConnectivityManagementAPI(object): - """REST API for Hybrid Connectivity. - - :ivar operations: Operations operations - :vartype operations: hybrid_connectivity_management_api.operations.Operations - :ivar endpoints: EndpointsOperations operations - :vartype endpoints: hybrid_connectivity_management_api.operations.EndpointsOperations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.TokenCredential - :param str base_url: Service URL - """ - - 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 = HybridConnectivityManagementAPIConfiguration(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._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.endpoints = EndpointsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def close(self): - # type: () -> None - self._client.close() - - def __enter__(self): - # type: () -> HybridConnectivityManagementAPI - self._client.__enter__() - return self - - def __exit__(self, *exc_details): - # type: (Any) -> None - self._client.__exit__(*exc_details) diff --git a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/aio/__init__.py b/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/aio/__init__.py deleted file mode 100644 index 785b5445cc3..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/aio/__init__.py +++ /dev/null @@ -1,10 +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 ._hybrid_connectivity_management_api import HybridConnectivityManagementAPI -__all__ = ['HybridConnectivityManagementAPI'] diff --git a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/aio/_configuration.py b/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/aio/_configuration.py deleted file mode 100644 index 41f28de96ba..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/aio/_configuration.py +++ /dev/null @@ -1,60 +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -VERSION = "unknown" - -class HybridConnectivityManagementAPIConfiguration(Configuration): - """Configuration for HybridConnectivityManagementAPI. - - 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 - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - **kwargs: Any - ) -> None: - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - super(HybridConnectivityManagementAPIConfiguration, self).__init__(**kwargs) - - self.credential = credential - self.api_version = "2021-10-06-preview" - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'hybridconnectivitymanagementapi/{}'.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/ssh/azext_ssh/vendored_sdks/hybridconnectivity/aio/_hybrid_connectivity_management_api.py b/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/aio/_hybrid_connectivity_management_api.py deleted file mode 100644 index 837237055a5..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/aio/_hybrid_connectivity_management_api.py +++ /dev/null @@ -1,64 +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 HybridConnectivityManagementAPIConfiguration -from .operations import Operations -from .operations import EndpointsOperations -from .. import models - - -class HybridConnectivityManagementAPI(object): - """REST API for Hybrid Connectivity. - - :ivar operations: Operations operations - :vartype operations: hybrid_connectivity_management_api.aio.operations.Operations - :ivar endpoints: EndpointsOperations operations - :vartype endpoints: hybrid_connectivity_management_api.aio.operations.EndpointsOperations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param str base_url: Service URL - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - base_url: Optional[str] = None, - **kwargs: Any - ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = HybridConnectivityManagementAPIConfiguration(credential, **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._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.endpoints = EndpointsOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "HybridConnectivityManagementAPI": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details) -> None: - await self._client.__aexit__(*exc_details) diff --git a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/aio/operations/__init__.py b/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/aio/operations/__init__.py deleted file mode 100644 index d9149323f40..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/aio/operations/__init__.py +++ /dev/null @@ -1,15 +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 ._operations import Operations -from ._endpoints_operations import EndpointsOperations - -__all__ = [ - 'Operations', - 'EndpointsOperations', -] diff --git a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/aio/operations/_endpoints_operations.py b/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/aio/operations/_endpoints_operations.py deleted file mode 100644 index 16f77d06ff6..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/aio/operations/_endpoints_operations.py +++ /dev/null @@ -1,426 +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 EndpointsOperations: - """EndpointsOperations 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: ~hybrid_connectivity_management_api.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, - resource_uri: str, - **kwargs - ) -> AsyncIterable["models.EndpointsList"]: - """List of endpoints to the target resource. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. - :type resource_uri: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EndpointsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~hybrid_connectivity_management_api.models.EndpointsList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.EndpointsList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-06-preview" - 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 - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - } - 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('EndpointsList', 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': '/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints'} # type: ignore - - async def get( - self, - resource_uri: str, - endpoint_name: str, - **kwargs - ) -> "models.EndpointResource": - """Gets the endpoint to the resource. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. - :type resource_uri: str - :param endpoint_name: The endpoint name. - :type endpoint_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EndpointResource, or the result of cls(response) - :rtype: ~hybrid_connectivity_management_api.models.EndpointResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.EndpointResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-06-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str', skip_quote=True), - } - 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('EndpointResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}'} # type: ignore - - async def create_or_update( - self, - resource_uri: str, - endpoint_name: str, - endpoint_resource: "models.EndpointResource", - **kwargs - ) -> "models.EndpointResource": - """Create or update the endpoint to the target resource. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. - :type resource_uri: str - :param endpoint_name: The endpoint name. - :type endpoint_name: str - :param endpoint_resource: Endpoint details. - :type endpoint_resource: ~hybrid_connectivity_management_api.models.EndpointResource - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EndpointResource, or the result of cls(response) - :rtype: ~hybrid_connectivity_management_api.models.EndpointResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.EndpointResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-06-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str', skip_quote=True), - } - 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(endpoint_resource, 'EndpointResource') - 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]: - 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('EndpointResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create_or_update.metadata = {'url': '/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}'} # type: ignore - - async def update( - self, - resource_uri: str, - endpoint_name: str, - endpoint_resource: "models.EndpointResource", - **kwargs - ) -> "models.EndpointResource": - """Update the endpoint to the target resource. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. - :type resource_uri: str - :param endpoint_name: The endpoint name. - :type endpoint_name: str - :param endpoint_resource: Endpoint details. - :type endpoint_resource: ~hybrid_connectivity_management_api.models.EndpointResource - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EndpointResource, or the result of cls(response) - :rtype: ~hybrid_connectivity_management_api.models.EndpointResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.EndpointResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-06-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str', skip_quote=True), - } - 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(endpoint_resource, 'EndpointResource') - 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('EndpointResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - update.metadata = {'url': '/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}'} # type: ignore - - async def delete( - self, - resource_uri: str, - endpoint_name: str, - **kwargs - ) -> None: - """Deletes the endpoint access to the target resource. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. - :type resource_uri: str - :param endpoint_name: The endpoint name. - :type endpoint_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - 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-10-06-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str', skip_quote=True), - } - 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, 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.metadata = {'url': '/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}'} # type: ignore - - async def list_credentials( - self, - resource_uri: str, - endpoint_name: str, - expiresin: Optional[int] = 10800, - **kwargs - ) -> "models.EndpointAccessResource": - """Gets the endpoint access credentials to the resource. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. - :type resource_uri: str - :param endpoint_name: The endpoint name. - :type endpoint_name: str - :param expiresin: The is how long the endpoint access token is valid (in seconds). - :type expiresin: long - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EndpointAccessResource, or the result of cls(response) - :rtype: ~hybrid_connectivity_management_api.models.EndpointAccessResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.EndpointAccessResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-06-preview" - accept = "application/json" - - # Construct URL - url = self.list_credentials.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str', skip_quote=True), - } - 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 expiresin is not None: - query_parameters['expiresin'] = self._serialize.query("expiresin", expiresin, 'long', maximum=10800, minimum=600) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(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('EndpointAccessResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - list_credentials.metadata = {'url': '/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listCredentials'} # type: ignore diff --git a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/aio/operations/_operations.py b/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/aio/operations/_operations.py deleted file mode 100644 index e06178d99d0..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/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: ~hybrid_connectivity_management_api.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 the available Hybrid Connectivity 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[~hybrid_connectivity_management_api.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-10-06-preview" - 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.HybridConnectivity/operations'} # type: ignore diff --git a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/models/__init__.py b/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/models/__init__.py deleted file mode 100644 index a60914d57d3..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/models/__init__.py +++ /dev/null @@ -1,57 +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 EndpointAccessResource - from ._models_py3 import EndpointResource - from ._models_py3 import EndpointsList - 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 ProxyResource - from ._models_py3 import Resource -except (SyntaxError, ImportError): - from ._models import EndpointAccessResource # type: ignore - from ._models import EndpointResource # type: ignore - from ._models import EndpointsList # 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 ProxyResource # type: ignore - from ._models import Resource # type: ignore - -from ._hybrid_connectivity_management_api_enums import ( - ActionType, - CreatedByType, - Origin, - Type, -) - -__all__ = [ - 'EndpointAccessResource', - 'EndpointResource', - 'EndpointsList', - 'ErrorAdditionalInfo', - 'ErrorDetail', - 'ErrorResponse', - 'Operation', - 'OperationDisplay', - 'OperationListResult', - 'ProxyResource', - 'Resource', - 'ActionType', - 'CreatedByType', - 'Origin', - 'Type', -] diff --git a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/models/_hybrid_connectivity_management_api_enums.py b/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/models/_hybrid_connectivity_management_api_enums.py deleted file mode 100644 index fa857d49db8..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/models/_hybrid_connectivity_management_api_enums.py +++ /dev/null @@ -1,58 +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 CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The type of identity that created the resource. - """ - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - -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 Type(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The type of endpoint. - """ - - DEFAULT = "default" - CUSTOM = "custom" diff --git a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/models/_models.py b/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/models/_models.py deleted file mode 100644 index 1dd6479ee07..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/models/_models.py +++ /dev/null @@ -1,438 +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 EndpointAccessResource(msrest.serialization.Model): - """The endpoint access for the target resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param namespace_name: The namespace name. - :type namespace_name: str - :param namespace_name_suffix: The suffix domain name of relay namespace. - :type namespace_name_suffix: str - :param hybrid_connection_name: Azure Relay hybrid connection name for the resource. - :type hybrid_connection_name: str - :ivar access_key: Access key for hybrid connection. - :vartype access_key: str - :param expires_on: The expiration of access key in unix time. - :type expires_on: long - """ - - _validation = { - 'namespace_name': {'max_length': 200, 'min_length': 1}, - 'namespace_name_suffix': {'max_length': 100, 'min_length': 1}, - 'access_key': {'readonly': True}, - } - - _attribute_map = { - 'namespace_name': {'key': 'relay.namespaceName', 'type': 'str'}, - 'namespace_name_suffix': {'key': 'relay.namespaceNameSuffix', 'type': 'str'}, - 'hybrid_connection_name': {'key': 'relay.hybridConnectionName', 'type': 'str'}, - 'access_key': {'key': 'relay.accessKey', 'type': 'str'}, - 'expires_on': {'key': 'relay.expiresOn', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(EndpointAccessResource, self).__init__(**kwargs) - self.namespace_name = kwargs.get('namespace_name', None) - self.namespace_name_suffix = kwargs.get('namespace_name_suffix', None) - self.hybrid_connection_name = kwargs.get('hybrid_connection_name', None) - self.access_key = None - self.expires_on = kwargs.get('expires_on', None) - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: 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'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class EndpointResource(Resource): - """The endpoint for the target resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param type_properties_type: The type of endpoint. Possible values include: "default", - "custom". - :type type_properties_type: str or ~hybrid_connectivity_management_api.models.Type - :param resource_id: The resource Id of the connectivity endpoint (optional). - :type resource_id: str - :ivar provisioning_state: - :vartype provisioning_state: str - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~hybrid_connectivity_management_api.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~hybrid_connectivity_management_api.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'created_by': {'key': 'systemData.createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'systemData.createdByType', 'type': 'str'}, - 'created_at': {'key': 'systemData.createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'systemData.lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'systemData.lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'systemData.lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(EndpointResource, self).__init__(**kwargs) - self.type_properties_type = kwargs.get('type_properties_type', None) - self.resource_id = kwargs.get('resource_id', None) - self.provisioning_state = None - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class EndpointsList(msrest.serialization.Model): - """The list of endpoints. - - :param next_link: The link used to get the next page of endpoints list. - :type next_link: str - :param value: The list of endpoint. - :type value: list[~hybrid_connectivity_management_api.models.EndpointResource] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[EndpointResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(EndpointsList, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', 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[~hybrid_connectivity_management_api.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~hybrid_connectivity_management_api.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: ~hybrid_connectivity_management_api.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: ~hybrid_connectivity_management_api.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 ~hybrid_connectivity_management_api.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 ~hybrid_connectivity_management_api.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[~hybrid_connectivity_management_api.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 ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: 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'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) diff --git a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/models/_models_py3.py b/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/models/_models_py3.py deleted file mode 100644 index 97400905724..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/models/_models_py3.py +++ /dev/null @@ -1,464 +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. -# -------------------------------------------------------------------------- - -import datetime -from typing import List, Optional, Union - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - -from ._hybrid_connectivity_management_api_enums import * - - -class EndpointAccessResource(msrest.serialization.Model): - """The endpoint access for the target resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param namespace_name: The namespace name. - :type namespace_name: str - :param namespace_name_suffix: The suffix domain name of relay namespace. - :type namespace_name_suffix: str - :param hybrid_connection_name: Azure Relay hybrid connection name for the resource. - :type hybrid_connection_name: str - :ivar access_key: Access key for hybrid connection. - :vartype access_key: str - :param expires_on: The expiration of access key in unix time. - :type expires_on: long - """ - - _validation = { - 'namespace_name': {'max_length': 200, 'min_length': 1}, - 'namespace_name_suffix': {'max_length': 100, 'min_length': 1}, - 'access_key': {'readonly': True}, - } - - _attribute_map = { - 'namespace_name': {'key': 'relay.namespaceName', 'type': 'str'}, - 'namespace_name_suffix': {'key': 'relay.namespaceNameSuffix', 'type': 'str'}, - 'hybrid_connection_name': {'key': 'relay.hybridConnectionName', 'type': 'str'}, - 'access_key': {'key': 'relay.accessKey', 'type': 'str'}, - 'expires_on': {'key': 'relay.expiresOn', 'type': 'long'}, - } - - def __init__( - self, - *, - namespace_name: Optional[str] = None, - namespace_name_suffix: Optional[str] = None, - hybrid_connection_name: Optional[str] = None, - expires_on: Optional[int] = None, - **kwargs - ): - super(EndpointAccessResource, self).__init__(**kwargs) - self.namespace_name = namespace_name - self.namespace_name_suffix = namespace_name_suffix - self.hybrid_connection_name = hybrid_connection_name - self.access_key = None - self.expires_on = expires_on - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: 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'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class EndpointResource(Resource): - """The endpoint for the target resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param type_properties_type: The type of endpoint. Possible values include: "default", - "custom". - :type type_properties_type: str or ~hybrid_connectivity_management_api.models.Type - :param resource_id: The resource Id of the connectivity endpoint (optional). - :type resource_id: str - :ivar provisioning_state: - :vartype provisioning_state: str - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~hybrid_connectivity_management_api.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~hybrid_connectivity_management_api.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'created_by': {'key': 'systemData.createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'systemData.createdByType', 'type': 'str'}, - 'created_at': {'key': 'systemData.createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'systemData.lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'systemData.lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'systemData.lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - *, - type_properties_type: Optional[Union[str, "Type"]] = None, - resource_id: Optional[str] = None, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): - super(EndpointResource, self).__init__(**kwargs) - self.type_properties_type = type_properties_type - self.resource_id = resource_id - self.provisioning_state = None - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - -class EndpointsList(msrest.serialization.Model): - """The list of endpoints. - - :param next_link: The link used to get the next page of endpoints list. - :type next_link: str - :param value: The list of endpoint. - :type value: list[~hybrid_connectivity_management_api.models.EndpointResource] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[EndpointResource]'}, - } - - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[List["EndpointResource"]] = None, - **kwargs - ): - super(EndpointsList, self).__init__(**kwargs) - self.next_link = next_link - self.value = value - - -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[~hybrid_connectivity_management_api.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~hybrid_connectivity_management_api.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: ~hybrid_connectivity_management_api.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: ~hybrid_connectivity_management_api.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 ~hybrid_connectivity_management_api.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 ~hybrid_connectivity_management_api.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[~hybrid_connectivity_management_api.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 ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: 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'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) diff --git a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/operations/__init__.py b/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/operations/__init__.py deleted file mode 100644 index d9149323f40..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/operations/__init__.py +++ /dev/null @@ -1,15 +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 ._operations import Operations -from ._endpoints_operations import EndpointsOperations - -__all__ = [ - 'Operations', - 'EndpointsOperations', -] diff --git a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/operations/_endpoints_operations.py b/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/operations/_endpoints_operations.py deleted file mode 100644 index e49a08fe5a9..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/operations/_endpoints_operations.py +++ /dev/null @@ -1,189 +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 EndpointsOperations(object): - """EndpointsOperations 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: ~hybrid_connectivity_management_api.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 create_or_update( - self, - resource_group_name, # type: str - machine_name, # type: str - resource_type, #type: str - endpoint_name, # type: str - endpoint_resource, # type: "models.EndpointResource" - **kwargs # type: Any - ): - # type: (...) -> "models.EndpointResource" - """Create or update the endpoint to the target resource. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. - :type resource_uri: str - :param endpoint_name: The endpoint name. - :type endpoint_name: str - :param endpoint_resource: Endpoint details. - :type endpoint_resource: ~hybrid_connectivity_management_api.models.EndpointResource - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EndpointResource, or the result of cls(response) - :rtype: ~hybrid_connectivity_management_api.models.EndpointResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.EndpointResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-06-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_name, 'str'), - 'resourceType': self._serialize.url("resource_type", resource_type, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str', skip_quote=True), - } - 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(endpoint_resource, 'EndpointResource') - 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]: - 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('EndpointResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceType}/{machineName}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}'} # type: ignore - - def list_credentials( - self, - resource_group_name, # type: str - machine_name, # type: str - resource_type, # type: str - endpoint_name, # type: str - expiresin=10800, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> "models.EndpointAccessResource" - """Gets the endpoint access credentials to the resource. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. - :type resource_uri: str - :param endpoint_name: The endpoint name. - :type endpoint_name: str - :param expiresin: The is how long the endpoint access token is valid (in seconds). - :type expiresin: long - :keyword callable cls: A custom type or function that will be passed the direct response - :return: EndpointAccessResource, or the result of cls(response) - :rtype: ~hybrid_connectivity_management_api.models.EndpointAccessResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.EndpointAccessResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-10-06-preview" - accept = "application/json" - - # Construct URL - url = self.list_credentials.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_name, 'str'), - 'resourceType': self._serialize.url("resource_type", resource_type, 'str', min_length=1), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str', skip_quote=True), - } - 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 expiresin is not None: - query_parameters['expiresin'] = self._serialize.query("expiresin", expiresin, 'long', maximum=10800, minimum=600) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(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('EndpointAccessResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - list_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceType}/{machineName}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listCredentials'} # type: ignore diff --git a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/operations/_operations.py b/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/operations/_operations.py deleted file mode 100644 index 02d52e6a4f6..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/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: ~hybrid_connectivity_management_api.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 the available Hybrid Connectivity 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[~hybrid_connectivity_management_api.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-10-06-preview" - 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.HybridConnectivity/operations'} # type: ignore diff --git a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/py.typed b/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/py.typed deleted file mode 100644 index e5aff4f83af..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/hybridconnectivity/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file