From 09f5681382f3e50958184c05e27c187d837d7ba3 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 8 Oct 2024 01:14:39 +0000 Subject: [PATCH] CodeGen from PR 30823 in Azure/azure-rest-api-specs Merge 9b1e6015182a01529d7f7ff2d3dccff65e197c4d into 012021c786c360e0c34faf7af888c7fd7dbe2df5 --- .../azure-mgmt-hybridconnectivity/README.md | 7 +- .../azure-mgmt-hybridconnectivity/_meta.json | 10 +- .../mgmt/hybridconnectivity/_configuration.py | 18 +- .../_hybrid_connectivity_mgmt_client.py | 86 +- .../mgmt/hybridconnectivity/_serialization.py | 94 +- .../azure/mgmt/hybridconnectivity/_vendor.py | 16 - .../azure/mgmt/hybridconnectivity/_version.py | 2 +- .../hybridconnectivity/aio/_configuration.py | 18 +- .../aio/_hybrid_connectivity_mgmt_client.py | 88 +- .../aio/operations/__init__.py | 10 + .../aio/operations/_endpoints_operations.py | 254 +-- .../_generate_aws_template_operations.py | 163 ++ .../aio/operations/_inventory_operations.py | 201 +++ .../aio/operations/_operations.py | 37 +- .../_public_cloud_connectors_operations.py | 798 +++++++++ .../_service_configurations_operations.py | 149 +- .../_solution_configurations_operations.py | 636 +++++++ .../operations/_solution_types_operations.py | 277 +++ .../hybridconnectivity/models/__init__.py | 64 + .../_hybrid_connectivity_mgmt_client_enums.py | 58 + .../hybridconnectivity/models/_models_py3.py | 1580 ++++++++++++++--- .../hybridconnectivity/operations/__init__.py | 10 + .../operations/_endpoints_operations.py | 272 ++- .../_generate_aws_template_operations.py | 195 ++ .../operations/_inventory_operations.py | 265 +++ .../operations/_operations.py | 39 +- .../_public_cloud_connectors_operations.py | 1026 +++++++++++ .../_service_configurations_operations.py | 159 +- .../_solution_configurations_operations.py | 809 +++++++++ .../operations/_solution_types_operations.py | 362 ++++ .../endpoints_delete_default.py | 4 +- .../generated_samples/endpoints_get_custom.py | 4 +- .../endpoints_get_default.py | 4 +- .../generated_samples/endpoints_list.py | 4 +- .../endpoints_post_list_credentials.py | 4 +- ...s_post_list_ingress_gateway_credentials.py | 4 +- ...tails.py => generate_aws_template_post.py} | 15 +- ...ints_patch_default.py => inventory_get.py} | 14 +- ...nventory_list_by_solution_configuration.py | 43 + .../generated_samples/operations_list.py | 4 +- ...blic_cloud_connectors_create_or_update.py} | 28 +- .../public_cloud_connectors_delete.py | 41 + ...ault.py => public_cloud_connectors_get.py} | 13 +- ...cloud_connectors_list_by_resource_group.py | 42 + ...c_cloud_connectors_list_by_subscription.py | 40 + ...ublic_cloud_connectors_test_permissions.py | 42 + ...h.py => public_cloud_connectors_update.py} | 15 +- .../service_configurations_delete_ssh.py | 4 +- .../service_configurations_get_ssh.py | 4 +- .../service_configurations_get_wac.py | 4 +- .../service_configurations_list.py | 4 +- .../service_configurations_put_ssh.py | 42 - .../service_configurations_put_wac.py | 42 - ...olution_configurations_create_or_update.py | 43 + .../solution_configurations_delete.py | 41 + .../solution_configurations_get.py | 42 + .../solution_configurations_list.py | 42 + .../solution_configurations_sync_now.py | 42 + .../solution_configurations_update.py | 43 + .../generated_samples/solution_types_get.py | 42 + .../solution_types_list_by_resource_group.py | 42 + .../solution_types_list_by_subscription.py | 40 + .../generated_tests/conftest.py | 41 + ..._connectivity_mgmt_endpoints_operations.py | 143 ++ ...ctivity_mgmt_endpoints_operations_async.py | 144 ++ ...y_mgmt_generate_aws_template_operations.py | 33 + ..._generate_aws_template_operations_async.py | 34 + ..._connectivity_mgmt_inventory_operations.py | 44 + ...ctivity_mgmt_inventory_operations_async.py | 45 + ...est_hybrid_connectivity_mgmt_operations.py | 29 + ...brid_connectivity_mgmt_operations_async.py | 30 + ...mgmt_public_cloud_connectors_operations.py | 140 ++ ...ublic_cloud_connectors_operations_async.py | 145 ++ ..._mgmt_service_configurations_operations.py | 101 ++ ...service_configurations_operations_async.py | 102 ++ ...mgmt_solution_configurations_operations.py | 125 ++ ...olution_configurations_operations_async.py | 128 ++ ...ectivity_mgmt_solution_types_operations.py | 52 + ...ty_mgmt_solution_types_operations_async.py | 53 + .../azure-mgmt-hybridconnectivity/setup.py | 12 +- 80 files changed, 8871 insertions(+), 1031 deletions(-) delete mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_vendor.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_generate_aws_template_operations.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_inventory_operations.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_public_cloud_connectors_operations.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_solution_configurations_operations.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_solution_types_operations.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_generate_aws_template_operations.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_inventory_operations.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_public_cloud_connectors_operations.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_solution_configurations_operations.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_solution_types_operations.py rename sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/{endpoints_post_list_managed_proxy_details.py => generate_aws_template_post.py} (71%) rename sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/{endpoints_patch_default.py => inventory_get.py} (75%) create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/inventory_list_by_solution_configuration.py rename sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/{endpoints_put_custom.py => public_cloud_connectors_create_or_update.py} (62%) create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_delete.py rename sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/{endpoints_put_default.py => public_cloud_connectors_get.py} (75%) create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_list_by_resource_group.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_list_by_subscription.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_test_permissions.py rename sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/{service_configurations_patch_ssh.py => public_cloud_connectors_update.py} (70%) delete mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_put_ssh.py delete mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_put_wac.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_create_or_update.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_delete.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_get.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_list.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_sync_now.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_update.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_types_get.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_types_list_by_resource_group.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_types_list_by_subscription.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/conftest.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_endpoints_operations.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_endpoints_operations_async.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_generate_aws_template_operations.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_generate_aws_template_operations_async.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_inventory_operations.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_inventory_operations_async.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_operations.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_operations_async.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_public_cloud_connectors_operations.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_public_cloud_connectors_operations_async.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_service_configurations_operations.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_service_configurations_operations_async.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_solution_configurations_operations.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_solution_configurations_operations_async.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_solution_types_operations.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_solution_types_operations_async.py diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/README.md b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/README.md index b6cfc82b249b..5d2e1bf91acb 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/README.md +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Hybridconnectivity Management Client Library. -This package has been tested with Python 3.7+. +This package has been tested with Python 3.8+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.7+ is required to use this package. +- Python 3.8+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -59,6 +59,3 @@ Code samples for this package can be found at: If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) section of the project. - - -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-hybridconnectivity%2FREADME.png) diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/_meta.json b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/_meta.json index 53d2b531f65b..7e76b3e9c2e4 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/_meta.json +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/_meta.json @@ -1,11 +1,11 @@ { - "commit": "95c0363e4cae8756c6a33b58add67776db427bbc", + "commit": "9abd4911b40c960dde0a90e23574f6e6d047a631", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.7", + "autorest": "3.10.2", "use": [ - "@autorest/python@6.7.1", - "@autorest/modelerfour@4.26.2" + "@autorest/python@6.19.0", + "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/hybridconnectivity/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/hybridconnectivity/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/hybridconnectivity/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_configuration.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_configuration.py index 3ced6c9de2d3..6353587cd308 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_configuration.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -19,7 +18,7 @@ from azure.core.credentials import TokenCredential -class HybridConnectivityMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class HybridConnectivityMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for HybridConnectivityMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -27,22 +26,27 @@ class HybridConnectivityMgmtClientConfiguration(Configuration): # pylint: disab :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. Default value is "2023-03-15". Note that overriding this + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2024-12-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: - super(HybridConnectivityMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-03-15") + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2024-12-01") 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.") self.credential = credential + self.subscription_id = subscription_id self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-hybridconnectivity/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -51,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: 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.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = ARMChallengeAuthenticationPolicy( diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_hybrid_connectivity_mgmt_client.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_hybrid_connectivity_mgmt_client.py index 54cf62c5c72e..66681ed828b5 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_hybrid_connectivity_mgmt_client.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_hybrid_connectivity_mgmt_client.py @@ -8,23 +8,48 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self +from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from . import models as _models from ._configuration import HybridConnectivityMgmtClientConfiguration from ._serialization import Deserializer, Serializer -from .operations import EndpointsOperations, Operations, ServiceConfigurationsOperations +from .operations import ( + EndpointsOperations, + GenerateAwsTemplateOperations, + InventoryOperations, + Operations, + PublicCloudConnectorsOperations, + ServiceConfigurationsOperations, + SolutionConfigurationsOperations, + SolutionTypesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class HybridConnectivityMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """REST API for Hybrid Connectivity. - +class HybridConnectivityMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """REST API for public clouds. + + :ivar solution_configurations: SolutionConfigurationsOperations operations + :vartype solution_configurations: + azure.mgmt.hybridconnectivity.operations.SolutionConfigurationsOperations + :ivar inventory: InventoryOperations operations + :vartype inventory: azure.mgmt.hybridconnectivity.operations.InventoryOperations + :ivar generate_aws_template: GenerateAwsTemplateOperations operations + :vartype generate_aws_template: + azure.mgmt.hybridconnectivity.operations.GenerateAwsTemplateOperations + :ivar public_cloud_connectors: PublicCloudConnectorsOperations operations + :vartype public_cloud_connectors: + azure.mgmt.hybridconnectivity.operations.PublicCloudConnectorsOperations + :ivar solution_types: SolutionTypesOperations operations + :vartype solution_types: azure.mgmt.hybridconnectivity.operations.SolutionTypesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.hybridconnectivity.operations.Operations :ivar endpoints: EndpointsOperations operations @@ -34,30 +59,69 @@ class HybridConnectivityMgmtClient: # pylint: disable=client-accepts-api-versio azure.mgmt.hybridconnectivity.operations.ServiceConfigurationsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-03-15". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-12-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( - self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any ) -> None: - self._config = HybridConnectivityMgmtClientConfiguration(credential=credential, **kwargs) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._config = HybridConnectivityMgmtClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **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._serialize.client_side_validation = False + self.solution_configurations = SolutionConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.inventory = InventoryOperations(self._client, self._config, self._serialize, self._deserialize) + self.generate_aws_template = GenerateAwsTemplateOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.public_cloud_connectors = PublicCloudConnectorsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.solution_types = SolutionTypesOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.endpoints = EndpointsOperations(self._client, self._config, self._serialize, self._deserialize) self.service_configurations = ServiceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -77,12 +141,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() - def __enter__(self) -> "HybridConnectivityMgmtClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_serialization.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_serialization.py index 4bae2292227b..8139854b97bb 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_serialization.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_serialization.py @@ -63,8 +63,8 @@ import isodate # type: ignore -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -from azure.core.serialization import NULL as AzureCoreNull +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") @@ -124,7 +124,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + except ET.ParseError as err: # It might be because the server has an issue, and returned JSON with # content-type XML.... # So let's try a JSON load, and if it's still broken @@ -143,7 +143,9 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -170,13 +172,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -295,7 +290,7 @@ class Model(object): _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Dict[str, Any] = {} + self.additional_properties: Optional[Dict[str, Any]] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -340,7 +335,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to azure from this model. + """Return the JSON that would be sent to server from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -351,7 +346,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore def as_dict( self, @@ -390,7 +385,7 @@ def my_key_transformer(key, attr_desc, value): :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore @classmethod def _infer_class_models(cls): @@ -415,7 +410,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( @@ -445,7 +440,7 @@ def from_dict( if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -545,7 +540,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +556,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +644,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -668,7 +663,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err else: return serialized @@ -710,7 +705,7 @@ def body(self, data, data_type, **kwargs): ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) @@ -730,6 +725,7 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") except SerializationError: @@ -744,7 +740,7 @@ def query(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :keyword bool skip_quote: Whether to skip quote the serialized result. Defaults to False. - :rtype: str + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -753,7 +749,7 @@ def query(self, name, data, data_type, **kwargs): if data_type.startswith("["): internal_data_type = data_type[1:-1] do_quote = not kwargs.get("skip_quote", False) - return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -804,7 +800,7 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: - if data is AzureCoreNull: + if data is CoreNull: return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -824,7 +820,7 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) + raise SerializationError(msg.format(data, data_type)) from err else: return self._serialize(data, **kwargs) @@ -993,7 +989,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1170,10 +1166,10 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod def serialize_unix(attr, **kwargs): @@ -1209,7 +1205,6 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1230,7 +1225,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1371,7 +1365,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1391,7 +1385,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1444,12 +1438,12 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore @@ -1481,7 +1475,7 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: additional_properties = self._build_additional_properties(attributes, data) return self._instantiate_model(response, d_attrs, additional_properties) @@ -1515,14 +1509,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1578,7 +1572,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1652,7 +1646,7 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return self._deserialize(obj_type, data) @@ -1700,7 +1694,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1757,7 +1751,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: @@ -1808,7 +1802,6 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] except IndexError: @@ -1862,10 +1855,10 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): @@ -1893,7 +1886,7 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return duration @@ -1910,7 +1903,7 @@ def deserialize_date(attr): if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): @@ -1945,7 +1938,7 @@ def deserialize_rfc(attr): date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1982,7 +1975,7 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1998,9 +1991,10 @@ def deserialize_unix(attr): if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_vendor.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_version.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_version.py index c47f66669f1b..e5754a47ce68 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_version.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/_configuration.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/_configuration.py index b5e1a42c2cc3..1d1402eb7162 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/_configuration.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/_configuration.py @@ -8,7 +8,6 @@ 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, AsyncARMChallengeAuthenticationPolicy @@ -19,7 +18,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class HybridConnectivityMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class HybridConnectivityMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for HybridConnectivityMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -27,22 +26,27 @@ class HybridConnectivityMgmtClientConfiguration(Configuration): # pylint: disab :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. Default value is "2023-03-15". Note that overriding this + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2024-12-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: - super(HybridConnectivityMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-03-15") + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2024-12-01") 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.") self.credential = credential + self.subscription_id = subscription_id self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-hybridconnectivity/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -51,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: 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.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/_hybrid_connectivity_mgmt_client.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/_hybrid_connectivity_mgmt_client.py index a7cda8b4315f..ef1d44ff28cc 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/_hybrid_connectivity_mgmt_client.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/_hybrid_connectivity_mgmt_client.py @@ -8,23 +8,48 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self +from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import HybridConnectivityMgmtClientConfiguration -from .operations import EndpointsOperations, Operations, ServiceConfigurationsOperations +from .operations import ( + EndpointsOperations, + GenerateAwsTemplateOperations, + InventoryOperations, + Operations, + PublicCloudConnectorsOperations, + ServiceConfigurationsOperations, + SolutionConfigurationsOperations, + SolutionTypesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class HybridConnectivityMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """REST API for Hybrid Connectivity. - +class HybridConnectivityMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """REST API for public clouds. + + :ivar solution_configurations: SolutionConfigurationsOperations operations + :vartype solution_configurations: + azure.mgmt.hybridconnectivity.aio.operations.SolutionConfigurationsOperations + :ivar inventory: InventoryOperations operations + :vartype inventory: azure.mgmt.hybridconnectivity.aio.operations.InventoryOperations + :ivar generate_aws_template: GenerateAwsTemplateOperations operations + :vartype generate_aws_template: + azure.mgmt.hybridconnectivity.aio.operations.GenerateAwsTemplateOperations + :ivar public_cloud_connectors: PublicCloudConnectorsOperations operations + :vartype public_cloud_connectors: + azure.mgmt.hybridconnectivity.aio.operations.PublicCloudConnectorsOperations + :ivar solution_types: SolutionTypesOperations operations + :vartype solution_types: azure.mgmt.hybridconnectivity.aio.operations.SolutionTypesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.hybridconnectivity.aio.operations.Operations :ivar endpoints: EndpointsOperations operations @@ -34,30 +59,71 @@ class HybridConnectivityMgmtClient: # pylint: disable=client-accepts-api-versio azure.mgmt.hybridconnectivity.aio.operations.ServiceConfigurationsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-03-15". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-12-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( - self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any ) -> None: - self._config = HybridConnectivityMgmtClientConfiguration(credential=credential, **kwargs) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._config = HybridConnectivityMgmtClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **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._serialize.client_side_validation = False + self.solution_configurations = SolutionConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.inventory = InventoryOperations(self._client, self._config, self._serialize, self._deserialize) + self.generate_aws_template = GenerateAwsTemplateOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.public_cloud_connectors = PublicCloudConnectorsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.solution_types = SolutionTypesOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.endpoints = EndpointsOperations(self._client, self._config, self._serialize, self._deserialize) self.service_configurations = ServiceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -77,12 +143,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "HybridConnectivityMgmtClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/__init__.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/__init__.py index 73fdcf10d374..3ff69303a663 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/__init__.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/__init__.py @@ -6,6 +6,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._solution_configurations_operations import SolutionConfigurationsOperations +from ._inventory_operations import InventoryOperations +from ._generate_aws_template_operations import GenerateAwsTemplateOperations +from ._public_cloud_connectors_operations import PublicCloudConnectorsOperations +from ._solution_types_operations import SolutionTypesOperations from ._operations import Operations from ._endpoints_operations import EndpointsOperations from ._service_configurations_operations import ServiceConfigurationsOperations @@ -15,6 +20,11 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ + "SolutionConfigurationsOperations", + "InventoryOperations", + "GenerateAwsTemplateOperations", + "PublicCloudConnectorsOperations", + "SolutionTypesOperations", "Operations", "EndpointsOperations", "ServiceConfigurationsOperations", diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_endpoints_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_endpoints_operations.py index 93bc4db78ca3..4c36ba85c15d 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_endpoints_operations.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_endpoints_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._endpoints_operations import ( build_create_or_update_request, build_delete_request, @@ -40,6 +39,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +73,6 @@ def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.Endpo :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :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 EndpointResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridconnectivity.models.EndpointResource] @@ -82,7 +84,7 @@ def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.Endpo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EndpointsList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,15 +95,13 @@ def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.Endpo def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_uri=resource_uri, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -113,13 +113,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("EndpointsList", pipeline_response) @@ -129,11 +128,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -146,8 +145,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints"} - @distributed_trace_async async def get(self, resource_uri: str, endpoint_name: str, **kwargs: Any) -> _models.EndpointResource: """Gets the endpoint to the resource. @@ -157,12 +154,11 @@ async def get(self, resource_uri: str, endpoint_name: str, **kwargs: Any) -> _mo :type resource_uri: str :param endpoint_name: The endpoint name. Required. :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: ~azure.mgmt.hybridconnectivity.models.EndpointResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -176,20 +172,18 @@ async def get(self, resource_uri: str, endpoint_name: str, **kwargs: Any) -> _mo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EndpointResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_uri=resource_uri, endpoint_name=endpoint_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -199,14 +193,12 @@ async def get(self, resource_uri: str, endpoint_name: str, **kwargs: Any) -> _mo error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EndpointResource", pipeline_response) + deserialized = self._deserialize("EndpointResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = {"url": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}"} + return deserialized # type: ignore @overload async def create_or_update( @@ -230,7 +222,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: 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: ~azure.mgmt.hybridconnectivity.models.EndpointResource :raises ~azure.core.exceptions.HttpResponseError: @@ -241,7 +232,7 @@ async def create_or_update( self, resource_uri: str, endpoint_name: str, - endpoint_resource: IO, + endpoint_resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -254,11 +245,10 @@ async def create_or_update( :param endpoint_name: The endpoint name. Required. :type endpoint_name: str :param endpoint_resource: Endpoint details. Required. - :type endpoint_resource: IO + :type endpoint_resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: 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: ~azure.mgmt.hybridconnectivity.models.EndpointResource :raises ~azure.core.exceptions.HttpResponseError: @@ -269,7 +259,7 @@ async def create_or_update( self, resource_uri: str, endpoint_name: str, - endpoint_resource: Union[_models.EndpointResource, IO], + endpoint_resource: Union[_models.EndpointResource, IO[bytes]], **kwargs: Any ) -> _models.EndpointResource: """Create or update the endpoint to the target resource. @@ -279,18 +269,14 @@ async def create_or_update( :type resource_uri: str :param endpoint_name: The endpoint name. Required. :type endpoint_name: str - :param endpoint_resource: Endpoint details. Is either a EndpointResource type or a IO type. - Required. - :type endpoint_resource: ~azure.mgmt.hybridconnectivity.models.EndpointResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param endpoint_resource: Endpoint details. Is either a EndpointResource type or a IO[bytes] + type. Required. + :type endpoint_resource: ~azure.mgmt.hybridconnectivity.models.EndpointResource or IO[bytes] :return: EndpointResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.EndpointResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -313,23 +299,21 @@ async def create_or_update( else: _json = self._serialize.body(endpoint_resource, "EndpointResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_uri=resource_uri, endpoint_name=endpoint_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -339,16 +323,12 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EndpointResource", pipeline_response) + deserialized = self._deserialize("EndpointResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_or_update.metadata = { - "url": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}" - } + return deserialized # type: ignore @overload async def update( @@ -372,7 +352,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: 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: ~azure.mgmt.hybridconnectivity.models.EndpointResource :raises ~azure.core.exceptions.HttpResponseError: @@ -383,7 +362,7 @@ async def update( self, resource_uri: str, endpoint_name: str, - endpoint_resource: IO, + endpoint_resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -396,11 +375,10 @@ async def update( :param endpoint_name: The endpoint name. Required. :type endpoint_name: str :param endpoint_resource: Endpoint details. Required. - :type endpoint_resource: IO + :type endpoint_resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: 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: ~azure.mgmt.hybridconnectivity.models.EndpointResource :raises ~azure.core.exceptions.HttpResponseError: @@ -411,7 +389,7 @@ async def update( self, resource_uri: str, endpoint_name: str, - endpoint_resource: Union[_models.EndpointResource, IO], + endpoint_resource: Union[_models.EndpointResource, IO[bytes]], **kwargs: Any ) -> _models.EndpointResource: """Update the endpoint to the target resource. @@ -421,18 +399,14 @@ async def update( :type resource_uri: str :param endpoint_name: The endpoint name. Required. :type endpoint_name: str - :param endpoint_resource: Endpoint details. Is either a EndpointResource type or a IO type. - Required. - :type endpoint_resource: ~azure.mgmt.hybridconnectivity.models.EndpointResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param endpoint_resource: Endpoint details. Is either a EndpointResource type or a IO[bytes] + type. Required. + :type endpoint_resource: ~azure.mgmt.hybridconnectivity.models.EndpointResource or IO[bytes] :return: EndpointResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.EndpointResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -455,23 +429,21 @@ async def update( else: _json = self._serialize.body(endpoint_resource, "EndpointResource") - request = build_update_request( + _request = build_update_request( resource_uri=resource_uri, endpoint_name=endpoint_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -481,14 +453,12 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EndpointResource", pipeline_response) + deserialized = self._deserialize("EndpointResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = {"url": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}"} + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -501,12 +471,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type resource_uri: str :param endpoint_name: The endpoint name. Required. :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: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -520,20 +489,18 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_uri=resource_uri, endpoint_name=endpoint_name, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -544,9 +511,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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}"} + return cls(pipeline_response, None, {}) # type: ignore @overload async def list_credentials( @@ -574,7 +539,6 @@ async def list_credentials( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EndpointAccessResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.EndpointAccessResource :raises ~azure.core.exceptions.HttpResponseError: @@ -586,7 +550,7 @@ async def list_credentials( resource_uri: str, endpoint_name: str, expiresin: int = 10800, - list_credentials_request: Optional[IO] = None, + list_credentials_request: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -602,11 +566,10 @@ async def list_credentials( value is 10800. :type expiresin: int :param list_credentials_request: Object of type ListCredentialsRequest. Default value is None. - :type list_credentials_request: IO + :type list_credentials_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EndpointAccessResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.EndpointAccessResource :raises ~azure.core.exceptions.HttpResponseError: @@ -618,7 +581,7 @@ async def list_credentials( resource_uri: str, endpoint_name: str, expiresin: int = 10800, - list_credentials_request: Optional[Union[_models.ListCredentialsRequest, IO]] = None, + list_credentials_request: Optional[Union[_models.ListCredentialsRequest, IO[bytes]]] = None, **kwargs: Any ) -> _models.EndpointAccessResource: """Gets the endpoint access credentials to the resource. @@ -632,18 +595,14 @@ async def list_credentials( value is 10800. :type expiresin: int :param list_credentials_request: Object of type ListCredentialsRequest. Is either a - ListCredentialsRequest type or a IO type. Default value is None. + ListCredentialsRequest type or a IO[bytes] type. Default value is None. :type list_credentials_request: ~azure.mgmt.hybridconnectivity.models.ListCredentialsRequest or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] :return: EndpointAccessResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.EndpointAccessResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -669,7 +628,7 @@ async def list_credentials( else: _json = None - request = build_list_credentials_request( + _request = build_list_credentials_request( resource_uri=resource_uri, endpoint_name=endpoint_name, expiresin=expiresin, @@ -677,16 +636,14 @@ async def list_credentials( content_type=content_type, json=_json, content=_content, - template_url=self.list_credentials.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -696,16 +653,12 @@ async def list_credentials( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EndpointAccessResource", pipeline_response) + deserialized = self._deserialize("EndpointAccessResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_credentials.metadata = { - "url": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listCredentials" - } + return deserialized # type: ignore @overload async def list_ingress_gateway_credentials( @@ -735,7 +688,6 @@ async def list_ingress_gateway_credentials( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IngressGatewayResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.IngressGatewayResource :raises ~azure.core.exceptions.HttpResponseError: @@ -747,7 +699,7 @@ async def list_ingress_gateway_credentials( resource_uri: str, endpoint_name: str, expiresin: int = 10800, - list_ingress_gateway_credentials_request: Optional[IO] = None, + list_ingress_gateway_credentials_request: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -764,11 +716,10 @@ async def list_ingress_gateway_credentials( :type expiresin: int :param list_ingress_gateway_credentials_request: Object of type ListIngressGatewayCredentialsRequest. Default value is None. - :type list_ingress_gateway_credentials_request: IO + :type list_ingress_gateway_credentials_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IngressGatewayResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.IngressGatewayResource :raises ~azure.core.exceptions.HttpResponseError: @@ -781,7 +732,7 @@ async def list_ingress_gateway_credentials( endpoint_name: str, expiresin: int = 10800, list_ingress_gateway_credentials_request: Optional[ - Union[_models.ListIngressGatewayCredentialsRequest, IO] + Union[_models.ListIngressGatewayCredentialsRequest, IO[bytes]] ] = None, **kwargs: Any ) -> _models.IngressGatewayResource: @@ -797,18 +748,14 @@ async def list_ingress_gateway_credentials( :type expiresin: int :param list_ingress_gateway_credentials_request: Object of type ListIngressGatewayCredentialsRequest. Is either a ListIngressGatewayCredentialsRequest type or - a IO type. Default value is None. + a IO[bytes] type. Default value is None. :type list_ingress_gateway_credentials_request: - ~azure.mgmt.hybridconnectivity.models.ListIngressGatewayCredentialsRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ~azure.mgmt.hybridconnectivity.models.ListIngressGatewayCredentialsRequest or IO[bytes] :return: IngressGatewayResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.IngressGatewayResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -836,7 +783,7 @@ async def list_ingress_gateway_credentials( else: _json = None - request = build_list_ingress_gateway_credentials_request( + _request = build_list_ingress_gateway_credentials_request( resource_uri=resource_uri, endpoint_name=endpoint_name, expiresin=expiresin, @@ -844,16 +791,14 @@ async def list_ingress_gateway_credentials( content_type=content_type, json=_json, content=_content, - template_url=self.list_ingress_gateway_credentials.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -863,16 +808,12 @@ async def list_ingress_gateway_credentials( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("IngressGatewayResource", pipeline_response) + deserialized = self._deserialize("IngressGatewayResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_ingress_gateway_credentials.metadata = { - "url": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listIngressGatewayCredentials" - } + return deserialized # type: ignore @overload async def list_managed_proxy_details( @@ -896,7 +837,6 @@ async def list_managed_proxy_details( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedProxyResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.ManagedProxyResource :raises ~azure.core.exceptions.HttpResponseError: @@ -907,7 +847,7 @@ async def list_managed_proxy_details( self, resource_uri: str, endpoint_name: str, - managed_proxy_request: IO, + managed_proxy_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -920,11 +860,10 @@ async def list_managed_proxy_details( :param endpoint_name: The endpoint name. Required. :type endpoint_name: str :param managed_proxy_request: Object of type ManagedProxyRequest. Required. - :type managed_proxy_request: IO + :type managed_proxy_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedProxyResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.ManagedProxyResource :raises ~azure.core.exceptions.HttpResponseError: @@ -935,7 +874,7 @@ async def list_managed_proxy_details( self, resource_uri: str, endpoint_name: str, - managed_proxy_request: Union[_models.ManagedProxyRequest, IO], + managed_proxy_request: Union[_models.ManagedProxyRequest, IO[bytes]], **kwargs: Any ) -> _models.ManagedProxyResource: """Fetches the managed proxy details. @@ -946,17 +885,14 @@ async def list_managed_proxy_details( :param endpoint_name: The endpoint name. Required. :type endpoint_name: str :param managed_proxy_request: Object of type ManagedProxyRequest. Is either a - ManagedProxyRequest type or a IO type. Required. - :type managed_proxy_request: ~azure.mgmt.hybridconnectivity.models.ManagedProxyRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ManagedProxyRequest type or a IO[bytes] type. Required. + :type managed_proxy_request: ~azure.mgmt.hybridconnectivity.models.ManagedProxyRequest or + IO[bytes] :return: ManagedProxyResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.ManagedProxyResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -979,23 +915,21 @@ async def list_managed_proxy_details( else: _json = self._serialize.body(managed_proxy_request, "ManagedProxyRequest") - request = build_list_managed_proxy_details_request( + _request = build_list_managed_proxy_details_request( resource_uri=resource_uri, endpoint_name=endpoint_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.list_managed_proxy_details.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1005,13 +939,9 @@ async def list_managed_proxy_details( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedProxyResource", pipeline_response) + deserialized = self._deserialize("ManagedProxyResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_managed_proxy_details.metadata = { - "url": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listManagedProxyDetails" - } + return deserialized # type: ignore diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_generate_aws_template_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_generate_aws_template_operations.py new file mode 100644 index 000000000000..8b066f379056 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_generate_aws_template_operations.py @@ -0,0 +1,163 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._generate_aws_template_operations import build_post_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class GenerateAwsTemplateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridconnectivity.aio.HybridConnectivityMgmtClient`'s + :attr:`generate_aws_template` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def post( + self, + generate_aws_template_request: _models.GenerateAwsTemplateRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> JSON: + """Retrieve AWS Cloud Formation template. + + :param generate_aws_template_request: ConnectorId and SolutionTypes and their properties to + Generate AWS CFT Template. Required. + :type generate_aws_template_request: + ~azure.mgmt.hybridconnectivity.models.GenerateAwsTemplateRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON or the result of cls(response) + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, generate_aws_template_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + """Retrieve AWS Cloud Formation template. + + :param generate_aws_template_request: ConnectorId and SolutionTypes and their properties to + Generate AWS CFT Template. Required. + :type generate_aws_template_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON or the result of cls(response) + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def post( + self, generate_aws_template_request: Union[_models.GenerateAwsTemplateRequest, IO[bytes]], **kwargs: Any + ) -> JSON: + """Retrieve AWS Cloud Formation template. + + :param generate_aws_template_request: ConnectorId and SolutionTypes and their properties to + Generate AWS CFT Template. Is either a GenerateAwsTemplateRequest type or a IO[bytes] type. + Required. + :type generate_aws_template_request: + ~azure.mgmt.hybridconnectivity.models.GenerateAwsTemplateRequest or IO[bytes] + :return: JSON or the result of cls(response) + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(generate_aws_template_request, (IOBase, bytes)): + _content = generate_aws_template_request + else: + _json = self._serialize.body(generate_aws_template_request, "GenerateAwsTemplateRequest") + + _request = build_post_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("object", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_inventory_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_inventory_operations.py new file mode 100644 index 000000000000..f971f4fea560 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_inventory_operations.py @@ -0,0 +1,201 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._inventory_operations import build_get_request, build_list_by_solution_configuration_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class InventoryOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridconnectivity.aio.HybridConnectivityMgmtClient`'s + :attr:`inventory` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_solution_configuration( + self, resource_uri: str, solution_configuration: str, **kwargs: Any + ) -> AsyncIterable["_models.InventoryResource"]: + """List InventoryResource resources by SolutionConfiguration. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param solution_configuration: Represent Solution Configuration Resource. Required. + :type solution_configuration: str + :return: An iterator like instance of either InventoryResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridconnectivity.models.InventoryResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InventoryResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_solution_configuration_request( + resource_uri=resource_uri, + solution_configuration=solution_configuration, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("InventoryResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_uri: str, solution_configuration: str, inventory_id: str, **kwargs: Any + ) -> _models.InventoryResource: + """Get a InventoryResource. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param solution_configuration: Represent Solution Configuration Resource. Required. + :type solution_configuration: str + :param inventory_id: Inventory resource. Required. + :type inventory_id: str + :return: InventoryResource or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.InventoryResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InventoryResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_uri=resource_uri, + solution_configuration=solution_configuration, + inventory_id=inventory_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("InventoryResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_operations.py index ada6c2f25429..325eff0aad31 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_operations.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # 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, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,16 +20,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +59,6 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """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 Operation or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridconnectivity.models.Operation] @@ -68,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -79,14 +81,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -98,13 +98,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) @@ -114,11 +113,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -130,5 +129,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.HybridConnectivity/operations"} diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_public_cloud_connectors_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_public_cloud_connectors_operations.py new file mode 100644 index 000000000000..e6582c22ade8 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_public_cloud_connectors_operations.py @@ -0,0 +1,798 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._public_cloud_connectors_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_test_permissions_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PublicCloudConnectorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridconnectivity.aio.HybridConnectivityMgmtClient`'s + :attr:`public_cloud_connectors` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.PublicCloudConnector"]: + """List PublicCloudConnector resources by subscription ID. + + :return: An iterator like instance of either PublicCloudConnector or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridconnectivity.models.PublicCloudConnector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PublicCloudConnectorListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PublicCloudConnectorListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PublicCloudConnector"]: + """List PublicCloudConnector resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either PublicCloudConnector or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridconnectivity.models.PublicCloudConnector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PublicCloudConnectorListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PublicCloudConnectorListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, public_cloud_connector: str, **kwargs: Any + ) -> _models.PublicCloudConnector: + """Get a PublicCloudConnector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param public_cloud_connector: Represent public cloud connectors resource. Required. + :type public_cloud_connector: str + :return: PublicCloudConnector or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.PublicCloudConnector + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PublicCloudConnector] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + public_cloud_connector=public_cloud_connector, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PublicCloudConnector", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + public_cloud_connector: str, + resource: Union[_models.PublicCloudConnector, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "PublicCloudConnector") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + public_cloud_connector=public_cloud_connector, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + public_cloud_connector: str, + resource: _models.PublicCloudConnector, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PublicCloudConnector]: + """Create a PublicCloudConnector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param public_cloud_connector: Represent public cloud connectors resource. Required. + :type public_cloud_connector: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.hybridconnectivity.models.PublicCloudConnector + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either PublicCloudConnector or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridconnectivity.models.PublicCloudConnector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + public_cloud_connector: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PublicCloudConnector]: + """Create a PublicCloudConnector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param public_cloud_connector: Represent public cloud connectors resource. Required. + :type public_cloud_connector: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either PublicCloudConnector or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridconnectivity.models.PublicCloudConnector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + public_cloud_connector: str, + resource: Union[_models.PublicCloudConnector, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PublicCloudConnector]: + """Create a PublicCloudConnector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param public_cloud_connector: Represent public cloud connectors resource. Required. + :type public_cloud_connector: str + :param resource: Resource create parameters. Is either a PublicCloudConnector type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.hybridconnectivity.models.PublicCloudConnector or IO[bytes] + :return: An instance of AsyncLROPoller that returns either PublicCloudConnector or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridconnectivity.models.PublicCloudConnector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PublicCloudConnector] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + public_cloud_connector=public_cloud_connector, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PublicCloudConnector", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PublicCloudConnector].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PublicCloudConnector]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def update( + self, + resource_group_name: str, + public_cloud_connector: str, + properties: _models.PublicCloudConnectorUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PublicCloudConnector: + """Update a PublicCloudConnector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param public_cloud_connector: Represent public cloud connectors resource. Required. + :type public_cloud_connector: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.hybridconnectivity.models.PublicCloudConnectorUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PublicCloudConnector or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.PublicCloudConnector + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + public_cloud_connector: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PublicCloudConnector: + """Update a PublicCloudConnector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param public_cloud_connector: Represent public cloud connectors resource. Required. + :type public_cloud_connector: str + :param properties: The resource properties to be updated. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: PublicCloudConnector or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.PublicCloudConnector + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + public_cloud_connector: str, + properties: Union[_models.PublicCloudConnectorUpdate, IO[bytes]], + **kwargs: Any + ) -> _models.PublicCloudConnector: + """Update a PublicCloudConnector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param public_cloud_connector: Represent public cloud connectors resource. Required. + :type public_cloud_connector: str + :param properties: The resource properties to be updated. Is either a + PublicCloudConnectorUpdate type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.hybridconnectivity.models.PublicCloudConnectorUpdate or IO[bytes] + :return: PublicCloudConnector or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.PublicCloudConnector + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PublicCloudConnector] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "PublicCloudConnectorUpdate") + + _request = build_update_request( + resource_group_name=resource_group_name, + public_cloud_connector=public_cloud_connector, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PublicCloudConnector", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, public_cloud_connector: str, **kwargs: Any + ) -> None: + """Delete a PublicCloudConnector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param public_cloud_connector: Represent public cloud connectors resource. Required. + :type public_cloud_connector: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + public_cloud_connector=public_cloud_connector, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + async def _test_permissions_initial( + self, resource_group_name: str, public_cloud_connector: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_test_permissions_request( + resource_group_name=resource_group_name, + public_cloud_connector=public_cloud_connector, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_test_permissions( + self, resource_group_name: str, public_cloud_connector: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """A long-running resource action. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param public_cloud_connector: Represent public cloud connectors resource. Required. + :type public_cloud_connector: str + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridconnectivity.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._test_permissions_initial( + resource_group_name=resource_group_name, + public_cloud_connector=public_cloud_connector, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_service_configurations_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_service_configurations_operations.py index 6c2886abf83e..489cc09b501f 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_service_configurations_operations.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_service_configurations_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._service_configurations_operations import ( build_create_orupdate_request, build_delete_request, @@ -37,6 +36,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +76,6 @@ def list_by_endpoint_resource( :type resource_uri: str :param endpoint_name: The endpoint name. Required. :type endpoint_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceConfigurationResource or the result of cls(response) :rtype: @@ -86,7 +88,7 @@ def list_by_endpoint_resource( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServiceConfigurationList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -97,16 +99,14 @@ def list_by_endpoint_resource( def prepare_request(next_link=None): if not next_link: - request = build_list_by_endpoint_resource_request( + _request = build_list_by_endpoint_resource_request( resource_uri=resource_uri, endpoint_name=endpoint_name, api_version=api_version, - template_url=self.list_by_endpoint_resource.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -118,13 +118,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ServiceConfigurationList", pipeline_response) @@ -134,11 +133,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,10 +150,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_endpoint_resource.metadata = { - "url": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations" - } - @distributed_trace_async async def get( self, resource_uri: str, endpoint_name: str, service_configuration_name: str, **kwargs: Any @@ -168,12 +163,11 @@ async def get( :type endpoint_name: str :param service_configuration_name: The service name. Required. :type service_configuration_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ServiceConfigurationResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -187,21 +181,19 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServiceConfigurationResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_uri=resource_uri, endpoint_name=endpoint_name, service_configuration_name=service_configuration_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -211,16 +203,12 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServiceConfigurationResource", pipeline_response) + deserialized = self._deserialize("ServiceConfigurationResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName}" - } + return deserialized # type: ignore @overload async def create_orupdate( @@ -248,7 +236,6 @@ async def create_orupdate( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ServiceConfigurationResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResource :raises ~azure.core.exceptions.HttpResponseError: @@ -260,7 +247,7 @@ async def create_orupdate( resource_uri: str, endpoint_name: str, service_configuration_name: str, - service_configuration_resource: IO, + service_configuration_resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -275,11 +262,10 @@ async def create_orupdate( :param service_configuration_name: The service name. Required. :type service_configuration_name: str :param service_configuration_resource: Service details. Required. - :type service_configuration_resource: IO + :type service_configuration_resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ServiceConfigurationResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResource :raises ~azure.core.exceptions.HttpResponseError: @@ -291,7 +277,7 @@ async def create_orupdate( resource_uri: str, endpoint_name: str, service_configuration_name: str, - service_configuration_resource: Union[_models.ServiceConfigurationResource, IO], + service_configuration_resource: Union[_models.ServiceConfigurationResource, IO[bytes]], **kwargs: Any ) -> _models.ServiceConfigurationResource: """Create or update a service in serviceConfiguration for the endpoint resource. @@ -304,18 +290,14 @@ async def create_orupdate( :param service_configuration_name: The service name. Required. :type service_configuration_name: str :param service_configuration_resource: Service details. Is either a - ServiceConfigurationResource type or a IO type. Required. + ServiceConfigurationResource type or a IO[bytes] type. Required. :type service_configuration_resource: - ~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResource or IO[bytes] :return: ServiceConfigurationResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -338,7 +320,7 @@ async def create_orupdate( else: _json = self._serialize.body(service_configuration_resource, "ServiceConfigurationResource") - request = build_create_orupdate_request( + _request = build_create_orupdate_request( resource_uri=resource_uri, endpoint_name=endpoint_name, service_configuration_name=service_configuration_name, @@ -346,16 +328,14 @@ async def create_orupdate( content_type=content_type, json=_json, content=_content, - template_url=self.create_orupdate.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -365,21 +345,13 @@ async def create_orupdate( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ServiceConfigurationResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ServiceConfigurationResource", pipeline_response) + deserialized = self._deserialize("ServiceConfigurationResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_orupdate.metadata = { - "url": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName}" - } - @overload async def update( self, @@ -406,7 +378,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ServiceConfigurationResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResource :raises ~azure.core.exceptions.HttpResponseError: @@ -418,7 +389,7 @@ async def update( resource_uri: str, endpoint_name: str, service_configuration_name: str, - service_configuration_resource: IO, + service_configuration_resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -433,11 +404,10 @@ async def update( :param service_configuration_name: The service name. Required. :type service_configuration_name: str :param service_configuration_resource: Service details. Required. - :type service_configuration_resource: IO + :type service_configuration_resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ServiceConfigurationResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResource :raises ~azure.core.exceptions.HttpResponseError: @@ -449,7 +419,7 @@ async def update( resource_uri: str, endpoint_name: str, service_configuration_name: str, - service_configuration_resource: Union[_models.ServiceConfigurationResourcePatch, IO], + service_configuration_resource: Union[_models.ServiceConfigurationResourcePatch, IO[bytes]], **kwargs: Any ) -> _models.ServiceConfigurationResource: """Update the service details in the service configurations of the target resource. @@ -462,18 +432,14 @@ async def update( :param service_configuration_name: The service name. Required. :type service_configuration_name: str :param service_configuration_resource: Service details. Is either a - ServiceConfigurationResourcePatch type or a IO type. Required. + ServiceConfigurationResourcePatch type or a IO[bytes] type. Required. :type service_configuration_resource: - ~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResourcePatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResourcePatch or IO[bytes] :return: ServiceConfigurationResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -496,7 +462,7 @@ async def update( else: _json = self._serialize.body(service_configuration_resource, "ServiceConfigurationResourcePatch") - request = build_update_request( + _request = build_update_request( resource_uri=resource_uri, endpoint_name=endpoint_name, service_configuration_name=service_configuration_name, @@ -504,16 +470,14 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -523,16 +487,12 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServiceConfigurationResource", pipeline_response) + deserialized = self._deserialize("ServiceConfigurationResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -547,12 +507,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type endpoint_name: str :param service_configuration_name: The service name. Required. :type service_configuration_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: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,21 +525,19 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_uri=resource_uri, endpoint_name=endpoint_name, service_configuration_name=service_configuration_name, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -591,8 +548,4 @@ async def delete( # pylint: disable=inconsistent-return-statements 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}/serviceConfigurations/{serviceConfigurationName}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_solution_configurations_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_solution_configurations_operations.py new file mode 100644 index 000000000000..71f09fb6616e --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_solution_configurations_operations.py @@ -0,0 +1,636 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._solution_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_sync_now_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SolutionConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridconnectivity.aio.HybridConnectivityMgmtClient`'s + :attr:`solution_configurations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.SolutionConfiguration"]: + """List SolutionConfiguration resources by parent. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :return: An iterator like instance of either SolutionConfiguration or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridconnectivity.models.SolutionConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SolutionConfigurationListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_uri=resource_uri, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SolutionConfigurationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, resource_uri: str, solution_configuration: str, **kwargs: Any) -> _models.SolutionConfiguration: + """Get a SolutionConfiguration. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param solution_configuration: Represent Solution Configuration Resource. Required. + :type solution_configuration: str + :return: SolutionConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.SolutionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SolutionConfiguration] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_uri=resource_uri, + solution_configuration=solution_configuration, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SolutionConfiguration", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_uri: str, + solution_configuration: str, + resource: _models.SolutionConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SolutionConfiguration: + """Create a SolutionConfiguration. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param solution_configuration: Represent Solution Configuration Resource. Required. + :type solution_configuration: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.hybridconnectivity.models.SolutionConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SolutionConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.SolutionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_uri: str, + solution_configuration: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SolutionConfiguration: + """Create a SolutionConfiguration. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param solution_configuration: Represent Solution Configuration Resource. Required. + :type solution_configuration: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SolutionConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.SolutionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_uri: str, + solution_configuration: str, + resource: Union[_models.SolutionConfiguration, IO[bytes]], + **kwargs: Any + ) -> _models.SolutionConfiguration: + """Create a SolutionConfiguration. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param solution_configuration: Represent Solution Configuration Resource. Required. + :type solution_configuration: str + :param resource: Resource create parameters. Is either a SolutionConfiguration type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.hybridconnectivity.models.SolutionConfiguration or IO[bytes] + :return: SolutionConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.SolutionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SolutionConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "SolutionConfiguration") + + _request = build_create_or_update_request( + resource_uri=resource_uri, + solution_configuration=solution_configuration, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SolutionConfiguration", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_uri: str, + solution_configuration: str, + properties: _models.SolutionConfigurationUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SolutionConfiguration: + """Update a SolutionConfiguration. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param solution_configuration: Represent Solution Configuration Resource. Required. + :type solution_configuration: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.hybridconnectivity.models.SolutionConfigurationUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SolutionConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.SolutionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_uri: str, + solution_configuration: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SolutionConfiguration: + """Update a SolutionConfiguration. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param solution_configuration: Represent Solution Configuration Resource. Required. + :type solution_configuration: str + :param properties: The resource properties to be updated. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SolutionConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.SolutionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_uri: str, + solution_configuration: str, + properties: Union[_models.SolutionConfigurationUpdate, IO[bytes]], + **kwargs: Any + ) -> _models.SolutionConfiguration: + """Update a SolutionConfiguration. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param solution_configuration: Represent Solution Configuration Resource. Required. + :type solution_configuration: str + :param properties: The resource properties to be updated. Is either a + SolutionConfigurationUpdate type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.hybridconnectivity.models.SolutionConfigurationUpdate or + IO[bytes] + :return: SolutionConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.SolutionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SolutionConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "SolutionConfigurationUpdate") + + _request = build_update_request( + resource_uri=resource_uri, + solution_configuration=solution_configuration, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SolutionConfiguration", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_uri: str, solution_configuration: str, **kwargs: Any + ) -> None: + """Delete a SolutionConfiguration. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param solution_configuration: Represent Solution Configuration Resource. Required. + :type solution_configuration: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_uri=resource_uri, + solution_configuration=solution_configuration, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + async def _sync_now_initial( + self, resource_uri: str, solution_configuration: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_sync_now_request( + resource_uri=resource_uri, + solution_configuration=solution_configuration, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_sync_now( + self, resource_uri: str, solution_configuration: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Trigger immediate sync with source cloud. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param solution_configuration: Represent Solution Configuration Resource. Required. + :type solution_configuration: str + :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridconnectivity.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._sync_now_initial( + resource_uri=resource_uri, + solution_configuration=solution_configuration, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_solution_types_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_solution_types_operations.py new file mode 100644 index 000000000000..9f9e79646c0a --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_solution_types_operations.py @@ -0,0 +1,277 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._solution_types_operations import ( + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SolutionTypesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridconnectivity.aio.HybridConnectivityMgmtClient`'s + :attr:`solution_types` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SolutionTypeResource"]: + """List SolutionTypeResource resources by subscription ID. + + :return: An iterator like instance of either SolutionTypeResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridconnectivity.models.SolutionTypeResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SolutionTypeResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SolutionTypeResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SolutionTypeResource"]: + """List SolutionTypeResource resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either SolutionTypeResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridconnectivity.models.SolutionTypeResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SolutionTypeResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SolutionTypeResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, resource_group_name: str, solution_type: str, **kwargs: Any) -> _models.SolutionTypeResource: + """Get a SolutionTypeResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param solution_type: Solution Type resource. Required. + :type solution_type: str + :return: SolutionTypeResource or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.SolutionTypeResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SolutionTypeResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + solution_type=solution_type, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SolutionTypeResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/models/__init__.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/models/__init__.py index 5e881c5a2a33..adc75c6ee1c4 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/models/__init__.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/models/__init__.py @@ -6,6 +6,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._models_py3 import AwsCloudProfile +from ._models_py3 import AwsCloudProfileUpdate +from ._models_py3 import AzureResourceManagerCommonTypesTrackedResourceUpdate from ._models_py3 import EndpointAccessResource from ._models_py3 import EndpointProperties from ._models_py3 import EndpointResource @@ -13,7 +16,11 @@ from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse +from ._models_py3 import GenerateAwsTemplateRequest from ._models_py3 import IngressGatewayResource +from ._models_py3 import InventoryProperties +from ._models_py3 import InventoryResource +from ._models_py3 import InventoryResourceListResult from ._models_py3 import ListCredentialsRequest from ._models_py3 import ListIngressGatewayCredentialsRequest from ._models_py3 import ManagedProxyRequest @@ -21,24 +28,52 @@ from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult +from ._models_py3 import OperationStatusResult from ._models_py3 import ProxyResource +from ._models_py3 import PublicCloudConnector +from ._models_py3 import PublicCloudConnectorListResult +from ._models_py3 import PublicCloudConnectorProperties +from ._models_py3 import PublicCloudConnectorPropertiesUpdate +from ._models_py3 import PublicCloudConnectorUpdate from ._models_py3 import Resource from ._models_py3 import ServiceConfigurationList from ._models_py3 import ServiceConfigurationResource from ._models_py3 import ServiceConfigurationResourcePatch +from ._models_py3 import SolutionConfiguration +from ._models_py3 import SolutionConfigurationListResult +from ._models_py3 import SolutionConfigurationProperties +from ._models_py3 import SolutionConfigurationPropertiesUpdate +from ._models_py3 import SolutionConfigurationUpdate +from ._models_py3 import SolutionTypePermissions +from ._models_py3 import SolutionTypeProperties +from ._models_py3 import SolutionTypeResource +from ._models_py3 import SolutionTypeResourceListResult +from ._models_py3 import SolutionTypeSettings +from ._models_py3 import SolutionTypeSettingsProperties from ._models_py3 import SystemData +from ._models_py3 import TestPermissionResult +from ._models_py3 import TrackedResource from ._hybrid_connectivity_mgmt_client_enums import ActionType +from ._hybrid_connectivity_mgmt_client_enums import CloudNativeType from ._hybrid_connectivity_mgmt_client_enums import CreatedByType +from ._hybrid_connectivity_mgmt_client_enums import HostType from ._hybrid_connectivity_mgmt_client_enums import Origin from ._hybrid_connectivity_mgmt_client_enums import ProvisioningState +from ._hybrid_connectivity_mgmt_client_enums import ResourceProvisioningState from ._hybrid_connectivity_mgmt_client_enums import ServiceName +from ._hybrid_connectivity_mgmt_client_enums import SolutionConfigurationStatus +from ._hybrid_connectivity_mgmt_client_enums import SolutionTypeEnum +from ._hybrid_connectivity_mgmt_client_enums import Status from ._hybrid_connectivity_mgmt_client_enums import Type from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ + "AwsCloudProfile", + "AwsCloudProfileUpdate", + "AzureResourceManagerCommonTypesTrackedResourceUpdate", "EndpointAccessResource", "EndpointProperties", "EndpointResource", @@ -46,7 +81,11 @@ "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", + "GenerateAwsTemplateRequest", "IngressGatewayResource", + "InventoryProperties", + "InventoryResource", + "InventoryResourceListResult", "ListCredentialsRequest", "ListIngressGatewayCredentialsRequest", "ManagedProxyRequest", @@ -54,17 +93,42 @@ "Operation", "OperationDisplay", "OperationListResult", + "OperationStatusResult", "ProxyResource", + "PublicCloudConnector", + "PublicCloudConnectorListResult", + "PublicCloudConnectorProperties", + "PublicCloudConnectorPropertiesUpdate", + "PublicCloudConnectorUpdate", "Resource", "ServiceConfigurationList", "ServiceConfigurationResource", "ServiceConfigurationResourcePatch", + "SolutionConfiguration", + "SolutionConfigurationListResult", + "SolutionConfigurationProperties", + "SolutionConfigurationPropertiesUpdate", + "SolutionConfigurationUpdate", + "SolutionTypePermissions", + "SolutionTypeProperties", + "SolutionTypeResource", + "SolutionTypeResourceListResult", + "SolutionTypeSettings", + "SolutionTypeSettingsProperties", "SystemData", + "TestPermissionResult", + "TrackedResource", "ActionType", + "CloudNativeType", "CreatedByType", + "HostType", "Origin", "ProvisioningState", + "ResourceProvisioningState", "ServiceName", + "SolutionConfigurationStatus", + "SolutionTypeEnum", + "Status", "Type", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/models/_hybrid_connectivity_mgmt_client_enums.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/models/_hybrid_connectivity_mgmt_client_enums.py index 669869ed5556..48ba0de88e87 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/models/_hybrid_connectivity_mgmt_client_enums.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/models/_hybrid_connectivity_mgmt_client_enums.py @@ -16,6 +16,13 @@ class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): INTERNAL = "Internal" +class CloudNativeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Cloud Native Type enum.""" + + EC2 = "ec2" + """ec2 enum.""" + + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource.""" @@ -25,6 +32,13 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): KEY = "Key" +class HostType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum of host cloud the public cloud connector is referencing.""" + + AWS = "AWS" + """AWS state""" + + class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system". @@ -45,6 +59,17 @@ class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): CANCELED = "Canceled" +class ResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of a resource type.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" + + class ServiceName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Name of the service.""" @@ -52,6 +77,39 @@ class ServiceName(str, Enum, metaclass=CaseInsensitiveEnumMeta): WAC = "WAC" +class SolutionConfigurationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Solution Configuration Status.""" + + NEW = "New" + """New status""" + IN_PROGRESS = "InProgress" + """InProgress status""" + COMPLETED = "Completed" + """Canceled status""" + FAILED = "Failed" + """Failed status""" + + +class SolutionTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Solution types.""" + + MICROSOFT_ASSET_MANAGEMENT = "Microsoft.AssetManagement" + """Asset Management solution type""" + MICROSOFT_HYBRID_COMPUTE_ONBOARD = "Microsoft.HybridCompute.Onboard" + """Hybrid Compute Onboard solution type""" + MICROSOFT_HYBRID_NETWORK_V_WAN_PROVISION = "Microsoft.HybridNetwork.VWan.Provision" + """VWan Provisioning solution type""" + + +class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Connection status.""" + + CONNECTED = "Connected" + """Connected status""" + DISCONNECTED = "Disconnected" + """Disconnected status""" + + class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of endpoint.""" diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/models/_models_py3.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/models/_models_py3.py index be325ef40298..4806e62361e2 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/models/_models_py3.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Any, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization @@ -17,6 +17,161 @@ from .. import models as _models +class AwsCloudProfile(_serialization.Model): + """cloud profile for AWS. + + All required parameters must be populated in order to send to server. + + :ivar account_id: Account id for the AWS account. Required. + :vartype account_id: str + :ivar excluded_accounts: List of AWS accounts which need to be excluded. + :vartype excluded_accounts: list[str] + :ivar is_organizational_account: Boolean value that indicates whether the account is + organizational or not. True represents organization account, whereas false represents a single + account. + :vartype is_organizational_account: bool + """ + + _validation = { + "account_id": {"required": True}, + } + + _attribute_map = { + "account_id": {"key": "accountId", "type": "str"}, + "excluded_accounts": {"key": "excludedAccounts", "type": "[str]"}, + "is_organizational_account": {"key": "isOrganizationalAccount", "type": "bool"}, + } + + def __init__( + self, + *, + account_id: str, + excluded_accounts: Optional[List[str]] = None, + is_organizational_account: bool = False, + **kwargs: Any + ) -> None: + """ + :keyword account_id: Account id for the AWS account. Required. + :paramtype account_id: str + :keyword excluded_accounts: List of AWS accounts which need to be excluded. + :paramtype excluded_accounts: list[str] + :keyword is_organizational_account: Boolean value that indicates whether the account is + organizational or not. True represents organization account, whereas false represents a single + account. + :paramtype is_organizational_account: bool + """ + super().__init__(**kwargs) + self.account_id = account_id + self.excluded_accounts = excluded_accounts + self.is_organizational_account = is_organizational_account + + +class AwsCloudProfileUpdate(_serialization.Model): + """cloud profile for AWS. + + :ivar excluded_accounts: List of AWS accounts which need to be excluded. + :vartype excluded_accounts: list[str] + """ + + _attribute_map = { + "excluded_accounts": {"key": "excludedAccounts", "type": "[str]"}, + } + + def __init__(self, *, excluded_accounts: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword excluded_accounts: List of AWS accounts which need to be excluded. + :paramtype excluded_accounts: list[str] + """ + super().__init__(**kwargs) + self.excluded_accounts = excluded_accounts + + +class Resource(_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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :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 + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridconnectivity.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class AzureResourceManagerCommonTypesTrackedResourceUpdate(Resource): # pylint: disable=name-too-long + """The resource model definition for an Azure Resource Manager tracked top level resource which + has '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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :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 + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridconnectivity.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + class EndpointAccessResource(_serialization.Model): """The endpoint access for the target resource. @@ -87,7 +242,7 @@ class EndpointProperties(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar type: The type of endpoint. Required. Known values are: "default" and "custom". :vartype type: str or ~azure.mgmt.hybridconnectivity.models.Type @@ -121,47 +276,6 @@ def __init__(self, *, type: Union[str, "_models.Type"], resource_id: Optional[st self.provisioning_state = None -class Resource(_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. E.g. - "/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 - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.hybridconnectivity.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - class ProxyResource(Resource): """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. @@ -169,7 +283,7 @@ class ProxyResource(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. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -181,24 +295,6 @@ class ProxyResource(Resource): :vartype system_data: ~azure.mgmt.hybridconnectivity.models.SystemData """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - class EndpointResource(ProxyResource): """The endpoint for the target resource. @@ -206,7 +302,7 @@ class EndpointResource(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -368,6 +464,40 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A self.error = error +class GenerateAwsTemplateRequest(_serialization.Model): + """ConnectorId and SolutionTypes and their properties to Generate AWS CFT Template. + + All required parameters must be populated in order to send to server. + + :ivar connector_id: The name of public cloud connector. Required. + :vartype connector_id: str + :ivar solution_types: The list of solution types and their settings. + :vartype solution_types: list[~azure.mgmt.hybridconnectivity.models.SolutionTypeSettings] + """ + + _validation = { + "connector_id": {"required": True}, + } + + _attribute_map = { + "connector_id": {"key": "connectorId", "type": "str"}, + "solution_types": {"key": "solutionTypes", "type": "[SolutionTypeSettings]"}, + } + + def __init__( + self, *, connector_id: str, solution_types: Optional[List["_models.SolutionTypeSettings"]] = None, **kwargs: Any + ) -> None: + """ + :keyword connector_id: The name of public cloud connector. Required. + :paramtype connector_id: str + :keyword solution_types: The list of solution types and their settings. + :paramtype solution_types: list[~azure.mgmt.hybridconnectivity.models.SolutionTypeSettings] + """ + super().__init__(**kwargs) + self.connector_id = connector_id + self.solution_types = solution_types + + class IngressGatewayResource(_serialization.Model): """The ingress gateway access credentials. @@ -454,76 +584,222 @@ def __init__( self.service_configuration_token = service_configuration_token -class ListCredentialsRequest(_serialization.Model): - """The details of the service for which credentials needs to be returned. +class InventoryProperties(_serialization.Model): + """Definition of inventory. - :ivar service_name: The name of the service. If not provided, the request will by pass the - generation of service configuration token. Known values are: "SSH" and "WAC". - :vartype service_name: str or ~azure.mgmt.hybridconnectivity.models.ServiceName + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cloud_native_type: Gets or sets the cloud native resource type. "ec2" + :vartype cloud_native_type: str or ~azure.mgmt.hybridconnectivity.models.CloudNativeType + :ivar cloud_native_resource_id: Gets or sets the cloud native resource name. + :vartype cloud_native_resource_id: str + :ivar azure_resource_id: Gets or sets the mapped azure resource id. + :vartype azure_resource_id: str + :ivar status: Gets or sets the status of the inventory. Known values are: "New", "InProgress", + "Completed", and "Failed". + :vartype status: str or ~azure.mgmt.hybridconnectivity.models.SolutionConfigurationStatus + :ivar status_details: Gets or sets the status details. + :vartype status_details: str + :ivar provisioning_state: The resource provisioning state. Known values are: "Succeeded", + "Failed", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.hybridconnectivity.models.ResourceProvisioningState """ + _validation = { + "provisioning_state": {"readonly": True}, + } + _attribute_map = { - "service_name": {"key": "serviceName", "type": "str"}, + "cloud_native_type": {"key": "cloudNativeType", "type": "str"}, + "cloud_native_resource_id": {"key": "cloudNativeResourceId", "type": "str"}, + "azure_resource_id": {"key": "azureResourceId", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "status_details": {"key": "statusDetails", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, *, service_name: Optional[Union[str, "_models.ServiceName"]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + cloud_native_type: Optional[Union[str, "_models.CloudNativeType"]] = None, + cloud_native_resource_id: Optional[str] = None, + azure_resource_id: Optional[str] = None, + status: Optional[Union[str, "_models.SolutionConfigurationStatus"]] = None, + status_details: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword service_name: The name of the service. If not provided, the request will by pass the - generation of service configuration token. Known values are: "SSH" and "WAC". - :paramtype service_name: str or ~azure.mgmt.hybridconnectivity.models.ServiceName + :keyword cloud_native_type: Gets or sets the cloud native resource type. "ec2" + :paramtype cloud_native_type: str or ~azure.mgmt.hybridconnectivity.models.CloudNativeType + :keyword cloud_native_resource_id: Gets or sets the cloud native resource name. + :paramtype cloud_native_resource_id: str + :keyword azure_resource_id: Gets or sets the mapped azure resource id. + :paramtype azure_resource_id: str + :keyword status: Gets or sets the status of the inventory. Known values are: "New", + "InProgress", "Completed", and "Failed". + :paramtype status: str or ~azure.mgmt.hybridconnectivity.models.SolutionConfigurationStatus + :keyword status_details: Gets or sets the status details. + :paramtype status_details: str """ super().__init__(**kwargs) - self.service_name = service_name + self.cloud_native_type = cloud_native_type + self.cloud_native_resource_id = cloud_native_resource_id + self.azure_resource_id = azure_resource_id + self.status = status + self.status_details = status_details + self.provisioning_state = None -class ListIngressGatewayCredentialsRequest(_serialization.Model): - """Represent ListIngressGatewayCredentials Request object. +class InventoryResource(ProxyResource): + """Concrete proxy resource types can be created by aliasing this type using a specific property + type. - :ivar service_name: The name of the service. Known values are: "SSH" and "WAC". - :vartype service_name: str or ~azure.mgmt.hybridconnectivity.models.ServiceName + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :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 + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridconnectivity.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.hybridconnectivity.models.InventoryProperties """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + _attribute_map = { - "service_name": {"key": "serviceName", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "InventoryProperties"}, } - def __init__(self, *, service_name: Optional[Union[str, "_models.ServiceName"]] = None, **kwargs: Any) -> None: + def __init__(self, *, properties: Optional["_models.InventoryProperties"] = None, **kwargs: Any) -> None: """ - :keyword service_name: The name of the service. Known values are: "SSH" and "WAC". - :paramtype service_name: str or ~azure.mgmt.hybridconnectivity.models.ServiceName + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.hybridconnectivity.models.InventoryProperties """ super().__init__(**kwargs) - self.service_name = service_name + self.properties = properties -class ManagedProxyRequest(_serialization.Model): - """Represent ManageProxy Request object. +class InventoryResourceListResult(_serialization.Model): + """The response of a InventoryResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar service: The name of the service. Required. - :vartype service: str - :ivar hostname: The target host name. - :vartype hostname: str - :ivar service_name: The name of the service. It is an optional property, if not provided, - service configuration tokens issue code would be by passed. Known values are: "SSH" and "WAC". - :vartype service_name: str or ~azure.mgmt.hybridconnectivity.models.ServiceName + :ivar value: The InventoryResource items on this page. Required. + :vartype value: list[~azure.mgmt.hybridconnectivity.models.InventoryResource] + :ivar next_link: The link to the next page of items. + :vartype next_link: str """ _validation = { - "service": {"required": True}, + "value": {"required": True}, } _attribute_map = { - "service": {"key": "service", "type": "str"}, - "hostname": {"key": "hostname", "type": "str"}, - "service_name": {"key": "serviceName", "type": "str"}, + "value": {"key": "value", "type": "[InventoryResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - service: str, + self, *, value: List["_models.InventoryResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The InventoryResource items on this page. Required. + :paramtype value: list[~azure.mgmt.hybridconnectivity.models.InventoryResource] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ListCredentialsRequest(_serialization.Model): + """The details of the service for which credentials needs to be returned. + + :ivar service_name: The name of the service. If not provided, the request will by pass the + generation of service configuration token. Known values are: "SSH" and "WAC". + :vartype service_name: str or ~azure.mgmt.hybridconnectivity.models.ServiceName + """ + + _attribute_map = { + "service_name": {"key": "serviceName", "type": "str"}, + } + + def __init__(self, *, service_name: Optional[Union[str, "_models.ServiceName"]] = None, **kwargs: Any) -> None: + """ + :keyword service_name: The name of the service. If not provided, the request will by pass the + generation of service configuration token. Known values are: "SSH" and "WAC". + :paramtype service_name: str or ~azure.mgmt.hybridconnectivity.models.ServiceName + """ + super().__init__(**kwargs) + self.service_name = service_name + + +class ListIngressGatewayCredentialsRequest(_serialization.Model): + """Represent ListIngressGatewayCredentials Request object. + + :ivar service_name: The name of the service. Known values are: "SSH" and "WAC". + :vartype service_name: str or ~azure.mgmt.hybridconnectivity.models.ServiceName + """ + + _attribute_map = { + "service_name": {"key": "serviceName", "type": "str"}, + } + + def __init__(self, *, service_name: Optional[Union[str, "_models.ServiceName"]] = None, **kwargs: Any) -> None: + """ + :keyword service_name: The name of the service. Known values are: "SSH" and "WAC". + :paramtype service_name: str or ~azure.mgmt.hybridconnectivity.models.ServiceName + """ + super().__init__(**kwargs) + self.service_name = service_name + + +class ManagedProxyRequest(_serialization.Model): + """Represent ManageProxy Request object. + + All required parameters must be populated in order to send to server. + + :ivar service: The name of the service. Required. + :vartype service: str + :ivar hostname: The target host name. + :vartype hostname: str + :ivar service_name: The name of the service. It is an optional property, if not provided, + service configuration tokens issue code would be by passed. Known values are: "SSH" and "WAC". + :vartype service_name: str or ~azure.mgmt.hybridconnectivity.models.ServiceName + """ + + _validation = { + "service": {"required": True}, + } + + _attribute_map = { + "service": {"key": "service", "type": "str"}, + "hostname": {"key": "hostname", "type": "str"}, + "service_name": {"key": "serviceName", "type": "str"}, + } + + def __init__( + self, + *, + service: str, hostname: Optional[str] = None, service_name: Optional[Union[str, "_models.ServiceName"]] = None, **kwargs: Any @@ -546,7 +822,7 @@ def __init__( class ManagedProxyResource(_serialization.Model): """Managed Proxy. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar proxy: The short lived proxy name. Required. :vartype proxy: str @@ -697,45 +973,105 @@ def __init__(self, **kwargs: Any) -> None: self.next_link = None -class ServiceConfigurationList(_serialization.Model): - """The paginated list of serviceConfigurations. +class OperationStatusResult(_serialization.Model): + """The current status of an async operation. - :ivar value: The list of service configuration. - :vartype value: list[~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResource] - :ivar next_link: The link to fetch the next page of connected cluster. - :vartype next_link: str + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified ID for the async operation. + :vartype id: str + :ivar resource_id: Fully qualified ID of the resource against which the original async + operation was started. + :vartype resource_id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Operation status. Required. + :vartype status: str + :ivar percent_complete: Percent of the operation that is complete. + :vartype percent_complete: float + :ivar start_time: The start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the operation. + :vartype end_time: ~datetime.datetime + :ivar operations: The operations list. + :vartype operations: list[~azure.mgmt.hybridconnectivity.models.OperationStatusResult] + :ivar error: If present, details of the operation error. + :vartype error: ~azure.mgmt.hybridconnectivity.models.ErrorDetail """ + _validation = { + "resource_id": {"readonly": True}, + "status": {"required": True}, + "percent_complete": {"maximum": 100, "minimum": 0}, + } + _attribute_map = { - "value": {"key": "value", "type": "[ServiceConfigurationResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "percent_complete": {"key": "percentComplete", "type": "float"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "operations": {"key": "operations", "type": "[OperationStatusResult]"}, + "error": {"key": "error", "type": "ErrorDetail"}, } def __init__( self, *, - value: Optional[List["_models.ServiceConfigurationResource"]] = None, - next_link: Optional[str] = None, + status: str, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + percent_complete: Optional[float] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + operations: Optional[List["_models.OperationStatusResult"]] = None, + error: Optional["_models.ErrorDetail"] = None, **kwargs: Any ) -> None: """ - :keyword value: The list of service configuration. - :paramtype value: list[~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResource] - :keyword next_link: The link to fetch the next page of connected cluster. - :paramtype next_link: str + :keyword id: Fully qualified ID for the async operation. + :paramtype id: str + :keyword name: Name of the async operation. + :paramtype name: str + :keyword status: Operation status. Required. + :paramtype status: str + :keyword percent_complete: Percent of the operation that is complete. + :paramtype percent_complete: float + :keyword start_time: The start time of the operation. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The end time of the operation. + :paramtype end_time: ~datetime.datetime + :keyword operations: The operations list. + :paramtype operations: list[~azure.mgmt.hybridconnectivity.models.OperationStatusResult] + :keyword error: If present, details of the operation error. + :paramtype error: ~azure.mgmt.hybridconnectivity.models.ErrorDetail """ super().__init__(**kwargs) - self.value = value - self.next_link = next_link + self.id = id + self.resource_id = None + self.name = name + self.status = status + self.percent_complete = percent_complete + self.start_time = start_time + self.end_time = end_time + self.operations = operations + self.error = error -class ServiceConfigurationResource(ProxyResource): - """The service configuration details associated with the target resource. +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to server. + :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -745,15 +1081,10 @@ class ServiceConfigurationResource(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.hybridconnectivity.models.SystemData - :ivar service_name: Name of the service. Known values are: "SSH" and "WAC". - :vartype service_name: str or ~azure.mgmt.hybridconnectivity.models.ServiceName - :ivar resource_id: The resource Id of the connectivity endpoint (optional). - :vartype resource_id: str - :ivar port: The port on which service is enabled. - :vartype port: int - :ivar provisioning_state: The resource provisioning state. Known values are: "Succeeded", - "Creating", "Updating", "Failed", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.hybridconnectivity.models.ProvisioningState + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str """ _validation = { @@ -761,7 +1092,7 @@ class ServiceConfigurationResource(ProxyResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { @@ -769,114 +1100,949 @@ class ServiceConfigurationResource(ProxyResource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "service_name": {"key": "properties.serviceName", "type": "str"}, - "resource_id": {"key": "properties.resourceId", "type": "str"}, - "port": {"key": "properties.port", "type": "int"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class PublicCloudConnector(TrackedResource): + """Public Cloud Connector. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :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 + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridconnectivity.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.hybridconnectivity.models.PublicCloudConnectorProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "PublicCloudConnectorProperties"}, } def __init__( self, *, - service_name: Optional[Union[str, "_models.ServiceName"]] = None, - resource_id: Optional[str] = None, - port: Optional[int] = None, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.PublicCloudConnectorProperties"] = None, **kwargs: Any ) -> None: """ - :keyword service_name: Name of the service. Known values are: "SSH" and "WAC". - :paramtype service_name: str or ~azure.mgmt.hybridconnectivity.models.ServiceName - :keyword resource_id: The resource Id of the connectivity endpoint (optional). - :paramtype resource_id: str - :keyword port: The port on which service is enabled. - :paramtype port: int + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.hybridconnectivity.models.PublicCloudConnectorProperties """ - super().__init__(**kwargs) - self.service_name = service_name - self.resource_id = resource_id - self.port = port - self.provisioning_state = None + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties -class ServiceConfigurationResourcePatch(_serialization.Model): - """The service details under service configuration for the target endpoint resource. +class PublicCloudConnectorListResult(_serialization.Model): + """The response of a PublicCloudConnector list operation. - :ivar port: The port on which service is enabled. - :vartype port: int + All required parameters must be populated in order to send to server. + + :ivar value: The PublicCloudConnector items on this page. Required. + :vartype value: list[~azure.mgmt.hybridconnectivity.models.PublicCloudConnector] + :ivar next_link: The link to the next page of items. + :vartype next_link: str """ + _validation = { + "value": {"required": True}, + } + _attribute_map = { - "port": {"key": "properties.port", "type": "int"}, + "value": {"key": "value", "type": "[PublicCloudConnector]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, port: Optional[int] = None, **kwargs: Any) -> None: + def __init__( + self, *, value: List["_models.PublicCloudConnector"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword port: The port on which service is enabled. - :paramtype port: int + :keyword value: The PublicCloudConnector items on this page. Required. + :paramtype value: list[~azure.mgmt.hybridconnectivity.models.PublicCloudConnector] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) - self.port = port + self.value = value + self.next_link = next_link -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. +class PublicCloudConnectorProperties(_serialization.Model): + """Properties of public cloud connectors. - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.hybridconnectivity.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.hybridconnectivity.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar aws_cloud_profile: Cloud profile for AWS. Required. + :vartype aws_cloud_profile: ~azure.mgmt.hybridconnectivity.models.AwsCloudProfile + :ivar host_type: Host cloud the public cloud connector. Required. "AWS" + :vartype host_type: str or ~azure.mgmt.hybridconnectivity.models.HostType + :ivar provisioning_state: The resource provisioning state. Known values are: "Succeeded", + "Failed", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.hybridconnectivity.models.ResourceProvisioningState + :ivar connector_primary_identifier: Connector primary identifier. + :vartype connector_primary_identifier: str """ + _validation = { + "aws_cloud_profile": {"required": True}, + "host_type": {"required": True}, + "provisioning_state": {"readonly": True}, + "connector_primary_identifier": {"readonly": True}, + } + _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + "aws_cloud_profile": {"key": "awsCloudProfile", "type": "AwsCloudProfile"}, + "host_type": {"key": "hostType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "connector_primary_identifier": {"key": "connectorPrimaryIdentifier", "type": "str"}, } def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any + self, *, aws_cloud_profile: "_models.AwsCloudProfile", host_type: Union[str, "_models.HostType"], **kwargs: Any ) -> None: """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.hybridconnectivity.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.hybridconnectivity.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime + :keyword aws_cloud_profile: Cloud profile for AWS. Required. + :paramtype aws_cloud_profile: ~azure.mgmt.hybridconnectivity.models.AwsCloudProfile + :keyword host_type: Host cloud the public cloud connector. Required. "AWS" + :paramtype host_type: str or ~azure.mgmt.hybridconnectivity.models.HostType """ super().__init__(**kwargs) - 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.aws_cloud_profile = aws_cloud_profile + self.host_type = host_type + self.provisioning_state = None + self.connector_primary_identifier = None + + +class PublicCloudConnectorPropertiesUpdate(_serialization.Model): + """Properties of public cloud connectors. + + :ivar aws_cloud_profile: Cloud profile for AWS. + :vartype aws_cloud_profile: ~azure.mgmt.hybridconnectivity.models.AwsCloudProfileUpdate + """ + + _attribute_map = { + "aws_cloud_profile": {"key": "awsCloudProfile", "type": "AwsCloudProfileUpdate"}, + } + + def __init__(self, *, aws_cloud_profile: Optional["_models.AwsCloudProfileUpdate"] = None, **kwargs: Any) -> None: + """ + :keyword aws_cloud_profile: Cloud profile for AWS. + :paramtype aws_cloud_profile: ~azure.mgmt.hybridconnectivity.models.AwsCloudProfileUpdate + """ + super().__init__(**kwargs) + self.aws_cloud_profile = aws_cloud_profile + + +class PublicCloudConnectorUpdate(AzureResourceManagerCommonTypesTrackedResourceUpdate): + """Public Cloud Connector. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :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 + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridconnectivity.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.hybridconnectivity.models.PublicCloudConnectorPropertiesUpdate + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "PublicCloudConnectorPropertiesUpdate"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.PublicCloudConnectorPropertiesUpdate"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: + ~azure.mgmt.hybridconnectivity.models.PublicCloudConnectorPropertiesUpdate + """ + super().__init__(tags=tags, **kwargs) + self.properties = properties + + +class ServiceConfigurationList(_serialization.Model): + """The paginated list of serviceConfigurations. + + :ivar value: The list of service configuration. + :vartype value: list[~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResource] + :ivar next_link: The link to fetch the next page of connected cluster. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ServiceConfigurationResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ServiceConfigurationResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The list of service configuration. + :paramtype value: list[~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResource] + :keyword next_link: The link to fetch the next page of connected cluster. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ServiceConfigurationResource(ProxyResource): + """The service configuration details associated with 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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :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 + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridconnectivity.models.SystemData + :ivar service_name: Name of the service. Known values are: "SSH" and "WAC". + :vartype service_name: str or ~azure.mgmt.hybridconnectivity.models.ServiceName + :ivar resource_id: The resource Id of the connectivity endpoint (optional). + :vartype resource_id: str + :ivar port: The port on which service is enabled. + :vartype port: int + :ivar provisioning_state: The resource provisioning state. Known values are: "Succeeded", + "Creating", "Updating", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.hybridconnectivity.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "service_name": {"key": "properties.serviceName", "type": "str"}, + "resource_id": {"key": "properties.resourceId", "type": "str"}, + "port": {"key": "properties.port", "type": "int"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + service_name: Optional[Union[str, "_models.ServiceName"]] = None, + resource_id: Optional[str] = None, + port: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword service_name: Name of the service. Known values are: "SSH" and "WAC". + :paramtype service_name: str or ~azure.mgmt.hybridconnectivity.models.ServiceName + :keyword resource_id: The resource Id of the connectivity endpoint (optional). + :paramtype resource_id: str + :keyword port: The port on which service is enabled. + :paramtype port: int + """ + super().__init__(**kwargs) + self.service_name = service_name + self.resource_id = resource_id + self.port = port + self.provisioning_state = None + + +class ServiceConfigurationResourcePatch(_serialization.Model): + """The service details under service configuration for the target endpoint resource. + + :ivar port: The port on which service is enabled. + :vartype port: int + """ + + _attribute_map = { + "port": {"key": "properties.port", "type": "int"}, + } + + def __init__(self, *, port: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword port: The port on which service is enabled. + :paramtype port: int + """ + super().__init__(**kwargs) + self.port = port + + +class SolutionConfiguration(ProxyResource): + """Solution Configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :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 + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridconnectivity.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.hybridconnectivity.models.SolutionConfigurationProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "SolutionConfigurationProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.SolutionConfigurationProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.hybridconnectivity.models.SolutionConfigurationProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class SolutionConfigurationListResult(_serialization.Model): + """The response of a SolutionConfiguration list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The SolutionConfiguration items on this page. Required. + :vartype value: list[~azure.mgmt.hybridconnectivity.models.SolutionConfiguration] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SolutionConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.SolutionConfiguration"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The SolutionConfiguration items on this page. Required. + :paramtype value: list[~azure.mgmt.hybridconnectivity.models.SolutionConfiguration] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SolutionConfigurationProperties(_serialization.Model): + """Solution configuration resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar provisioning_state: The resource provisioning state. Known values are: "Succeeded", + "Failed", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.hybridconnectivity.models.ResourceProvisioningState + :ivar solution_type: The type of the solution. Required. + :vartype solution_type: str + :ivar solution_settings: Solution settings. + :vartype solution_settings: dict[str, str] + :ivar status: The status of solution configurations. Known values are: "New", "InProgress", + "Completed", and "Failed". + :vartype status: str or ~azure.mgmt.hybridconnectivity.models.SolutionConfigurationStatus + :ivar status_details: The detailed message of status details. + :vartype status_details: str + :ivar last_sync_time: The last time resources were inventoried. + :vartype last_sync_time: ~datetime.datetime + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "solution_type": {"required": True}, + "status": {"readonly": True}, + "status_details": {"readonly": True}, + "last_sync_time": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "solution_type": {"key": "solutionType", "type": "str"}, + "solution_settings": {"key": "solutionSettings", "type": "{str}"}, + "status": {"key": "status", "type": "str"}, + "status_details": {"key": "statusDetails", "type": "str"}, + "last_sync_time": {"key": "lastSyncTime", "type": "iso-8601"}, + } + + def __init__( + self, *, solution_type: str, solution_settings: Optional[Dict[str, str]] = None, **kwargs: Any + ) -> None: + """ + :keyword solution_type: The type of the solution. Required. + :paramtype solution_type: str + :keyword solution_settings: Solution settings. + :paramtype solution_settings: dict[str, str] + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.solution_type = solution_type + self.solution_settings = solution_settings + self.status = None + self.status_details = None + self.last_sync_time = None + + +class SolutionConfigurationPropertiesUpdate(_serialization.Model): + """Solution configuration resource. + + :ivar solution_type: The type of the solution. + :vartype solution_type: str + :ivar solution_settings: Solution settings. + :vartype solution_settings: dict[str, str] + """ + + _attribute_map = { + "solution_type": {"key": "solutionType", "type": "str"}, + "solution_settings": {"key": "solutionSettings", "type": "{str}"}, + } + + def __init__( + self, *, solution_type: Optional[str] = None, solution_settings: Optional[Dict[str, str]] = None, **kwargs: Any + ) -> None: + """ + :keyword solution_type: The type of the solution. + :paramtype solution_type: str + :keyword solution_settings: Solution settings. + :paramtype solution_settings: dict[str, str] + """ + super().__init__(**kwargs) + self.solution_type = solution_type + self.solution_settings = solution_settings + + +class SolutionConfigurationUpdate(ProxyResource): + """Solution Configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :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 + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridconnectivity.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: + ~azure.mgmt.hybridconnectivity.models.SolutionConfigurationPropertiesUpdate + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "SolutionConfigurationPropertiesUpdate"}, + } + + def __init__( + self, *, properties: Optional["_models.SolutionConfigurationPropertiesUpdate"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: + ~azure.mgmt.hybridconnectivity.models.SolutionConfigurationPropertiesUpdate + """ + super().__init__(**kwargs) + self.properties = properties + + +class SolutionTypePermissions(_serialization.Model): + """Solution type permissions. + + All required parameters must be populated in order to send to server. + + :ivar solution_type: The name of solution Type. Required. Known values are: + "Microsoft.AssetManagement", "Microsoft.HybridCompute.Onboard", and + "Microsoft.HybridNetwork.VWan.Provision". + :vartype solution_type: str or ~azure.mgmt.hybridconnectivity.models.SolutionTypeEnum + :ivar status: The status. Required. Known values are: "Connected" and "Disconnected". + :vartype status: str or ~azure.mgmt.hybridconnectivity.models.Status + :ivar status_details: The details of the status. Required. + :vartype status_details: str + """ + + _validation = { + "solution_type": {"required": True}, + "status": {"required": True}, + "status_details": {"required": True}, + } + + _attribute_map = { + "solution_type": {"key": "solutionType", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "status_details": {"key": "statusDetails", "type": "str"}, + } + + def __init__( + self, + *, + solution_type: Union[str, "_models.SolutionTypeEnum"], + status: Union[str, "_models.Status"], + status_details: str, + **kwargs: Any + ) -> None: + """ + :keyword solution_type: The name of solution Type. Required. Known values are: + "Microsoft.AssetManagement", "Microsoft.HybridCompute.Onboard", and + "Microsoft.HybridNetwork.VWan.Provision". + :paramtype solution_type: str or ~azure.mgmt.hybridconnectivity.models.SolutionTypeEnum + :keyword status: The status. Required. Known values are: "Connected" and "Disconnected". + :paramtype status: str or ~azure.mgmt.hybridconnectivity.models.Status + :keyword status_details: The details of the status. Required. + :paramtype status_details: str + """ + super().__init__(**kwargs) + self.solution_type = solution_type + self.status = status + self.status_details = status_details + + +class SolutionTypeProperties(_serialization.Model): + """Definition of Solution type resource. + + :ivar solution_type: The name of the solution type. + :vartype solution_type: str + :ivar description: Short description of solution type. + :vartype description: str + :ivar supported_azure_regions: The locations this solution is supported in. + :vartype supported_azure_regions: list[str] + :ivar solution_settings: Array of solution settings and its description. + :vartype solution_settings: + list[~azure.mgmt.hybridconnectivity.models.SolutionTypeSettingsProperties] + """ + + _attribute_map = { + "solution_type": {"key": "solutionType", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "supported_azure_regions": {"key": "supportedAzureRegions", "type": "[str]"}, + "solution_settings": {"key": "solutionSettings", "type": "[SolutionTypeSettingsProperties]"}, + } + + def __init__( + self, + *, + solution_type: Optional[str] = None, + description: Optional[str] = None, + supported_azure_regions: Optional[List[str]] = None, + solution_settings: Optional[List["_models.SolutionTypeSettingsProperties"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword solution_type: The name of the solution type. + :paramtype solution_type: str + :keyword description: Short description of solution type. + :paramtype description: str + :keyword supported_azure_regions: The locations this solution is supported in. + :paramtype supported_azure_regions: list[str] + :keyword solution_settings: Array of solution settings and its description. + :paramtype solution_settings: + list[~azure.mgmt.hybridconnectivity.models.SolutionTypeSettingsProperties] + """ + super().__init__(**kwargs) + self.solution_type = solution_type + self.description = description + self.supported_azure_regions = supported_azure_regions + self.solution_settings = solution_settings + + +class SolutionTypeResource(ProxyResource): + """Concrete proxy resource types can be created by aliasing this type using a specific property + type. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :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 + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridconnectivity.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.hybridconnectivity.models.SolutionTypeProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "SolutionTypeProperties"}, + } + + def __init__(self, *, properties: Optional["_models.SolutionTypeProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.hybridconnectivity.models.SolutionTypeProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class SolutionTypeResourceListResult(_serialization.Model): + """The response of a SolutionTypeResource list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The SolutionTypeResource items on this page. Required. + :vartype value: list[~azure.mgmt.hybridconnectivity.models.SolutionTypeResource] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SolutionTypeResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.SolutionTypeResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The SolutionTypeResource items on this page. Required. + :paramtype value: list[~azure.mgmt.hybridconnectivity.models.SolutionTypeResource] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SolutionTypeSettings(_serialization.Model): + """The properties of Solution Type. + + All required parameters must be populated in order to send to server. + + :ivar solution_type: The type of the solution. Required. + :vartype solution_type: str + :ivar solution_settings: Solution settings. + :vartype solution_settings: dict[str, str] + """ + + _validation = { + "solution_type": {"required": True}, + } + + _attribute_map = { + "solution_type": {"key": "solutionType", "type": "str"}, + "solution_settings": {"key": "solutionSettings", "type": "{str}"}, + } + + def __init__( + self, *, solution_type: str, solution_settings: Optional[Dict[str, str]] = None, **kwargs: Any + ) -> None: + """ + :keyword solution_type: The type of the solution. Required. + :paramtype solution_type: str + :keyword solution_settings: Solution settings. + :paramtype solution_settings: dict[str, str] + """ + super().__init__(**kwargs) + self.solution_type = solution_type + self.solution_settings = solution_settings + + +class SolutionTypeSettingsProperties(_serialization.Model): + """Represent Solution settings properties description array. + + All required parameters must be populated in order to send to server. + + :ivar name: The name of the solution setting property. Required. + :vartype name: str + :ivar display_name: The UI friendly name of the solution setting property. Required. + :vartype display_name: str + :ivar type: Type of the solution setting property, represented as a string. Required. + :vartype type: str + :ivar description: Description of solution setting property. Required. + :vartype description: str + :ivar allowed_values: Array of allowed values for this solution settings property. Required. + :vartype allowed_values: list[str] + :ivar default_value: Default value for this solution settings property. Required. + :vartype default_value: str + """ + + _validation = { + "name": {"required": True}, + "display_name": {"required": True}, + "type": {"required": True}, + "description": {"required": True}, + "allowed_values": {"required": True}, + "default_value": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "allowed_values": {"key": "allowedValues", "type": "[str]"}, + "default_value": {"key": "defaultValue", "type": "str"}, + } + + def __init__( + self, + *, + name: str, + display_name: str, + type: str, + description: str, + allowed_values: List[str], + default_value: str, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the solution setting property. Required. + :paramtype name: str + :keyword display_name: The UI friendly name of the solution setting property. Required. + :paramtype display_name: str + :keyword type: Type of the solution setting property, represented as a string. Required. + :paramtype type: str + :keyword description: Description of solution setting property. Required. + :paramtype description: str + :keyword allowed_values: Array of allowed values for this solution settings property. Required. + :paramtype allowed_values: list[str] + :keyword default_value: Default value for this solution settings property. Required. + :paramtype default_value: str + """ + super().__init__(**kwargs) + self.name = name + self.display_name = display_name + self.type = type + self.description = description + self.allowed_values = allowed_values + self.default_value = default_value + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.hybridconnectivity.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.hybridconnectivity.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or ~azure.mgmt.hybridconnectivity.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.hybridconnectivity.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + 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 TestPermissionResult(_serialization.Model): + """Public connector permissions. + + All required parameters must be populated in order to send to server. + + :ivar solution_types: Solution type permissions. Required. + :vartype solution_types: list[~azure.mgmt.hybridconnectivity.models.SolutionTypePermissions] + """ + + _validation = { + "solution_types": {"required": True}, + } + + _attribute_map = { + "solution_types": {"key": "solutionTypes", "type": "[SolutionTypePermissions]"}, + } + + def __init__(self, *, solution_types: List["_models.SolutionTypePermissions"], **kwargs: Any) -> None: + """ + :keyword solution_types: Solution type permissions. Required. + :paramtype solution_types: list[~azure.mgmt.hybridconnectivity.models.SolutionTypePermissions] + """ + super().__init__(**kwargs) + self.solution_types = solution_types diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/__init__.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/__init__.py index 73fdcf10d374..3ff69303a663 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/__init__.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/__init__.py @@ -6,6 +6,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._solution_configurations_operations import SolutionConfigurationsOperations +from ._inventory_operations import InventoryOperations +from ._generate_aws_template_operations import GenerateAwsTemplateOperations +from ._public_cloud_connectors_operations import PublicCloudConnectorsOperations +from ._solution_types_operations import SolutionTypesOperations from ._operations import Operations from ._endpoints_operations import EndpointsOperations from ._service_configurations_operations import ServiceConfigurationsOperations @@ -15,6 +20,11 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ + "SolutionConfigurationsOperations", + "InventoryOperations", + "GenerateAwsTemplateOperations", + "PublicCloudConnectorsOperations", + "SolutionTypesOperations", "Operations", "EndpointsOperations", "ServiceConfigurationsOperations", diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_endpoints_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_endpoints_operations.py index c6a5ed4ca852..4cc00696db42 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_endpoints_operations.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_endpoints_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +44,7 @@ def build_list_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +68,7 @@ def build_get_request(resource_uri: str, endpoint_name: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +93,7 @@ def build_create_or_update_request(resource_uri: str, endpoint_name: str, **kwar _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -118,7 +121,7 @@ def build_update_request(resource_uri: str, endpoint_name: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -146,7 +149,7 @@ def build_delete_request(resource_uri: str, endpoint_name: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -173,7 +176,7 @@ def build_list_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -201,13 +204,13 @@ def build_list_credentials_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_ingress_gateway_credentials_request( +def build_list_ingress_gateway_credentials_request( # pylint: disable=name-too-long resource_uri: str, endpoint_name: str, *, expiresin: int = 10800, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -240,7 +243,7 @@ def build_list_managed_proxy_details_request(resource_uri: str, endpoint_name: s _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -293,7 +296,6 @@ def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.EndpointRe :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :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 EndpointResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridconnectivity.models.EndpointResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -304,7 +306,7 @@ def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.EndpointRe api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EndpointsList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -315,15 +317,13 @@ def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.EndpointRe def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_uri=resource_uri, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -335,13 +335,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("EndpointsList", pipeline_response) @@ -351,11 +350,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -368,8 +367,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints"} - @distributed_trace def get(self, resource_uri: str, endpoint_name: str, **kwargs: Any) -> _models.EndpointResource: """Gets the endpoint to the resource. @@ -379,12 +376,11 @@ def get(self, resource_uri: str, endpoint_name: str, **kwargs: Any) -> _models.E :type resource_uri: str :param endpoint_name: The endpoint name. Required. :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: ~azure.mgmt.hybridconnectivity.models.EndpointResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -398,20 +394,18 @@ def get(self, resource_uri: str, endpoint_name: str, **kwargs: Any) -> _models.E api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EndpointResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_uri=resource_uri, endpoint_name=endpoint_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -421,14 +415,12 @@ def get(self, resource_uri: str, endpoint_name: str, **kwargs: Any) -> _models.E error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EndpointResource", pipeline_response) + deserialized = self._deserialize("EndpointResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = {"url": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}"} + return deserialized # type: ignore @overload def create_or_update( @@ -452,7 +444,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: 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: ~azure.mgmt.hybridconnectivity.models.EndpointResource :raises ~azure.core.exceptions.HttpResponseError: @@ -463,7 +454,7 @@ def create_or_update( self, resource_uri: str, endpoint_name: str, - endpoint_resource: IO, + endpoint_resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -476,11 +467,10 @@ def create_or_update( :param endpoint_name: The endpoint name. Required. :type endpoint_name: str :param endpoint_resource: Endpoint details. Required. - :type endpoint_resource: IO + :type endpoint_resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: 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: ~azure.mgmt.hybridconnectivity.models.EndpointResource :raises ~azure.core.exceptions.HttpResponseError: @@ -491,7 +481,7 @@ def create_or_update( self, resource_uri: str, endpoint_name: str, - endpoint_resource: Union[_models.EndpointResource, IO], + endpoint_resource: Union[_models.EndpointResource, IO[bytes]], **kwargs: Any ) -> _models.EndpointResource: """Create or update the endpoint to the target resource. @@ -501,18 +491,14 @@ def create_or_update( :type resource_uri: str :param endpoint_name: The endpoint name. Required. :type endpoint_name: str - :param endpoint_resource: Endpoint details. Is either a EndpointResource type or a IO type. - Required. - :type endpoint_resource: ~azure.mgmt.hybridconnectivity.models.EndpointResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param endpoint_resource: Endpoint details. Is either a EndpointResource type or a IO[bytes] + type. Required. + :type endpoint_resource: ~azure.mgmt.hybridconnectivity.models.EndpointResource or IO[bytes] :return: EndpointResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.EndpointResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -535,23 +521,21 @@ def create_or_update( else: _json = self._serialize.body(endpoint_resource, "EndpointResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_uri=resource_uri, endpoint_name=endpoint_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -561,16 +545,12 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EndpointResource", pipeline_response) + deserialized = self._deserialize("EndpointResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_update.metadata = { - "url": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}" - } + return deserialized # type: ignore @overload def update( @@ -594,7 +574,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: 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: ~azure.mgmt.hybridconnectivity.models.EndpointResource :raises ~azure.core.exceptions.HttpResponseError: @@ -605,7 +584,7 @@ def update( self, resource_uri: str, endpoint_name: str, - endpoint_resource: IO, + endpoint_resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -618,11 +597,10 @@ def update( :param endpoint_name: The endpoint name. Required. :type endpoint_name: str :param endpoint_resource: Endpoint details. Required. - :type endpoint_resource: IO + :type endpoint_resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: 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: ~azure.mgmt.hybridconnectivity.models.EndpointResource :raises ~azure.core.exceptions.HttpResponseError: @@ -633,7 +611,7 @@ def update( self, resource_uri: str, endpoint_name: str, - endpoint_resource: Union[_models.EndpointResource, IO], + endpoint_resource: Union[_models.EndpointResource, IO[bytes]], **kwargs: Any ) -> _models.EndpointResource: """Update the endpoint to the target resource. @@ -643,18 +621,14 @@ def update( :type resource_uri: str :param endpoint_name: The endpoint name. Required. :type endpoint_name: str - :param endpoint_resource: Endpoint details. Is either a EndpointResource type or a IO type. - Required. - :type endpoint_resource: ~azure.mgmt.hybridconnectivity.models.EndpointResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param endpoint_resource: Endpoint details. Is either a EndpointResource type or a IO[bytes] + type. Required. + :type endpoint_resource: ~azure.mgmt.hybridconnectivity.models.EndpointResource or IO[bytes] :return: EndpointResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.EndpointResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -677,23 +651,21 @@ def update( else: _json = self._serialize.body(endpoint_resource, "EndpointResource") - request = build_update_request( + _request = build_update_request( resource_uri=resource_uri, endpoint_name=endpoint_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -703,14 +675,12 @@ def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EndpointResource", pipeline_response) + deserialized = self._deserialize("EndpointResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = {"url": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}"} + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -723,12 +693,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type resource_uri: str :param endpoint_name: The endpoint name. Required. :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: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -742,20 +711,18 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_uri=resource_uri, endpoint_name=endpoint_name, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -766,9 +733,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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}"} + return cls(pipeline_response, None, {}) # type: ignore @overload def list_credentials( @@ -796,7 +761,6 @@ def list_credentials( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EndpointAccessResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.EndpointAccessResource :raises ~azure.core.exceptions.HttpResponseError: @@ -808,7 +772,7 @@ def list_credentials( resource_uri: str, endpoint_name: str, expiresin: int = 10800, - list_credentials_request: Optional[IO] = None, + list_credentials_request: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -824,11 +788,10 @@ def list_credentials( value is 10800. :type expiresin: int :param list_credentials_request: Object of type ListCredentialsRequest. Default value is None. - :type list_credentials_request: IO + :type list_credentials_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EndpointAccessResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.EndpointAccessResource :raises ~azure.core.exceptions.HttpResponseError: @@ -840,7 +803,7 @@ def list_credentials( resource_uri: str, endpoint_name: str, expiresin: int = 10800, - list_credentials_request: Optional[Union[_models.ListCredentialsRequest, IO]] = None, + list_credentials_request: Optional[Union[_models.ListCredentialsRequest, IO[bytes]]] = None, **kwargs: Any ) -> _models.EndpointAccessResource: """Gets the endpoint access credentials to the resource. @@ -854,18 +817,14 @@ def list_credentials( value is 10800. :type expiresin: int :param list_credentials_request: Object of type ListCredentialsRequest. Is either a - ListCredentialsRequest type or a IO type. Default value is None. + ListCredentialsRequest type or a IO[bytes] type. Default value is None. :type list_credentials_request: ~azure.mgmt.hybridconnectivity.models.ListCredentialsRequest or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] :return: EndpointAccessResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.EndpointAccessResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -891,7 +850,7 @@ def list_credentials( else: _json = None - request = build_list_credentials_request( + _request = build_list_credentials_request( resource_uri=resource_uri, endpoint_name=endpoint_name, expiresin=expiresin, @@ -899,16 +858,14 @@ def list_credentials( content_type=content_type, json=_json, content=_content, - template_url=self.list_credentials.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -918,16 +875,12 @@ def list_credentials( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EndpointAccessResource", pipeline_response) + deserialized = self._deserialize("EndpointAccessResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_credentials.metadata = { - "url": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listCredentials" - } + return deserialized # type: ignore @overload def list_ingress_gateway_credentials( @@ -957,7 +910,6 @@ def list_ingress_gateway_credentials( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IngressGatewayResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.IngressGatewayResource :raises ~azure.core.exceptions.HttpResponseError: @@ -969,7 +921,7 @@ def list_ingress_gateway_credentials( resource_uri: str, endpoint_name: str, expiresin: int = 10800, - list_ingress_gateway_credentials_request: Optional[IO] = None, + list_ingress_gateway_credentials_request: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -986,11 +938,10 @@ def list_ingress_gateway_credentials( :type expiresin: int :param list_ingress_gateway_credentials_request: Object of type ListIngressGatewayCredentialsRequest. Default value is None. - :type list_ingress_gateway_credentials_request: IO + :type list_ingress_gateway_credentials_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: IngressGatewayResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.IngressGatewayResource :raises ~azure.core.exceptions.HttpResponseError: @@ -1003,7 +954,7 @@ def list_ingress_gateway_credentials( endpoint_name: str, expiresin: int = 10800, list_ingress_gateway_credentials_request: Optional[ - Union[_models.ListIngressGatewayCredentialsRequest, IO] + Union[_models.ListIngressGatewayCredentialsRequest, IO[bytes]] ] = None, **kwargs: Any ) -> _models.IngressGatewayResource: @@ -1019,18 +970,14 @@ def list_ingress_gateway_credentials( :type expiresin: int :param list_ingress_gateway_credentials_request: Object of type ListIngressGatewayCredentialsRequest. Is either a ListIngressGatewayCredentialsRequest type or - a IO type. Default value is None. + a IO[bytes] type. Default value is None. :type list_ingress_gateway_credentials_request: - ~azure.mgmt.hybridconnectivity.models.ListIngressGatewayCredentialsRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ~azure.mgmt.hybridconnectivity.models.ListIngressGatewayCredentialsRequest or IO[bytes] :return: IngressGatewayResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.IngressGatewayResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1058,7 +1005,7 @@ def list_ingress_gateway_credentials( else: _json = None - request = build_list_ingress_gateway_credentials_request( + _request = build_list_ingress_gateway_credentials_request( resource_uri=resource_uri, endpoint_name=endpoint_name, expiresin=expiresin, @@ -1066,16 +1013,14 @@ def list_ingress_gateway_credentials( content_type=content_type, json=_json, content=_content, - template_url=self.list_ingress_gateway_credentials.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1085,16 +1030,12 @@ def list_ingress_gateway_credentials( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("IngressGatewayResource", pipeline_response) + deserialized = self._deserialize("IngressGatewayResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_ingress_gateway_credentials.metadata = { - "url": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listIngressGatewayCredentials" - } + return deserialized # type: ignore @overload def list_managed_proxy_details( @@ -1118,7 +1059,6 @@ def list_managed_proxy_details( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedProxyResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.ManagedProxyResource :raises ~azure.core.exceptions.HttpResponseError: @@ -1129,7 +1069,7 @@ def list_managed_proxy_details( self, resource_uri: str, endpoint_name: str, - managed_proxy_request: IO, + managed_proxy_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1142,11 +1082,10 @@ def list_managed_proxy_details( :param endpoint_name: The endpoint name. Required. :type endpoint_name: str :param managed_proxy_request: Object of type ManagedProxyRequest. Required. - :type managed_proxy_request: IO + :type managed_proxy_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedProxyResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.ManagedProxyResource :raises ~azure.core.exceptions.HttpResponseError: @@ -1157,7 +1096,7 @@ def list_managed_proxy_details( self, resource_uri: str, endpoint_name: str, - managed_proxy_request: Union[_models.ManagedProxyRequest, IO], + managed_proxy_request: Union[_models.ManagedProxyRequest, IO[bytes]], **kwargs: Any ) -> _models.ManagedProxyResource: """Fetches the managed proxy details. @@ -1168,17 +1107,14 @@ def list_managed_proxy_details( :param endpoint_name: The endpoint name. Required. :type endpoint_name: str :param managed_proxy_request: Object of type ManagedProxyRequest. Is either a - ManagedProxyRequest type or a IO type. Required. - :type managed_proxy_request: ~azure.mgmt.hybridconnectivity.models.ManagedProxyRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ManagedProxyRequest type or a IO[bytes] type. Required. + :type managed_proxy_request: ~azure.mgmt.hybridconnectivity.models.ManagedProxyRequest or + IO[bytes] :return: ManagedProxyResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.ManagedProxyResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1201,23 +1137,21 @@ def list_managed_proxy_details( else: _json = self._serialize.body(managed_proxy_request, "ManagedProxyRequest") - request = build_list_managed_proxy_details_request( + _request = build_list_managed_proxy_details_request( resource_uri=resource_uri, endpoint_name=endpoint_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.list_managed_proxy_details.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1227,13 +1161,9 @@ def list_managed_proxy_details( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedProxyResource", pipeline_response) + deserialized = self._deserialize("ManagedProxyResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_managed_proxy_details.metadata = { - "url": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listManagedProxyDetails" - } + return deserialized # type: ignore diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_generate_aws_template_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_generate_aws_template_operations.py new file mode 100644 index 000000000000..fb30f93fd78f --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_generate_aws_template_operations.py @@ -0,0 +1,195 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_post_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/generateAwsTemplate" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class GenerateAwsTemplateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridconnectivity.HybridConnectivityMgmtClient`'s + :attr:`generate_aws_template` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def post( + self, + generate_aws_template_request: _models.GenerateAwsTemplateRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> JSON: + """Retrieve AWS Cloud Formation template. + + :param generate_aws_template_request: ConnectorId and SolutionTypes and their properties to + Generate AWS CFT Template. Required. + :type generate_aws_template_request: + ~azure.mgmt.hybridconnectivity.models.GenerateAwsTemplateRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON or the result of cls(response) + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def post( + self, generate_aws_template_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + """Retrieve AWS Cloud Formation template. + + :param generate_aws_template_request: ConnectorId and SolutionTypes and their properties to + Generate AWS CFT Template. Required. + :type generate_aws_template_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON or the result of cls(response) + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( + self, generate_aws_template_request: Union[_models.GenerateAwsTemplateRequest, IO[bytes]], **kwargs: Any + ) -> JSON: + """Retrieve AWS Cloud Formation template. + + :param generate_aws_template_request: ConnectorId and SolutionTypes and their properties to + Generate AWS CFT Template. Is either a GenerateAwsTemplateRequest type or a IO[bytes] type. + Required. + :type generate_aws_template_request: + ~azure.mgmt.hybridconnectivity.models.GenerateAwsTemplateRequest or IO[bytes] + :return: JSON or the result of cls(response) + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(generate_aws_template_request, (IOBase, bytes)): + _content = generate_aws_template_request + else: + _json = self._serialize.body(generate_aws_template_request, "GenerateAwsTemplateRequest") + + _request = build_post_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("object", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_inventory_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_inventory_operations.py new file mode 100644 index 000000000000..74dc91bb16e0 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_inventory_operations.py @@ -0,0 +1,265 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_solution_configuration_request( # pylint: disable=name-too-long + resource_uri: str, solution_configuration: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/inventory", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "solutionConfiguration": _SERIALIZER.url( + "solution_configuration", solution_configuration, "str", pattern=r"^[a-zA-Z0-9-]{3,63}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_uri: str, solution_configuration: str, inventory_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/inventory/{inventoryId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "solutionConfiguration": _SERIALIZER.url( + "solution_configuration", solution_configuration, "str", pattern=r"^[a-zA-Z0-9-]{3,63}$" + ), + "inventoryId": _SERIALIZER.url("inventory_id", inventory_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class InventoryOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridconnectivity.HybridConnectivityMgmtClient`'s + :attr:`inventory` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_solution_configuration( + self, resource_uri: str, solution_configuration: str, **kwargs: Any + ) -> Iterable["_models.InventoryResource"]: + """List InventoryResource resources by SolutionConfiguration. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param solution_configuration: Represent Solution Configuration Resource. Required. + :type solution_configuration: str + :return: An iterator like instance of either InventoryResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridconnectivity.models.InventoryResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InventoryResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_solution_configuration_request( + resource_uri=resource_uri, + solution_configuration=solution_configuration, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("InventoryResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_uri: str, solution_configuration: str, inventory_id: str, **kwargs: Any + ) -> _models.InventoryResource: + """Get a InventoryResource. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param solution_configuration: Represent Solution Configuration Resource. Required. + :type solution_configuration: str + :param inventory_id: Inventory resource. Required. + :type inventory_id: str + :return: InventoryResource or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.InventoryResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InventoryResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_uri=resource_uri, + solution_configuration=solution_configuration, + inventory_id=inventory_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("InventoryResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_operations.py index 5915f6fe5879..e9bc17966090 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_operations.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +43,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +81,6 @@ def __init__(self, *args, **kwargs): def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """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 Operation or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridconnectivity.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -89,7 +91,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,14 +102,12 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -119,13 +119,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) @@ -135,11 +134,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,5 +150,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.HybridConnectivity/operations"} diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_public_cloud_connectors_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_public_cloud_connectors_operations.py new file mode 100644 index 000000000000..dd800a76b8f0 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_public_cloud_connectors_operations.py @@ -0,0 +1,1026 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/publicCloudConnectors" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, public_cloud_connector: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publicCloudConnector": _SERIALIZER.url( + "public_cloud_connector", public_cloud_connector, "str", pattern=r"^[a-zA-Z0-9-]{3,63}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, public_cloud_connector: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publicCloudConnector": _SERIALIZER.url( + "public_cloud_connector", public_cloud_connector, "str", pattern=r"^[a-zA-Z0-9-]{3,63}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, public_cloud_connector: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publicCloudConnector": _SERIALIZER.url( + "public_cloud_connector", public_cloud_connector, "str", pattern=r"^[a-zA-Z0-9-]{3,63}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, public_cloud_connector: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publicCloudConnector": _SERIALIZER.url( + "public_cloud_connector", public_cloud_connector, "str", pattern=r"^[a-zA-Z0-9-]{3,63}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_test_permissions_request( + resource_group_name: str, public_cloud_connector: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}/testPermissions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "publicCloudConnector": _SERIALIZER.url( + "public_cloud_connector", public_cloud_connector, "str", pattern=r"^[a-zA-Z0-9-]{3,63}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class PublicCloudConnectorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridconnectivity.HybridConnectivityMgmtClient`'s + :attr:`public_cloud_connectors` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.PublicCloudConnector"]: + """List PublicCloudConnector resources by subscription ID. + + :return: An iterator like instance of either PublicCloudConnector or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.hybridconnectivity.models.PublicCloudConnector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PublicCloudConnectorListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PublicCloudConnectorListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.PublicCloudConnector"]: + """List PublicCloudConnector resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either PublicCloudConnector or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.hybridconnectivity.models.PublicCloudConnector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PublicCloudConnectorListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PublicCloudConnectorListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, public_cloud_connector: str, **kwargs: Any) -> _models.PublicCloudConnector: + """Get a PublicCloudConnector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param public_cloud_connector: Represent public cloud connectors resource. Required. + :type public_cloud_connector: str + :return: PublicCloudConnector or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.PublicCloudConnector + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PublicCloudConnector] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + public_cloud_connector=public_cloud_connector, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PublicCloudConnector", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + public_cloud_connector: str, + resource: Union[_models.PublicCloudConnector, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "PublicCloudConnector") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + public_cloud_connector=public_cloud_connector, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + public_cloud_connector: str, + resource: _models.PublicCloudConnector, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PublicCloudConnector]: + """Create a PublicCloudConnector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param public_cloud_connector: Represent public cloud connectors resource. Required. + :type public_cloud_connector: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.hybridconnectivity.models.PublicCloudConnector + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either PublicCloudConnector or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridconnectivity.models.PublicCloudConnector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + public_cloud_connector: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PublicCloudConnector]: + """Create a PublicCloudConnector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param public_cloud_connector: Represent public cloud connectors resource. Required. + :type public_cloud_connector: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either PublicCloudConnector or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridconnectivity.models.PublicCloudConnector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + public_cloud_connector: str, + resource: Union[_models.PublicCloudConnector, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PublicCloudConnector]: + """Create a PublicCloudConnector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param public_cloud_connector: Represent public cloud connectors resource. Required. + :type public_cloud_connector: str + :param resource: Resource create parameters. Is either a PublicCloudConnector type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.hybridconnectivity.models.PublicCloudConnector or IO[bytes] + :return: An instance of LROPoller that returns either PublicCloudConnector or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridconnectivity.models.PublicCloudConnector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PublicCloudConnector] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + public_cloud_connector=public_cloud_connector, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PublicCloudConnector", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PublicCloudConnector].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PublicCloudConnector]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def update( + self, + resource_group_name: str, + public_cloud_connector: str, + properties: _models.PublicCloudConnectorUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PublicCloudConnector: + """Update a PublicCloudConnector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param public_cloud_connector: Represent public cloud connectors resource. Required. + :type public_cloud_connector: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.hybridconnectivity.models.PublicCloudConnectorUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PublicCloudConnector or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.PublicCloudConnector + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + public_cloud_connector: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PublicCloudConnector: + """Update a PublicCloudConnector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param public_cloud_connector: Represent public cloud connectors resource. Required. + :type public_cloud_connector: str + :param properties: The resource properties to be updated. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: PublicCloudConnector or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.PublicCloudConnector + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + public_cloud_connector: str, + properties: Union[_models.PublicCloudConnectorUpdate, IO[bytes]], + **kwargs: Any + ) -> _models.PublicCloudConnector: + """Update a PublicCloudConnector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param public_cloud_connector: Represent public cloud connectors resource. Required. + :type public_cloud_connector: str + :param properties: The resource properties to be updated. Is either a + PublicCloudConnectorUpdate type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.hybridconnectivity.models.PublicCloudConnectorUpdate or IO[bytes] + :return: PublicCloudConnector or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.PublicCloudConnector + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PublicCloudConnector] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "PublicCloudConnectorUpdate") + + _request = build_update_request( + resource_group_name=resource_group_name, + public_cloud_connector=public_cloud_connector, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PublicCloudConnector", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, public_cloud_connector: str, **kwargs: Any + ) -> None: + """Delete a PublicCloudConnector. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param public_cloud_connector: Represent public cloud connectors resource. Required. + :type public_cloud_connector: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + public_cloud_connector=public_cloud_connector, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + def _test_permissions_initial( + self, resource_group_name: str, public_cloud_connector: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_test_permissions_request( + resource_group_name=resource_group_name, + public_cloud_connector=public_cloud_connector, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_test_permissions( + self, resource_group_name: str, public_cloud_connector: str, **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """A long-running resource action. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param public_cloud_connector: Represent public cloud connectors resource. Required. + :type public_cloud_connector: str + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridconnectivity.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._test_permissions_initial( + resource_group_name=resource_group_name, + public_cloud_connector=public_cloud_connector, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_service_configurations_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_service_configurations_operations.py index 1baf663eceed..6440a4f4e1cf 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_service_configurations_operations.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_service_configurations_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +44,7 @@ def build_list_by_endpoint_resource_request(resource_uri: str, endpoint_name: st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +74,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,7 +107,7 @@ def build_create_orupdate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -140,7 +143,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -176,7 +179,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -235,7 +238,6 @@ def list_by_endpoint_resource( :type resource_uri: str :param endpoint_name: The endpoint name. Required. :type endpoint_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceConfigurationResource or the result of cls(response) :rtype: @@ -248,7 +250,7 @@ def list_by_endpoint_resource( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServiceConfigurationList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -259,16 +261,14 @@ def list_by_endpoint_resource( def prepare_request(next_link=None): if not next_link: - request = build_list_by_endpoint_resource_request( + _request = build_list_by_endpoint_resource_request( resource_uri=resource_uri, endpoint_name=endpoint_name, api_version=api_version, - template_url=self.list_by_endpoint_resource.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -280,13 +280,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ServiceConfigurationList", pipeline_response) @@ -296,11 +295,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,10 +312,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_endpoint_resource.metadata = { - "url": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations" - } - @distributed_trace def get( self, resource_uri: str, endpoint_name: str, service_configuration_name: str, **kwargs: Any @@ -330,12 +325,11 @@ def get( :type endpoint_name: str :param service_configuration_name: The service name. Required. :type service_configuration_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ServiceConfigurationResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -349,21 +343,19 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServiceConfigurationResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_uri=resource_uri, endpoint_name=endpoint_name, service_configuration_name=service_configuration_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -373,16 +365,12 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServiceConfigurationResource", pipeline_response) + deserialized = self._deserialize("ServiceConfigurationResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName}" - } + return deserialized # type: ignore @overload def create_orupdate( @@ -410,7 +398,6 @@ def create_orupdate( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ServiceConfigurationResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResource :raises ~azure.core.exceptions.HttpResponseError: @@ -422,7 +409,7 @@ def create_orupdate( resource_uri: str, endpoint_name: str, service_configuration_name: str, - service_configuration_resource: IO, + service_configuration_resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -437,11 +424,10 @@ def create_orupdate( :param service_configuration_name: The service name. Required. :type service_configuration_name: str :param service_configuration_resource: Service details. Required. - :type service_configuration_resource: IO + :type service_configuration_resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ServiceConfigurationResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResource :raises ~azure.core.exceptions.HttpResponseError: @@ -453,7 +439,7 @@ def create_orupdate( resource_uri: str, endpoint_name: str, service_configuration_name: str, - service_configuration_resource: Union[_models.ServiceConfigurationResource, IO], + service_configuration_resource: Union[_models.ServiceConfigurationResource, IO[bytes]], **kwargs: Any ) -> _models.ServiceConfigurationResource: """Create or update a service in serviceConfiguration for the endpoint resource. @@ -466,18 +452,14 @@ def create_orupdate( :param service_configuration_name: The service name. Required. :type service_configuration_name: str :param service_configuration_resource: Service details. Is either a - ServiceConfigurationResource type or a IO type. Required. + ServiceConfigurationResource type or a IO[bytes] type. Required. :type service_configuration_resource: - ~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResource or IO[bytes] :return: ServiceConfigurationResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -500,7 +482,7 @@ def create_orupdate( else: _json = self._serialize.body(service_configuration_resource, "ServiceConfigurationResource") - request = build_create_orupdate_request( + _request = build_create_orupdate_request( resource_uri=resource_uri, endpoint_name=endpoint_name, service_configuration_name=service_configuration_name, @@ -508,16 +490,14 @@ def create_orupdate( content_type=content_type, json=_json, content=_content, - template_url=self.create_orupdate.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -527,21 +507,13 @@ def create_orupdate( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ServiceConfigurationResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ServiceConfigurationResource", pipeline_response) + deserialized = self._deserialize("ServiceConfigurationResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_orupdate.metadata = { - "url": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName}" - } - @overload def update( self, @@ -568,7 +540,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ServiceConfigurationResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResource :raises ~azure.core.exceptions.HttpResponseError: @@ -580,7 +551,7 @@ def update( resource_uri: str, endpoint_name: str, service_configuration_name: str, - service_configuration_resource: IO, + service_configuration_resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -595,11 +566,10 @@ def update( :param service_configuration_name: The service name. Required. :type service_configuration_name: str :param service_configuration_resource: Service details. Required. - :type service_configuration_resource: IO + :type service_configuration_resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ServiceConfigurationResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResource :raises ~azure.core.exceptions.HttpResponseError: @@ -611,7 +581,7 @@ def update( resource_uri: str, endpoint_name: str, service_configuration_name: str, - service_configuration_resource: Union[_models.ServiceConfigurationResourcePatch, IO], + service_configuration_resource: Union[_models.ServiceConfigurationResourcePatch, IO[bytes]], **kwargs: Any ) -> _models.ServiceConfigurationResource: """Update the service details in the service configurations of the target resource. @@ -624,18 +594,14 @@ def update( :param service_configuration_name: The service name. Required. :type service_configuration_name: str :param service_configuration_resource: Service details. Is either a - ServiceConfigurationResourcePatch type or a IO type. Required. + ServiceConfigurationResourcePatch type or a IO[bytes] type. Required. :type service_configuration_resource: - ~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResourcePatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResourcePatch or IO[bytes] :return: ServiceConfigurationResource or the result of cls(response) :rtype: ~azure.mgmt.hybridconnectivity.models.ServiceConfigurationResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -658,7 +624,7 @@ def update( else: _json = self._serialize.body(service_configuration_resource, "ServiceConfigurationResourcePatch") - request = build_update_request( + _request = build_update_request( resource_uri=resource_uri, endpoint_name=endpoint_name, service_configuration_name=service_configuration_name, @@ -666,16 +632,14 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -685,16 +649,12 @@ def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServiceConfigurationResource", pipeline_response) + deserialized = self._deserialize("ServiceConfigurationResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -709,12 +669,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type endpoint_name: str :param service_configuration_name: The service name. Required. :type service_configuration_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: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -728,21 +687,19 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_uri=resource_uri, endpoint_name=endpoint_name, service_configuration_name=service_configuration_name, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -753,8 +710,4 @@ def delete( # pylint: disable=inconsistent-return-statements 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}/serviceConfigurations/{serviceConfigurationName}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_solution_configurations_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_solution_configurations_operations.py new file mode 100644 index 000000000000..6102d66a0bc6 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_solution_configurations_operations.py @@ -0,0 +1,809 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations") + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_uri: str, solution_configuration: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "solutionConfiguration": _SERIALIZER.url( + "solution_configuration", solution_configuration, "str", pattern=r"^[a-zA-Z0-9-]{3,63}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request(resource_uri: str, solution_configuration: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "solutionConfiguration": _SERIALIZER.url( + "solution_configuration", solution_configuration, "str", pattern=r"^[a-zA-Z0-9-]{3,63}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request(resource_uri: str, solution_configuration: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "solutionConfiguration": _SERIALIZER.url( + "solution_configuration", solution_configuration, "str", pattern=r"^[a-zA-Z0-9-]{3,63}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request(resource_uri: str, solution_configuration: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "solutionConfiguration": _SERIALIZER.url( + "solution_configuration", solution_configuration, "str", pattern=r"^[a-zA-Z0-9-]{3,63}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sync_now_request(resource_uri: str, solution_configuration: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/syncNow", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + "solutionConfiguration": _SERIALIZER.url( + "solution_configuration", solution_configuration, "str", pattern=r"^[a-zA-Z0-9-]{3,63}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class SolutionConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridconnectivity.HybridConnectivityMgmtClient`'s + :attr:`solution_configurations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.SolutionConfiguration"]: + """List SolutionConfiguration resources by parent. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :return: An iterator like instance of either SolutionConfiguration or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.hybridconnectivity.models.SolutionConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SolutionConfigurationListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_uri=resource_uri, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SolutionConfigurationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_uri: str, solution_configuration: str, **kwargs: Any) -> _models.SolutionConfiguration: + """Get a SolutionConfiguration. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param solution_configuration: Represent Solution Configuration Resource. Required. + :type solution_configuration: str + :return: SolutionConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.SolutionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SolutionConfiguration] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_uri=resource_uri, + solution_configuration=solution_configuration, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SolutionConfiguration", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_uri: str, + solution_configuration: str, + resource: _models.SolutionConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SolutionConfiguration: + """Create a SolutionConfiguration. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param solution_configuration: Represent Solution Configuration Resource. Required. + :type solution_configuration: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.hybridconnectivity.models.SolutionConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SolutionConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.SolutionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_uri: str, + solution_configuration: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SolutionConfiguration: + """Create a SolutionConfiguration. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param solution_configuration: Represent Solution Configuration Resource. Required. + :type solution_configuration: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SolutionConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.SolutionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_uri: str, + solution_configuration: str, + resource: Union[_models.SolutionConfiguration, IO[bytes]], + **kwargs: Any + ) -> _models.SolutionConfiguration: + """Create a SolutionConfiguration. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param solution_configuration: Represent Solution Configuration Resource. Required. + :type solution_configuration: str + :param resource: Resource create parameters. Is either a SolutionConfiguration type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.hybridconnectivity.models.SolutionConfiguration or IO[bytes] + :return: SolutionConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.SolutionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SolutionConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "SolutionConfiguration") + + _request = build_create_or_update_request( + resource_uri=resource_uri, + solution_configuration=solution_configuration, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SolutionConfiguration", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_uri: str, + solution_configuration: str, + properties: _models.SolutionConfigurationUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SolutionConfiguration: + """Update a SolutionConfiguration. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param solution_configuration: Represent Solution Configuration Resource. Required. + :type solution_configuration: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.hybridconnectivity.models.SolutionConfigurationUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SolutionConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.SolutionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_uri: str, + solution_configuration: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SolutionConfiguration: + """Update a SolutionConfiguration. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param solution_configuration: Represent Solution Configuration Resource. Required. + :type solution_configuration: str + :param properties: The resource properties to be updated. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SolutionConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.SolutionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_uri: str, + solution_configuration: str, + properties: Union[_models.SolutionConfigurationUpdate, IO[bytes]], + **kwargs: Any + ) -> _models.SolutionConfiguration: + """Update a SolutionConfiguration. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param solution_configuration: Represent Solution Configuration Resource. Required. + :type solution_configuration: str + :param properties: The resource properties to be updated. Is either a + SolutionConfigurationUpdate type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.hybridconnectivity.models.SolutionConfigurationUpdate or + IO[bytes] + :return: SolutionConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.SolutionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SolutionConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "SolutionConfigurationUpdate") + + _request = build_update_request( + resource_uri=resource_uri, + solution_configuration=solution_configuration, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SolutionConfiguration", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_uri: str, solution_configuration: str, **kwargs: Any + ) -> None: + """Delete a SolutionConfiguration. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param solution_configuration: Represent Solution Configuration Resource. Required. + :type solution_configuration: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_uri=resource_uri, + solution_configuration=solution_configuration, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + def _sync_now_initial(self, resource_uri: str, solution_configuration: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_sync_now_request( + resource_uri=resource_uri, + solution_configuration=solution_configuration, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_sync_now( + self, resource_uri: str, solution_configuration: str, **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Trigger immediate sync with source cloud. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :param solution_configuration: Represent Solution Configuration Resource. Required. + :type solution_configuration: str + :return: An instance of LROPoller that returns either OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridconnectivity.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._sync_now_initial( + resource_uri=resource_uri, + solution_configuration=solution_configuration, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_solution_types_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_solution_types_operations.py new file mode 100644 index 000000000000..f0f8306dcaaa --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_solution_types_operations.py @@ -0,0 +1,362 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/solutionTypes" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/solutionTypes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_group_name: str, solution_type: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/solutionTypes/{solutionType}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "solutionType": _SERIALIZER.url("solution_type", solution_type, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class SolutionTypesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridconnectivity.HybridConnectivityMgmtClient`'s + :attr:`solution_types` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SolutionTypeResource"]: + """List SolutionTypeResource resources by subscription ID. + + :return: An iterator like instance of either SolutionTypeResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.hybridconnectivity.models.SolutionTypeResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SolutionTypeResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SolutionTypeResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.SolutionTypeResource"]: + """List SolutionTypeResource resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either SolutionTypeResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.hybridconnectivity.models.SolutionTypeResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SolutionTypeResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SolutionTypeResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, solution_type: str, **kwargs: Any) -> _models.SolutionTypeResource: + """Get a SolutionTypeResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param solution_type: Solution Type resource. Required. + :type solution_type: str + :return: SolutionTypeResource or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.SolutionTypeResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SolutionTypeResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + solution_type=solution_type, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SolutionTypeResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_delete_default.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_delete_default.py index 7df83680ca11..c4fb97fe7cd7 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_delete_default.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_delete_default.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient """ @@ -26,6 +27,7 @@ def main(): client = HybridConnectivityMgmtClient( credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", ) client.endpoints.delete( @@ -34,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsDeleteDefault.json +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/EndpointsDeleteDefault.json if __name__ == "__main__": main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_get_custom.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_get_custom.py index bc072180c67b..fc9965f07807 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_get_custom.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_get_custom.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient """ @@ -26,6 +27,7 @@ def main(): client = HybridConnectivityMgmtClient( credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", ) response = client.endpoints.get( @@ -35,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsGetCustom.json +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/EndpointsGetCustom.json if __name__ == "__main__": main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_get_default.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_get_default.py index dd9b86c2423f..5f8b49c585a4 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_get_default.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_get_default.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient """ @@ -26,6 +27,7 @@ def main(): client = HybridConnectivityMgmtClient( credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", ) response = client.endpoints.get( @@ -35,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsGetDefault.json +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/EndpointsGetDefault.json if __name__ == "__main__": main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_list.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_list.py index e54e863cb6c5..b4c61743810d 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_list.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient """ @@ -26,6 +27,7 @@ def main(): client = HybridConnectivityMgmtClient( credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", ) response = client.endpoints.list( @@ -35,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsList.json +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/EndpointsList.json if __name__ == "__main__": main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_post_list_credentials.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_post_list_credentials.py index 4dbddb4840a0..77ae45f6d817 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_post_list_credentials.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_post_list_credentials.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient """ @@ -26,6 +27,7 @@ def main(): client = HybridConnectivityMgmtClient( credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", ) response = client.endpoints.list_credentials( @@ -35,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsPostListCredentials.json +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/EndpointsPostListCredentials.json if __name__ == "__main__": main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_post_list_ingress_gateway_credentials.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_post_list_ingress_gateway_credentials.py index 7d81166d12a5..f0e857c433aa 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_post_list_ingress_gateway_credentials.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_post_list_ingress_gateway_credentials.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient """ @@ -26,6 +27,7 @@ def main(): client = HybridConnectivityMgmtClient( credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", ) response = client.endpoints.list_ingress_gateway_credentials( @@ -35,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsPostListIngressGatewayCredentials.json +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/EndpointsPostListIngressGatewayCredentials.json if __name__ == "__main__": main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_post_list_managed_proxy_details.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/generate_aws_template_post.py similarity index 71% rename from sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_post_list_managed_proxy_details.py rename to sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/generate_aws_template_post.py index 7e965d1221df..5989f3acbb53 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_post_list_managed_proxy_details.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/generate_aws_template_post.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-hybridconnectivity # USAGE - python endpoints_post_list_managed_proxy_details.py + python generate_aws_template_post.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,16 +27,18 @@ def main(): client = HybridConnectivityMgmtClient( credential=DefaultAzureCredential(), + subscription_id="5ACC4579-DB34-4C2F-8F8C-25061168F342", ) - response = client.endpoints.list_managed_proxy_details( - resource_uri="subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/arcGroup/providers/Microsoft.Compute/virtualMachines/vm00006", - endpoint_name="default", - managed_proxy_request={"hostname": "r.proxy.arc.com", "service": "127.0.0.1:65035", "serviceName": "WAC"}, + response = client.generate_aws_template.post( + generate_aws_template_request={ + "connectorId": "pnxcfjidglabnwxit", + "solutionTypes": [{"solutionSettings": {}, "solutionType": "hjyownzpfxwiufmd"}], + }, ) print(response) -# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsPostListManagedProxyDetails.json +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/GenerateAwsTemplate_Post.json if __name__ == "__main__": main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_patch_default.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/inventory_get.py similarity index 75% rename from sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_patch_default.py rename to sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/inventory_get.py index a6fc5300f2aa..c1198284cc8e 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_patch_default.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/inventory_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-hybridconnectivity # USAGE - python endpoints_patch_default.py + python inventory_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,16 +27,17 @@ def main(): client = HybridConnectivityMgmtClient( credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", ) - response = client.endpoints.update( - resource_uri="subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", - endpoint_name="default", - endpoint_resource={"properties": {"type": "default"}}, + response = client.inventory.get( + resource_uri="ymuj", + solution_configuration="zarfsraogroxlaqjjnwixtn", + inventory_id="xofprmcboosrbd", ) print(response) -# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsPatchDefault.json +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/Inventory_Get.json if __name__ == "__main__": main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/inventory_list_by_solution_configuration.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/inventory_list_by_solution_configuration.py new file mode 100644 index 000000000000..bbfdcf05a4c4 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/inventory_list_by_solution_configuration.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential + +from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridconnectivity +# USAGE + python inventory_list_by_solution_configuration.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HybridConnectivityMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.inventory.list_by_solution_configuration( + resource_uri="ymuj", + solution_configuration="wsxt", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/Inventory_ListBySolutionConfiguration.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/operations_list.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/operations_list.py index c7e72b8c6b33..48a28fd73ef7 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/operations_list.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/operations_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient """ @@ -26,6 +27,7 @@ def main(): client = HybridConnectivityMgmtClient( credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", ) response = client.operations.list() @@ -33,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/OperationsList.json +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/OperationsList.json if __name__ == "__main__": main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_put_custom.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_create_or_update.py similarity index 62% rename from sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_put_custom.py rename to sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_create_or_update.py index 50238e111635..3ec146ea1845 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_put_custom.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-hybridconnectivity # USAGE - python endpoints_put_custom.py + python public_cloud_connectors_create_or_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,21 +27,28 @@ def main(): client = HybridConnectivityMgmtClient( credential=DefaultAzureCredential(), + subscription_id="5ACC4579-DB34-4C2F-8F8C-25061168F342", ) - response = client.endpoints.create_or_update( - resource_uri="subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", - endpoint_name="custom", - endpoint_resource={ + response = client.public_cloud_connectors.begin_create_or_update( + resource_group_name="rgpublicCloud", + public_cloud_connector="advjwoakdusalamomg", + resource={ + "location": "jpiglusfxynfcewcjwvvnn", "properties": { - "resourceId": "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.Relay/namespaces/custom-relay-namespace", - "type": "custom", - } + "awsCloudProfile": { + "accountId": "snbnuxckevyqpm", + "excludedAccounts": ["rwgqpukglvbqmogqcliqolucp"], + "isOrganizationalAccount": True, + }, + "hostType": "AWS", + }, + "tags": {}, }, - ) + ).result() print(response) -# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsPutCustom.json +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/PublicCloudConnectors_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_delete.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_delete.py new file mode 100644 index 000000000000..32b417785c06 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_delete.py @@ -0,0 +1,41 @@ +# 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.identity import DefaultAzureCredential + +from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridconnectivity +# USAGE + python public_cloud_connectors_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HybridConnectivityMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="5ACC4579-DB34-4C2F-8F8C-25061168F342", + ) + + client.public_cloud_connectors.delete( + resource_group_name="rgpublicCloud", + public_cloud_connector="skcfyjvflkhibdywjay", + ) + + +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/PublicCloudConnectors_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_put_default.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_get.py similarity index 75% rename from sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_put_default.py rename to sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_get.py index 8897fb984ec8..1d3eb0d54523 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/endpoints_put_default.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-hybridconnectivity # USAGE - python endpoints_put_default.py + python public_cloud_connectors_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,16 +27,16 @@ def main(): client = HybridConnectivityMgmtClient( credential=DefaultAzureCredential(), + subscription_id="5ACC4579-DB34-4C2F-8F8C-25061168F342", ) - response = client.endpoints.create_or_update( - resource_uri="subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", - endpoint_name="default", - endpoint_resource={"properties": {"type": "default"}}, + response = client.public_cloud_connectors.get( + resource_group_name="rgpublicCloud", + public_cloud_connector="rzygvnpsnrdylwzdbsscjazvamyxmh", ) print(response) -# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/EndpointsPutDefault.json +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/PublicCloudConnectors_Get.json if __name__ == "__main__": main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_list_by_resource_group.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_list_by_resource_group.py new file mode 100644 index 000000000000..2db4d28eb66d --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_list_by_resource_group.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential + +from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridconnectivity +# USAGE + python public_cloud_connectors_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HybridConnectivityMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="5ACC4579-DB34-4C2F-8F8C-25061168F342", + ) + + response = client.public_cloud_connectors.list_by_resource_group( + resource_group_name="rgpublicCloud", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/PublicCloudConnectors_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_list_by_subscription.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_list_by_subscription.py new file mode 100644 index 000000000000..99c02c084ef9 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_list_by_subscription.py @@ -0,0 +1,40 @@ +# 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.identity import DefaultAzureCredential + +from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridconnectivity +# USAGE + python public_cloud_connectors_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HybridConnectivityMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="5ACC4579-DB34-4C2F-8F8C-25061168F342", + ) + + response = client.public_cloud_connectors.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/PublicCloudConnectors_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_test_permissions.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_test_permissions.py new file mode 100644 index 000000000000..8ee13c399167 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_test_permissions.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential + +from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridconnectivity +# USAGE + python public_cloud_connectors_test_permissions.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HybridConnectivityMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="5ACC4579-DB34-4C2F-8F8C-25061168F342", + ) + + response = client.public_cloud_connectors.begin_test_permissions( + resource_group_name="rgpublicCloud", + public_cloud_connector="rzygvnpsnrdylwzdbsscjazvamyxmh", + ).result() + print(response) + + +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/PublicCloudConnectors_TestPermissions.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_patch_ssh.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_update.py similarity index 70% rename from sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_patch_ssh.py rename to sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_update.py index 2df28a7b0c88..9d0cd22a9e59 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_patch_ssh.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/public_cloud_connectors_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-hybridconnectivity # USAGE - python service_configurations_patch_ssh.py + python public_cloud_connectors_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,17 +27,17 @@ def main(): client = HybridConnectivityMgmtClient( credential=DefaultAzureCredential(), + subscription_id="5ACC4579-DB34-4C2F-8F8C-25061168F342", ) - response = client.service_configurations.update( - resource_uri="subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default", - endpoint_name="default", - service_configuration_name="SSH", - service_configuration_resource={"properties": {"port": 22}}, + response = client.public_cloud_connectors.update( + resource_group_name="rgpublicCloud", + public_cloud_connector="svtirlbyqpepbzyessjenlueeznhg", + properties={"properties": {"awsCloudProfile": {"excludedAccounts": ["zrbtd"]}}, "tags": {}}, ) print(response) -# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/ServiceConfigurationsPatchSSH.json +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/PublicCloudConnectors_Update.json if __name__ == "__main__": main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_delete_ssh.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_delete_ssh.py index 2510fcbe6cc4..50ef32287f43 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_delete_ssh.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_delete_ssh.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient """ @@ -26,6 +27,7 @@ def main(): client = HybridConnectivityMgmtClient( credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", ) client.service_configurations.delete( @@ -35,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/ServiceConfigurationsDeleteSSH.json +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/ServiceConfigurationsDeleteSSH.json if __name__ == "__main__": main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_get_ssh.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_get_ssh.py index de4989c4373a..8ec76d010ca7 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_get_ssh.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_get_ssh.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient """ @@ -26,6 +27,7 @@ def main(): client = HybridConnectivityMgmtClient( credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", ) response = client.service_configurations.get( @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/ServiceConfigurationsGetSSH.json +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/ServiceConfigurationsGetSSH.json if __name__ == "__main__": main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_get_wac.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_get_wac.py index 575c9fa40d4a..4697917b44cb 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_get_wac.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_get_wac.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient """ @@ -26,6 +27,7 @@ def main(): client = HybridConnectivityMgmtClient( credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", ) response = client.service_configurations.get( @@ -36,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/ServiceConfigurationsGetWAC.json +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/ServiceConfigurationsGetWAC.json if __name__ == "__main__": main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_list.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_list.py index 82a9aa2a2ce0..298fbae5c24f 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_list.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient """ @@ -26,6 +27,7 @@ def main(): client = HybridConnectivityMgmtClient( credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", ) response = client.service_configurations.list_by_endpoint_resource( @@ -36,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/ServiceConfigurationsList.json +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/ServiceConfigurationsList.json if __name__ == "__main__": main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_put_ssh.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_put_ssh.py deleted file mode 100644 index 7ed87cd6c357..000000000000 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_put_ssh.py +++ /dev/null @@ -1,42 +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.identity import DefaultAzureCredential -from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-hybridconnectivity -# USAGE - python service_configurations_put_ssh.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = HybridConnectivityMgmtClient( - credential=DefaultAzureCredential(), - ) - - response = client.service_configurations.create_orupdate( - resource_uri="subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default", - endpoint_name="default", - service_configuration_name="SSH", - service_configuration_resource={"properties": {"port": 22, "serviceName": "SSH"}}, - ) - print(response) - - -# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/ServiceConfigurationsPutSSH.json -if __name__ == "__main__": - main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_put_wac.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_put_wac.py deleted file mode 100644 index d6e075bf71ad..000000000000 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/service_configurations_put_wac.py +++ /dev/null @@ -1,42 +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.identity import DefaultAzureCredential -from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-hybridconnectivity -# USAGE - python service_configurations_put_wac.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = HybridConnectivityMgmtClient( - credential=DefaultAzureCredential(), - ) - - response = client.service_configurations.create_orupdate( - resource_uri="subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default", - endpoint_name="default", - service_configuration_name="WAC", - service_configuration_resource={"properties": {"port": 6516, "serviceName": "WAC"}}, - ) - print(response) - - -# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2023-03-15/examples/ServiceConfigurationsPutWAC.json -if __name__ == "__main__": - main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_create_or_update.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_create_or_update.py new file mode 100644 index 000000000000..3e8aa5045a58 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_create_or_update.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential + +from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridconnectivity +# USAGE + python solution_configurations_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HybridConnectivityMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.solution_configurations.create_or_update( + resource_uri="ymuj", + solution_configuration="keebwujt", + resource={"properties": {"solutionSettings": {}, "solutionType": "nmtqllkyohwtsthxaimsye"}}, + ) + print(response) + + +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionConfigurations_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_delete.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_delete.py new file mode 100644 index 000000000000..3c0f62108f90 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_delete.py @@ -0,0 +1,41 @@ +# 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.identity import DefaultAzureCredential + +from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridconnectivity +# USAGE + python solution_configurations_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HybridConnectivityMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.solution_configurations.delete( + resource_uri="ymuj", + solution_configuration="stu", + ) + + +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionConfigurations_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_get.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_get.py new file mode 100644 index 000000000000..9dc0e9f47288 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_get.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential + +from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridconnectivity +# USAGE + python solution_configurations_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HybridConnectivityMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.solution_configurations.get( + resource_uri="ymuj", + solution_configuration="tks", + ) + print(response) + + +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionConfigurations_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_list.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_list.py new file mode 100644 index 000000000000..0ef5f060614e --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_list.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential + +from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridconnectivity +# USAGE + python solution_configurations_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HybridConnectivityMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.solution_configurations.list( + resource_uri="ymuj", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionConfigurations_List.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_sync_now.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_sync_now.py new file mode 100644 index 000000000000..4f4bac4a947b --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_sync_now.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential + +from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridconnectivity +# USAGE + python solution_configurations_sync_now.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HybridConnectivityMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.solution_configurations.begin_sync_now( + resource_uri="ymuj", + solution_configuration="tks", + ).result() + print(response) + + +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionConfigurations_SyncNow.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_update.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_update.py new file mode 100644 index 000000000000..61c14d98d673 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_configurations_update.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential + +from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridconnectivity +# USAGE + python solution_configurations_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HybridConnectivityMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.solution_configurations.update( + resource_uri="ymuj", + solution_configuration="dxt", + properties={"properties": {"solutionSettings": {}, "solutionType": "myzljlstvmgkp"}}, + ) + print(response) + + +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionConfigurations_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_types_get.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_types_get.py new file mode 100644 index 000000000000..eac180b44ba2 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_types_get.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential + +from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridconnectivity +# USAGE + python solution_types_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HybridConnectivityMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="5ACC4579-DB34-4C2F-8F8C-25061168F342", + ) + + response = client.solution_types.get( + resource_group_name="rgpublicCloud", + solution_type="lulzqllpu", + ) + print(response) + + +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionTypes_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_types_list_by_resource_group.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_types_list_by_resource_group.py new file mode 100644 index 000000000000..89d4284bf8ca --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_types_list_by_resource_group.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential + +from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridconnectivity +# USAGE + python solution_types_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HybridConnectivityMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="5ACC4579-DB34-4C2F-8F8C-25061168F342", + ) + + response = client.solution_types.list_by_resource_group( + resource_group_name="rgpublicCloud", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionTypes_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_types_list_by_subscription.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_types_list_by_subscription.py new file mode 100644 index 000000000000..722aaf169921 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_samples/solution_types_list_by_subscription.py @@ -0,0 +1,40 @@ +# 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.identity import DefaultAzureCredential + +from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridconnectivity +# USAGE + python solution_types_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HybridConnectivityMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="5ACC4579-DB34-4C2F-8F8C-25061168F342", + ) + + response = client.solution_types.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionTypes_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/conftest.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/conftest.py new file mode 100644 index 000000000000..e338e473478e --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/conftest.py @@ -0,0 +1,41 @@ +# 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 os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# aovid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + hybridconnectivitymgmt_subscription_id = os.environ.get( + "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + hybridconnectivitymgmt_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + hybridconnectivitymgmt_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + hybridconnectivitymgmt_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer( + regex=hybridconnectivitymgmt_subscription_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer(regex=hybridconnectivitymgmt_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=hybridconnectivitymgmt_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer( + regex=hybridconnectivitymgmt_client_secret, value="00000000-0000-0000-0000-000000000000" + ) + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_endpoints_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_endpoints_operations.py new file mode 100644 index 000000000000..039b47fb4585 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_endpoints_operations.py @@ -0,0 +1,143 @@ +# 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 pytest +from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHybridConnectivityMgmtEndpointsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HybridConnectivityMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.endpoints.list( + resource_uri="str", + api_version="2024-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.endpoints.get( + resource_uri="str", + endpoint_name="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.endpoints.create_or_update( + resource_uri="str", + endpoint_name="str", + endpoint_resource={ + "id": "str", + "name": "str", + "properties": {"type": "str", "provisioningState": "str", "resourceId": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.endpoints.update( + resource_uri="str", + endpoint_name="str", + endpoint_resource={ + "id": "str", + "name": "str", + "properties": {"type": "str", "provisioningState": "str", "resourceId": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.endpoints.delete( + resource_uri="str", + endpoint_name="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_credentials(self, resource_group): + response = self.client.endpoints.list_credentials( + resource_uri="str", + endpoint_name="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_ingress_gateway_credentials(self, resource_group): + response = self.client.endpoints.list_ingress_gateway_credentials( + resource_uri="str", + endpoint_name="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_managed_proxy_details(self, resource_group): + response = self.client.endpoints.list_managed_proxy_details( + resource_uri="str", + endpoint_name="str", + managed_proxy_request={"service": "str", "hostname": "str", "serviceName": "str"}, + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_endpoints_operations_async.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_endpoints_operations_async.py new file mode 100644 index 000000000000..8bf36a73e1a9 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_endpoints_operations_async.py @@ -0,0 +1,144 @@ +# 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 pytest +from azure.mgmt.hybridconnectivity.aio import HybridConnectivityMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHybridConnectivityMgmtEndpointsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HybridConnectivityMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.endpoints.list( + resource_uri="str", + api_version="2024-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.endpoints.get( + resource_uri="str", + endpoint_name="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.endpoints.create_or_update( + resource_uri="str", + endpoint_name="str", + endpoint_resource={ + "id": "str", + "name": "str", + "properties": {"type": "str", "provisioningState": "str", "resourceId": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.endpoints.update( + resource_uri="str", + endpoint_name="str", + endpoint_resource={ + "id": "str", + "name": "str", + "properties": {"type": "str", "provisioningState": "str", "resourceId": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.endpoints.delete( + resource_uri="str", + endpoint_name="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_credentials(self, resource_group): + response = await self.client.endpoints.list_credentials( + resource_uri="str", + endpoint_name="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_ingress_gateway_credentials(self, resource_group): + response = await self.client.endpoints.list_ingress_gateway_credentials( + resource_uri="str", + endpoint_name="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_managed_proxy_details(self, resource_group): + response = await self.client.endpoints.list_managed_proxy_details( + resource_uri="str", + endpoint_name="str", + managed_proxy_request={"service": "str", "hostname": "str", "serviceName": "str"}, + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_generate_aws_template_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_generate_aws_template_operations.py new file mode 100644 index 000000000000..e19760beac65 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_generate_aws_template_operations.py @@ -0,0 +1,33 @@ +# 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 pytest +from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHybridConnectivityMgmtGenerateAwsTemplateOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HybridConnectivityMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_post(self, resource_group): + response = self.client.generate_aws_template.post( + generate_aws_template_request={ + "connectorId": "str", + "solutionTypes": [{"solutionType": "str", "solutionSettings": {"str": "str"}}], + }, + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_generate_aws_template_operations_async.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_generate_aws_template_operations_async.py new file mode 100644 index 000000000000..01b042cf843f --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_generate_aws_template_operations_async.py @@ -0,0 +1,34 @@ +# 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 pytest +from azure.mgmt.hybridconnectivity.aio import HybridConnectivityMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHybridConnectivityMgmtGenerateAwsTemplateOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HybridConnectivityMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_post(self, resource_group): + response = await self.client.generate_aws_template.post( + generate_aws_template_request={ + "connectorId": "str", + "solutionTypes": [{"solutionType": "str", "solutionSettings": {"str": "str"}}], + }, + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_inventory_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_inventory_operations.py new file mode 100644 index 000000000000..1cf97e7791b8 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_inventory_operations.py @@ -0,0 +1,44 @@ +# 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 pytest +from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHybridConnectivityMgmtInventoryOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HybridConnectivityMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_solution_configuration(self, resource_group): + response = self.client.inventory.list_by_solution_configuration( + resource_uri="str", + solution_configuration="str", + api_version="2024-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.inventory.get( + resource_uri="str", + solution_configuration="str", + inventory_id="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_inventory_operations_async.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_inventory_operations_async.py new file mode 100644 index 000000000000..675b7a816d9a --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_inventory_operations_async.py @@ -0,0 +1,45 @@ +# 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 pytest +from azure.mgmt.hybridconnectivity.aio import HybridConnectivityMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHybridConnectivityMgmtInventoryOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HybridConnectivityMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_solution_configuration(self, resource_group): + response = self.client.inventory.list_by_solution_configuration( + resource_uri="str", + solution_configuration="str", + api_version="2024-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.inventory.get( + resource_uri="str", + solution_configuration="str", + inventory_id="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_operations.py new file mode 100644 index 000000000000..dcad9689ceb0 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_operations.py @@ -0,0 +1,29 @@ +# 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 pytest +from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHybridConnectivityMgmtOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HybridConnectivityMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_operations_async.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_operations_async.py new file mode 100644 index 000000000000..0d4a640ec444 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_operations_async.py @@ -0,0 +1,30 @@ +# 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 pytest +from azure.mgmt.hybridconnectivity.aio import HybridConnectivityMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHybridConnectivityMgmtOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HybridConnectivityMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_public_cloud_connectors_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_public_cloud_connectors_operations.py new file mode 100644 index 000000000000..63562d1e8057 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_public_cloud_connectors_operations.py @@ -0,0 +1,140 @@ +# 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 pytest +from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHybridConnectivityMgmtPublicCloudConnectorsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HybridConnectivityMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.public_cloud_connectors.list_by_subscription( + api_version="2024-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.public_cloud_connectors.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.public_cloud_connectors.get( + resource_group_name=resource_group.name, + public_cloud_connector="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.public_cloud_connectors.begin_create_or_update( + resource_group_name=resource_group.name, + public_cloud_connector="str", + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "awsCloudProfile": { + "accountId": "str", + "excludedAccounts": ["str"], + "isOrganizationalAccount": False, + }, + "hostType": "str", + "connectorPrimaryIdentifier": "str", + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.public_cloud_connectors.update( + resource_group_name=resource_group.name, + public_cloud_connector="str", + properties={ + "id": "str", + "name": "str", + "properties": {"awsCloudProfile": {"excludedAccounts": ["str"]}}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.public_cloud_connectors.delete( + resource_group_name=resource_group.name, + public_cloud_connector="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_test_permissions(self, resource_group): + response = self.client.public_cloud_connectors.begin_test_permissions( + resource_group_name=resource_group.name, + public_cloud_connector="str", + api_version="2024-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_public_cloud_connectors_operations_async.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_public_cloud_connectors_operations_async.py new file mode 100644 index 000000000000..a8b296121312 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_public_cloud_connectors_operations_async.py @@ -0,0 +1,145 @@ +# 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 pytest +from azure.mgmt.hybridconnectivity.aio import HybridConnectivityMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHybridConnectivityMgmtPublicCloudConnectorsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HybridConnectivityMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.public_cloud_connectors.list_by_subscription( + api_version="2024-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.public_cloud_connectors.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.public_cloud_connectors.get( + resource_group_name=resource_group.name, + public_cloud_connector="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.public_cloud_connectors.begin_create_or_update( + resource_group_name=resource_group.name, + public_cloud_connector="str", + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "awsCloudProfile": { + "accountId": "str", + "excludedAccounts": ["str"], + "isOrganizationalAccount": False, + }, + "hostType": "str", + "connectorPrimaryIdentifier": "str", + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.public_cloud_connectors.update( + resource_group_name=resource_group.name, + public_cloud_connector="str", + properties={ + "id": "str", + "name": "str", + "properties": {"awsCloudProfile": {"excludedAccounts": ["str"]}}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.public_cloud_connectors.delete( + resource_group_name=resource_group.name, + public_cloud_connector="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_test_permissions(self, resource_group): + response = await ( + await self.client.public_cloud_connectors.begin_test_permissions( + resource_group_name=resource_group.name, + public_cloud_connector="str", + api_version="2024-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_service_configurations_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_service_configurations_operations.py new file mode 100644 index 000000000000..23499f801aa8 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_service_configurations_operations.py @@ -0,0 +1,101 @@ +# 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 pytest +from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHybridConnectivityMgmtServiceConfigurationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HybridConnectivityMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_endpoint_resource(self, resource_group): + response = self.client.service_configurations.list_by_endpoint_resource( + resource_uri="str", + endpoint_name="str", + api_version="2024-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.service_configurations.get( + resource_uri="str", + endpoint_name="str", + service_configuration_name="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_orupdate(self, resource_group): + response = self.client.service_configurations.create_orupdate( + resource_uri="str", + endpoint_name="str", + service_configuration_name="str", + service_configuration_resource={ + "id": "str", + "name": "str", + "port": 0, + "provisioningState": "str", + "resourceId": "str", + "serviceName": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.service_configurations.update( + resource_uri="str", + endpoint_name="str", + service_configuration_name="str", + service_configuration_resource={"port": 0}, + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.service_configurations.delete( + resource_uri="str", + endpoint_name="str", + service_configuration_name="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_service_configurations_operations_async.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_service_configurations_operations_async.py new file mode 100644 index 000000000000..14b9e1ffe973 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_service_configurations_operations_async.py @@ -0,0 +1,102 @@ +# 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 pytest +from azure.mgmt.hybridconnectivity.aio import HybridConnectivityMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHybridConnectivityMgmtServiceConfigurationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HybridConnectivityMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_endpoint_resource(self, resource_group): + response = self.client.service_configurations.list_by_endpoint_resource( + resource_uri="str", + endpoint_name="str", + api_version="2024-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.service_configurations.get( + resource_uri="str", + endpoint_name="str", + service_configuration_name="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_orupdate(self, resource_group): + response = await self.client.service_configurations.create_orupdate( + resource_uri="str", + endpoint_name="str", + service_configuration_name="str", + service_configuration_resource={ + "id": "str", + "name": "str", + "port": 0, + "provisioningState": "str", + "resourceId": "str", + "serviceName": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.service_configurations.update( + resource_uri="str", + endpoint_name="str", + service_configuration_name="str", + service_configuration_resource={"port": 0}, + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.service_configurations.delete( + resource_uri="str", + endpoint_name="str", + service_configuration_name="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_solution_configurations_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_solution_configurations_operations.py new file mode 100644 index 000000000000..5ffd5de31fb9 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_solution_configurations_operations.py @@ -0,0 +1,125 @@ +# 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 pytest +from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHybridConnectivityMgmtSolutionConfigurationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HybridConnectivityMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.solution_configurations.list( + resource_uri="str", + api_version="2024-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.solution_configurations.get( + resource_uri="str", + solution_configuration="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.solution_configurations.create_or_update( + resource_uri="str", + solution_configuration="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "solutionType": "str", + "lastSyncTime": "2020-02-20 00:00:00", + "provisioningState": "str", + "solutionSettings": {"str": "str"}, + "status": "str", + "statusDetails": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.solution_configurations.update( + resource_uri="str", + solution_configuration="str", + properties={ + "id": "str", + "name": "str", + "properties": {"solutionSettings": {"str": "str"}, "solutionType": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.solution_configurations.delete( + resource_uri="str", + solution_configuration="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_sync_now(self, resource_group): + response = self.client.solution_configurations.begin_sync_now( + resource_uri="str", + solution_configuration="str", + api_version="2024-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_solution_configurations_operations_async.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_solution_configurations_operations_async.py new file mode 100644 index 000000000000..2fd03dd846e1 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_solution_configurations_operations_async.py @@ -0,0 +1,128 @@ +# 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 pytest +from azure.mgmt.hybridconnectivity.aio import HybridConnectivityMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHybridConnectivityMgmtSolutionConfigurationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HybridConnectivityMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.solution_configurations.list( + resource_uri="str", + api_version="2024-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.solution_configurations.get( + resource_uri="str", + solution_configuration="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.solution_configurations.create_or_update( + resource_uri="str", + solution_configuration="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "solutionType": "str", + "lastSyncTime": "2020-02-20 00:00:00", + "provisioningState": "str", + "solutionSettings": {"str": "str"}, + "status": "str", + "statusDetails": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.solution_configurations.update( + resource_uri="str", + solution_configuration="str", + properties={ + "id": "str", + "name": "str", + "properties": {"solutionSettings": {"str": "str"}, "solutionType": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.solution_configurations.delete( + resource_uri="str", + solution_configuration="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_sync_now(self, resource_group): + response = await ( + await self.client.solution_configurations.begin_sync_now( + resource_uri="str", + solution_configuration="str", + api_version="2024-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_solution_types_operations.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_solution_types_operations.py new file mode 100644 index 000000000000..90a1a8b7a030 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_solution_types_operations.py @@ -0,0 +1,52 @@ +# 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 pytest +from azure.mgmt.hybridconnectivity import HybridConnectivityMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHybridConnectivityMgmtSolutionTypesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HybridConnectivityMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.solution_types.list_by_subscription( + api_version="2024-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.solution_types.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.solution_types.get( + resource_group_name=resource_group.name, + solution_type="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_solution_types_operations_async.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_solution_types_operations_async.py new file mode 100644 index 000000000000..b65c9bd23c26 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/generated_tests/test_hybrid_connectivity_mgmt_solution_types_operations_async.py @@ -0,0 +1,53 @@ +# 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 pytest +from azure.mgmt.hybridconnectivity.aio import HybridConnectivityMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHybridConnectivityMgmtSolutionTypesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HybridConnectivityMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.solution_types.list_by_subscription( + api_version="2024-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.solution_types.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.solution_types.get( + resource_group_name=resource_group.name, + solution_type="str", + api_version="2024-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/setup.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/setup.py index 282e12af2d5a..da32d886c7aa 100644 --- a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/setup.py +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/setup.py @@ -53,11 +53,11 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -74,10 +74,10 @@ "pytyped": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", - "typing-extensions>=4.3.0; python_version<'3.8.0'", + "isodate>=0.6.1", + "typing-extensions>=4.6.0", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", ], - python_requires=">=3.7", + python_requires=">=3.8", )