From f72fe6258b6e629b35ef75c34fb7a47abddc15ea Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 20 Apr 2022 02:58:03 +0000 Subject: [PATCH] CodeGen from PR 18741 in Azure/azure-rest-api-specs [Hub Generated] Publish private branch 'main' (#18741) * Promote 2022-05-01-preview api from RPSaaSMaster to main * Fixing lint errors --- .../CHANGELOG.md | 5 + .../azure-mgmt-hybridconnectivity/LICENSE | 21 + .../azure-mgmt-hybridconnectivity/MANIFEST.in | 6 + .../azure-mgmt-hybridconnectivity/README.md | 30 + .../azure-mgmt-hybridconnectivity/_meta.json | 11 + .../azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../azure/mgmt/hybridconnectivity/__init__.py | 18 + .../mgmt/hybridconnectivity/_configuration.py | 67 ++ .../_hybrid_connectivity_management_api.py | 95 +++ .../mgmt/hybridconnectivity/_metadata.json | 91 +++ .../azure/mgmt/hybridconnectivity/_patch.py | 31 + .../azure/mgmt/hybridconnectivity/_vendor.py | 27 + .../azure/mgmt/hybridconnectivity/_version.py | 9 + .../mgmt/hybridconnectivity/aio/__init__.py | 15 + .../hybridconnectivity/aio/_configuration.py | 66 ++ .../_hybrid_connectivity_management_api.py | 92 +++ .../mgmt/hybridconnectivity/aio/_patch.py | 31 + .../aio/operations/__init__.py | 15 + .../aio/operations/_endpoints_operations.py | 499 ++++++++++++ .../aio/operations/_operations.py | 116 +++ .../hybridconnectivity/models/__init__.py | 51 ++ ...ybrid_connectivity_management_api_enums.py | 43 + .../hybridconnectivity/models/_models_py3.py | 676 ++++++++++++++++ .../hybridconnectivity/operations/__init__.py | 15 + .../operations/_endpoints_operations.py | 765 ++++++++++++++++++ .../operations/_operations.py | 144 ++++ .../azure/mgmt/hybridconnectivity/py.typed | 1 + .../sdk_packaging.toml | 9 + .../azure-mgmt-hybridconnectivity/setup.py | 74 ++ sdk/hybridconnectivity/ci.yml | 33 + 31 files changed, 3058 insertions(+) create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/CHANGELOG.md create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/LICENSE create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/MANIFEST.in create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/README.md create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/_meta.json create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/__init__.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/__init__.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/__init__.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_configuration.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_hybrid_connectivity_management_api.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_metadata.json create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_patch.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_vendor.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_version.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/__init__.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/_configuration.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/_hybrid_connectivity_management_api.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/_patch.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/__init__.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_endpoints_operations.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_operations.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/models/__init__.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/models/_hybrid_connectivity_management_api_enums.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/models/_models_py3.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/__init__.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_endpoints_operations.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_operations.py create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/py.typed create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/sdk_packaging.toml create mode 100644 sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/setup.py create mode 100644 sdk/hybridconnectivity/ci.yml diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/CHANGELOG.md b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/LICENSE b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/LICENSE new file mode 100644 index 000000000000..b2f52a2bad4e --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/MANIFEST.in b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/MANIFEST.in new file mode 100644 index 000000000000..2c31e8da0cb1 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/MANIFEST.in @@ -0,0 +1,6 @@ +include _meta.json +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include LICENSE diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/README.md b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/README.md new file mode 100644 index 000000000000..6aaada13c617 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/README.md @@ -0,0 +1,30 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +This package has been tested with Python 3.6+. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + +## _Disclaimer_ + +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +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 new file mode 100644 index 000000000000..fd00dfee0073 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.7.2", + "use": [ + "@autorest/python@5.13.0", + "@autorest/modelerfour@4.19.3" + ], + "commit": "63d993b2d6ea1f7ff96129a0ea768ed86ec27a8f", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/hybridconnectivity/resource-manager/readme.md --multiapi --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "readme": "specification/hybridconnectivity/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/__init__.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/__init__.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/__init__.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/__init__.py new file mode 100644 index 000000000000..022488cb71b8 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/__init__.py @@ -0,0 +1,18 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._hybrid_connectivity_management_api import HybridConnectivityManagementAPI +from ._version import VERSION + +__version__ = VERSION +__all__ = ['HybridConnectivityManagementAPI'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_configuration.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_configuration.py new file mode 100644 index 000000000000..4c082fc7c983 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class HybridConnectivityManagementAPIConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for HybridConnectivityManagementAPI. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :keyword api_version: Api Version. Default value is "2022-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + **kwargs: Any + ) -> None: + super(HybridConnectivityManagementAPIConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.credential = credential + 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._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_hybrid_connectivity_management_api.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_hybrid_connectivity_management_api.py new file mode 100644 index 000000000000..9e9a794187b4 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_hybrid_connectivity_management_api.py @@ -0,0 +1,95 @@ +# 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 copy import deepcopy +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models +from ._configuration import HybridConnectivityManagementAPIConfiguration +from .operations import EndpointsOperations, Operations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +class HybridConnectivityManagementAPI: + """REST API for Hybrid Connectivity. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.hybridconnectivity.operations.Operations + :ivar endpoints: EndpointsOperations operations + :vartype endpoints: azure.mgmt.hybridconnectivity.operations.EndpointsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = HybridConnectivityManagementAPIConfiguration(credential=credential, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.endpoints = EndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> HybridConnectivityManagementAPI + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_metadata.json b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_metadata.json new file mode 100644 index 000000000000..5c2e59487b4f --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_metadata.json @@ -0,0 +1,91 @@ +{ + "chosen_version": "2022-05-01-preview", + "total_api_version_list": ["2022-05-01-preview"], + "client": { + "name": "HybridConnectivityManagementAPI", + "filename": "_hybrid_connectivity_management_api", + "description": "REST API for Hybrid Connectivity.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": false, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"HybridConnectivityManagementAPIConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"HybridConnectivityManagementAPIConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + } + }, + "constant": { + }, + "call": "credential", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=\"https://management.azure.com\", # type: str", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "endpoints": "EndpointsOperations" + } +} \ No newline at end of file diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_patch.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_vendor.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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 + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_version.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/_version.py @@ -0,0 +1,9 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/__init__.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/__init__.py new file mode 100644 index 000000000000..848f9136dcb3 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/__init__.py @@ -0,0 +1,15 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._hybrid_connectivity_management_api import HybridConnectivityManagementAPI +__all__ = ['HybridConnectivityManagementAPI'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() 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 new file mode 100644 index 000000000000..2d0c0dd02532 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class HybridConnectivityManagementAPIConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for HybridConnectivityManagementAPI. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: Api Version. Default value is "2022-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: + super(HybridConnectivityManagementAPIConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.credential = credential + 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._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/_hybrid_connectivity_management_api.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/_hybrid_connectivity_management_api.py new file mode 100644 index 000000000000..3d26b75b649d --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/_hybrid_connectivity_management_api.py @@ -0,0 +1,92 @@ +# 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 copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models +from ._configuration import HybridConnectivityManagementAPIConfiguration +from .operations import EndpointsOperations, Operations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class HybridConnectivityManagementAPI: + """REST API for Hybrid Connectivity. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.hybridconnectivity.aio.operations.Operations + :ivar endpoints: EndpointsOperations operations + :vartype endpoints: azure.mgmt.hybridconnectivity.aio.operations.EndpointsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = HybridConnectivityManagementAPIConfiguration(credential=credential, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.endpoints = EndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "HybridConnectivityManagementAPI": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/_patch.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file 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 new file mode 100644 index 000000000000..d9149323f403 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/__init__.py @@ -0,0 +1,15 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._endpoints_operations import EndpointsOperations + +__all__ = [ + 'Operations', + 'EndpointsOperations', +] diff --git a/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 new file mode 100644 index 000000000000..b31841c6e686 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_endpoints_operations.py @@ -0,0 +1,499 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +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, build_get_request, build_list_credentials_request, build_list_managed_proxy_details_request, build_list_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class EndpointsOperations: + """EndpointsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.hybridconnectivity.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_uri: str, + **kwargs: Any + ) -> AsyncIterable["_models.EndpointsList"]: + """List of endpoints to the target resource. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to + be connected. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EndpointsList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridconnectivity.models.EndpointsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_uri: str, + endpoint_name: str, + **kwargs: Any + ) -> "_models.EndpointResource": + """Gets the endpoint to the resource. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to + be connected. + :type resource_uri: str + :param endpoint_name: The endpoint name. + :type endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointResource, or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.EndpointResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + resource_uri=resource_uri, + endpoint_name=endpoint_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EndpointResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}"} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_uri: str, + endpoint_name: str, + endpoint_resource: "_models.EndpointResource", + **kwargs: Any + ) -> "_models.EndpointResource": + """Create or update the endpoint to the target resource. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to + be connected. + :type resource_uri: str + :param endpoint_name: The endpoint name. + :type endpoint_name: str + :param endpoint_resource: Endpoint details. + :type endpoint_resource: ~azure.mgmt.hybridconnectivity.models.EndpointResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointResource, or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.EndpointResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(endpoint_resource, 'EndpointResource') + + request = build_create_or_update_request( + resource_uri=resource_uri, + endpoint_name=endpoint_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EndpointResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}"} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_uri: str, + endpoint_name: str, + endpoint_resource: "_models.EndpointResource", + **kwargs: Any + ) -> "_models.EndpointResource": + """Update the endpoint to the target resource. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to + be connected. + :type resource_uri: str + :param endpoint_name: The endpoint name. + :type endpoint_name: str + :param endpoint_resource: Endpoint details. + :type endpoint_resource: ~azure.mgmt.hybridconnectivity.models.EndpointResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointResource, or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.EndpointResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(endpoint_resource, 'EndpointResource') + + request = build_update_request( + resource_uri=resource_uri, + endpoint_name=endpoint_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EndpointResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_uri: str, + endpoint_name: str, + **kwargs: Any + ) -> None: + """Deletes the endpoint access to the target resource. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to + be connected. + :type resource_uri: str + :param endpoint_name: The endpoint name. + :type endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request( + resource_uri=resource_uri, + endpoint_name=endpoint_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}"} # type: ignore + + + @distributed_trace_async + async def list_credentials( + self, + resource_uri: str, + endpoint_name: str, + expiresin: Optional[int] = 10800, + **kwargs: Any + ) -> "_models.EndpointAccessResource": + """Gets the endpoint access credentials to the resource. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to + be connected. + :type resource_uri: str + :param endpoint_name: The endpoint name. + :type endpoint_name: str + :param expiresin: The is how long the endpoint access token is valid (in seconds). Default + value is 10800. + :type expiresin: long + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointAccessResource, or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.EndpointAccessResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointAccessResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_list_credentials_request( + resource_uri=resource_uri, + endpoint_name=endpoint_name, + api_version=api_version, + expiresin=expiresin, + template_url=self.list_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EndpointAccessResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_credentials.metadata = {'url': "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listCredentials"} # type: ignore + + + @distributed_trace_async + async def list_managed_proxy_details( + self, + resource_uri: str, + endpoint_name: str, + managed_proxy_request: "_models.ManagedProxyRequest", + **kwargs: Any + ) -> "_models.ManagedProxyResource": + """Fetches the managed proxy details. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to + be connected. + :type resource_uri: str + :param endpoint_name: The endpoint name. + :type endpoint_name: str + :param managed_proxy_request: Object of type ManagedProxyRequest. + :type managed_proxy_request: ~azure.mgmt.hybridconnectivity.models.ManagedProxyRequest + :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 + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedProxyResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(managed_proxy_request, 'ManagedProxyRequest') + + 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, + template_url=self.list_managed_proxy_details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedProxyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_managed_proxy_details.metadata = {'url': "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listManagedProxyDetails"} # 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 new file mode 100644 index 000000000000..dd37d612a652 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/aio/operations/_operations.py @@ -0,0 +1,116 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.hybridconnectivity.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists the available Hybrid Connectivity REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridconnectivity.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/providers/Microsoft.HybridConnectivity/operations"} # type: ignore diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/models/__init__.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/models/__init__.py new file mode 100644 index 000000000000..f30a0cc4f098 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/models/__init__.py @@ -0,0 +1,51 @@ +# 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 ._models_py3 import EndpointAccessResource +from ._models_py3 import EndpointResource +from ._models_py3 import EndpointsList +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import IngressGatewayResource +from ._models_py3 import ManagedProxyRequest +from ._models_py3 import ManagedProxyResource +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import ProxyResource +from ._models_py3 import Resource + + +from ._hybrid_connectivity_management_api_enums import ( + ActionType, + CreatedByType, + Origin, + Type, +) + +__all__ = [ + 'EndpointAccessResource', + 'EndpointResource', + 'EndpointsList', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'IngressGatewayResource', + 'ManagedProxyRequest', + 'ManagedProxyResource', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'ProxyResource', + 'Resource', + 'ActionType', + 'CreatedByType', + 'Origin', + 'Type', +] diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/models/_hybrid_connectivity_management_api_enums.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/models/_hybrid_connectivity_management_api_enums.py new file mode 100644 index 000000000000..327b5b8b973d --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/models/_hybrid_connectivity_management_api_enums.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 enum import Enum +from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta + + +class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + """ + + INTERNAL = "Internal" + +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class Origin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system" + """ + + USER = "user" + SYSTEM = "system" + USER_SYSTEM = "user,system" + +class Type(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of endpoint. + """ + + DEFAULT = "default" + CUSTOM = "custom" diff --git a/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 new file mode 100644 index 000000000000..f95e826bf2c4 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/models/_models_py3.py @@ -0,0 +1,676 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._hybrid_connectivity_management_api_enums import * + + +class EndpointAccessResource(msrest.serialization.Model): + """The endpoint access for the target resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar namespace_name: The namespace name. + :vartype namespace_name: str + :ivar namespace_name_suffix: The suffix domain name of relay namespace. + :vartype namespace_name_suffix: str + :ivar hybrid_connection_name: Azure Relay hybrid connection name for the resource. + :vartype hybrid_connection_name: str + :ivar access_key: Access key for hybrid connection. + :vartype access_key: str + :ivar expires_on: The expiration of access key in unix time. + :vartype expires_on: long + """ + + _validation = { + 'namespace_name': {'max_length': 200, 'min_length': 1}, + 'namespace_name_suffix': {'max_length': 100, 'min_length': 1}, + 'access_key': {'readonly': True}, + } + + _attribute_map = { + 'namespace_name': {'key': 'relay.namespaceName', 'type': 'str'}, + 'namespace_name_suffix': {'key': 'relay.namespaceNameSuffix', 'type': 'str'}, + 'hybrid_connection_name': {'key': 'relay.hybridConnectionName', 'type': 'str'}, + 'access_key': {'key': 'relay.accessKey', 'type': 'str'}, + 'expires_on': {'key': 'relay.expiresOn', 'type': 'long'}, + } + + def __init__( + self, + *, + namespace_name: Optional[str] = None, + namespace_name_suffix: Optional[str] = None, + hybrid_connection_name: Optional[str] = None, + expires_on: Optional[int] = None, + **kwargs + ): + """ + :keyword namespace_name: The namespace name. + :paramtype namespace_name: str + :keyword namespace_name_suffix: The suffix domain name of relay namespace. + :paramtype namespace_name_suffix: str + :keyword hybrid_connection_name: Azure Relay hybrid connection name for the resource. + :paramtype hybrid_connection_name: str + :keyword expires_on: The expiration of access key in unix time. + :paramtype expires_on: long + """ + super(EndpointAccessResource, self).__init__(**kwargs) + self.namespace_name = namespace_name + self.namespace_name_suffix = namespace_name_suffix + self.hybrid_connection_name = hybrid_connection_name + self.access_key = None + self.expires_on = expires_on + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ProxyResource, self).__init__(**kwargs) + + +class EndpointResource(ProxyResource): + """The endpoint for the target resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar type_properties_type: The type of endpoint. Possible values include: "default", "custom". + :vartype type_properties_type: str or ~azure.mgmt.hybridconnectivity.models.Type + :ivar resource_id: The resource Id of the connectivity endpoint (optional). + :vartype resource_id: str + :ivar provisioning_state: The resource provisioning state. + :vartype provisioning_state: str + :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. Possible values include: + "User", "Application", "ManagedIdentity", "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. Possible + values include: "User", "Application", "ManagedIdentity", "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 + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, + 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'created_by': {'key': 'systemData.createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'systemData.createdByType', 'type': 'str'}, + 'created_at': {'key': 'systemData.createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'systemData.lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'systemData.lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'systemData.lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + type_properties_type: Optional[Union[str, "Type"]] = None, + resource_id: Optional[str] = None, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword type_properties_type: The type of endpoint. Possible values include: "default", + "custom". + :paramtype type_properties_type: str or ~azure.mgmt.hybridconnectivity.models.Type + :keyword resource_id: The resource Id of the connectivity endpoint (optional). + :paramtype resource_id: str + :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. Possible values + include: "User", "Application", "ManagedIdentity", "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. Possible + values include: "User", "Application", "ManagedIdentity", "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(EndpointResource, self).__init__(**kwargs) + self.type_properties_type = type_properties_type + self.resource_id = resource_id + self.provisioning_state = None + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class EndpointsList(msrest.serialization.Model): + """The list of endpoints. + + :ivar next_link: The link used to get the next page of endpoints list. + :vartype next_link: str + :ivar value: The list of endpoint. + :vartype value: list[~azure.mgmt.hybridconnectivity.models.EndpointResource] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[EndpointResource]'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["EndpointResource"]] = None, + **kwargs + ): + """ + :keyword next_link: The link used to get the next page of endpoints list. + :paramtype next_link: str + :keyword value: The list of endpoint. + :paramtype value: list[~azure.mgmt.hybridconnectivity.models.EndpointResource] + """ + super(EndpointsList, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.hybridconnectivity.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.hybridconnectivity.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.hybridconnectivity.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.hybridconnectivity.models.ErrorDetail + """ + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class IngressGatewayResource(msrest.serialization.Model): + """The ingress gateway access credentials. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar hostname: The ingress hostname. + :vartype hostname: str + :ivar server_id: The arc ingress gateway server app id. + :vartype server_id: str + :ivar tenant_id: The target resource home tenant id. + :vartype tenant_id: str + :ivar namespace_name: The namespace name. + :vartype namespace_name: str + :ivar namespace_name_suffix: The suffix domain name of relay namespace. + :vartype namespace_name_suffix: str + :ivar hybrid_connection_name: Azure Relay hybrid connection name for the resource. + :vartype hybrid_connection_name: str + :ivar access_key: Access key for hybrid connection. + :vartype access_key: str + :ivar expires_on: The expiration of access key in unix time. + :vartype expires_on: long + """ + + _validation = { + 'namespace_name': {'max_length': 200, 'min_length': 1}, + 'namespace_name_suffix': {'max_length': 100, 'min_length': 1}, + 'access_key': {'readonly': True}, + } + + _attribute_map = { + 'hostname': {'key': 'ingress.hostname', 'type': 'str'}, + 'server_id': {'key': 'ingress.aadProfile.serverId', 'type': 'str'}, + 'tenant_id': {'key': 'ingress.aadProfile.tenantId', 'type': 'str'}, + 'namespace_name': {'key': 'relay.namespaceName', 'type': 'str'}, + 'namespace_name_suffix': {'key': 'relay.namespaceNameSuffix', 'type': 'str'}, + 'hybrid_connection_name': {'key': 'relay.hybridConnectionName', 'type': 'str'}, + 'access_key': {'key': 'relay.accessKey', 'type': 'str'}, + 'expires_on': {'key': 'relay.expiresOn', 'type': 'long'}, + } + + def __init__( + self, + *, + hostname: Optional[str] = None, + server_id: Optional[str] = None, + tenant_id: Optional[str] = None, + namespace_name: Optional[str] = None, + namespace_name_suffix: Optional[str] = None, + hybrid_connection_name: Optional[str] = None, + expires_on: Optional[int] = None, + **kwargs + ): + """ + :keyword hostname: The ingress hostname. + :paramtype hostname: str + :keyword server_id: The arc ingress gateway server app id. + :paramtype server_id: str + :keyword tenant_id: The target resource home tenant id. + :paramtype tenant_id: str + :keyword namespace_name: The namespace name. + :paramtype namespace_name: str + :keyword namespace_name_suffix: The suffix domain name of relay namespace. + :paramtype namespace_name_suffix: str + :keyword hybrid_connection_name: Azure Relay hybrid connection name for the resource. + :paramtype hybrid_connection_name: str + :keyword expires_on: The expiration of access key in unix time. + :paramtype expires_on: long + """ + super(IngressGatewayResource, self).__init__(**kwargs) + self.hostname = hostname + self.server_id = server_id + self.tenant_id = tenant_id + self.namespace_name = namespace_name + self.namespace_name_suffix = namespace_name_suffix + self.hybrid_connection_name = hybrid_connection_name + self.access_key = None + self.expires_on = expires_on + + +class ManagedProxyRequest(msrest.serialization.Model): + """Represent ManageProxy Request object. + + All required parameters must be populated in order to send to Azure. + + :ivar service: Required. The name of the service. + :vartype service: str + :ivar hostname: The target host name. + :vartype hostname: str + """ + + _validation = { + 'service': {'required': True}, + } + + _attribute_map = { + 'service': {'key': 'service', 'type': 'str'}, + 'hostname': {'key': 'hostname', 'type': 'str'}, + } + + def __init__( + self, + *, + service: str, + hostname: Optional[str] = None, + **kwargs + ): + """ + :keyword service: Required. The name of the service. + :paramtype service: str + :keyword hostname: The target host name. + :paramtype hostname: str + """ + super(ManagedProxyRequest, self).__init__(**kwargs) + self.service = service + self.hostname = hostname + + +class ManagedProxyResource(msrest.serialization.Model): + """Managed Proxy. + + All required parameters must be populated in order to send to Azure. + + :ivar proxy: Required. The short lived proxy name. + :vartype proxy: str + :ivar expires_on: Required. The expiration time of short lived proxy name in unix epoch. + :vartype expires_on: long + """ + + _validation = { + 'proxy': {'required': True}, + 'expires_on': {'required': True}, + } + + _attribute_map = { + 'proxy': {'key': 'proxy', 'type': 'str'}, + 'expires_on': {'key': 'expiresOn', 'type': 'long'}, + } + + def __init__( + self, + *, + proxy: str, + expires_on: int, + **kwargs + ): + """ + :keyword proxy: Required. The short lived proxy name. + :paramtype proxy: str + :keyword expires_on: Required. The expiration time of short lived proxy name in unix epoch. + :paramtype expires_on: long + """ + super(ManagedProxyResource, self).__init__(**kwargs) + self.proxy = proxy + self.expires_on = expires_on + + +class Operation(msrest.serialization.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.hybridconnectivity.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", + "system", "user,system". + :vartype origin: str or ~azure.mgmt.hybridconnectivity.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.hybridconnectivity.models.ActionType + """ + + _validation = { + 'name': {'readonly': True}, + 'is_data_action': {'readonly': True}, + 'origin': {'readonly': True}, + 'action_type': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.hybridconnectivity.models.OperationDisplay + """ + super(Operation, self).__init__(**kwargs) + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None + + +class OperationDisplay(msrest.serialization.Model): + """Localized display information for this particular operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationListResult(msrest.serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.hybridconnectivity.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None 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 new file mode 100644 index 000000000000..d9149323f403 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/__init__.py @@ -0,0 +1,15 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._endpoints_operations import EndpointsOperations + +__all__ = [ + 'Operations', + 'EndpointsOperations', +] diff --git a/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 new file mode 100644 index 000000000000..bd69e73147a7 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_endpoints_operations.py @@ -0,0 +1,765 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +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: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints") + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + resource_uri: str, + endpoint_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}") + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_uri: str, + endpoint_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}") + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_uri: str, + endpoint_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}") + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_uri: str, + endpoint_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}") + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_credentials_request( + resource_uri: str, + endpoint_name: str, + *, + expiresin: Optional[int] = 10800, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listCredentials") # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if expiresin is not None: + _query_parameters['expiresin'] = _SERIALIZER.query("expiresin", expiresin, 'long', maximum=10800, minimum=600) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_managed_proxy_details_request( + resource_uri: str, + endpoint_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listManagedProxyDetails") # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class EndpointsOperations(object): + """EndpointsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.hybridconnectivity.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_uri: str, + **kwargs: Any + ) -> Iterable["_models.EndpointsList"]: + """List of endpoints to the target resource. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to + be connected. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EndpointsList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridconnectivity.models.EndpointsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints"} # type: ignore + + @distributed_trace + def get( + self, + resource_uri: str, + endpoint_name: str, + **kwargs: Any + ) -> "_models.EndpointResource": + """Gets the endpoint to the resource. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to + be connected. + :type resource_uri: str + :param endpoint_name: The endpoint name. + :type endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointResource, or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.EndpointResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + resource_uri=resource_uri, + endpoint_name=endpoint_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EndpointResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}"} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_uri: str, + endpoint_name: str, + endpoint_resource: "_models.EndpointResource", + **kwargs: Any + ) -> "_models.EndpointResource": + """Create or update the endpoint to the target resource. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to + be connected. + :type resource_uri: str + :param endpoint_name: The endpoint name. + :type endpoint_name: str + :param endpoint_resource: Endpoint details. + :type endpoint_resource: ~azure.mgmt.hybridconnectivity.models.EndpointResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointResource, or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.EndpointResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(endpoint_resource, 'EndpointResource') + + request = build_create_or_update_request( + resource_uri=resource_uri, + endpoint_name=endpoint_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EndpointResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}"} # type: ignore + + + @distributed_trace + def update( + self, + resource_uri: str, + endpoint_name: str, + endpoint_resource: "_models.EndpointResource", + **kwargs: Any + ) -> "_models.EndpointResource": + """Update the endpoint to the target resource. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to + be connected. + :type resource_uri: str + :param endpoint_name: The endpoint name. + :type endpoint_name: str + :param endpoint_resource: Endpoint details. + :type endpoint_resource: ~azure.mgmt.hybridconnectivity.models.EndpointResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointResource, or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.EndpointResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(endpoint_resource, 'EndpointResource') + + request = build_update_request( + resource_uri=resource_uri, + endpoint_name=endpoint_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EndpointResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_uri: str, + endpoint_name: str, + **kwargs: Any + ) -> None: + """Deletes the endpoint access to the target resource. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to + be connected. + :type resource_uri: str + :param endpoint_name: The endpoint name. + :type endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request( + resource_uri=resource_uri, + endpoint_name=endpoint_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}"} # type: ignore + + + @distributed_trace + def list_credentials( + self, + resource_uri: str, + endpoint_name: str, + expiresin: Optional[int] = 10800, + **kwargs: Any + ) -> "_models.EndpointAccessResource": + """Gets the endpoint access credentials to the resource. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to + be connected. + :type resource_uri: str + :param endpoint_name: The endpoint name. + :type endpoint_name: str + :param expiresin: The is how long the endpoint access token is valid (in seconds). Default + value is 10800. + :type expiresin: long + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointAccessResource, or the result of cls(response) + :rtype: ~azure.mgmt.hybridconnectivity.models.EndpointAccessResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointAccessResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_list_credentials_request( + resource_uri=resource_uri, + endpoint_name=endpoint_name, + api_version=api_version, + expiresin=expiresin, + template_url=self.list_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EndpointAccessResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_credentials.metadata = {'url': "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listCredentials"} # type: ignore + + + @distributed_trace + def list_managed_proxy_details( + self, + resource_uri: str, + endpoint_name: str, + managed_proxy_request: "_models.ManagedProxyRequest", + **kwargs: Any + ) -> "_models.ManagedProxyResource": + """Fetches the managed proxy details. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to + be connected. + :type resource_uri: str + :param endpoint_name: The endpoint name. + :type endpoint_name: str + :param managed_proxy_request: Object of type ManagedProxyRequest. + :type managed_proxy_request: ~azure.mgmt.hybridconnectivity.models.ManagedProxyRequest + :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 + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedProxyResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(managed_proxy_request, 'ManagedProxyRequest') + + 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, + template_url=self.list_managed_proxy_details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedProxyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_managed_proxy_details.metadata = {'url': "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listManagedProxyDetails"} # 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 new file mode 100644 index 000000000000..6e5f9895b120 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/operations/_operations.py @@ -0,0 +1,144 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request +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( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.HybridConnectivity/operations") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.hybridconnectivity.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: + """Lists the available Hybrid Connectivity REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridconnectivity.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/providers/Microsoft.HybridConnectivity/operations"} # type: ignore diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/py.typed b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/azure/mgmt/hybridconnectivity/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/sdk_packaging.toml b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/sdk_packaging.toml new file mode 100644 index 000000000000..8a5c0b466508 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-mgmt-hybridconnectivity" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/setup.py b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/setup.py new file mode 100644 index 000000000000..ddf2611f4b2d --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/setup.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-hybridconnectivity" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3 :: Only', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.3.0,<2.0.0', + ], + python_requires=">=3.6" +) diff --git a/sdk/hybridconnectivity/ci.yml b/sdk/hybridconnectivity/ci.yml new file mode 100644 index 000000000000..2599b9da674c --- /dev/null +++ b/sdk/hybridconnectivity/ci.yml @@ -0,0 +1,33 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/hybridconnectivity/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/hybridconnectivity/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: hybridconnectivity + Artifacts: + - name: azure-mgmt-hybridconnectivity + safeName: azuremgmthybridconnectivity