diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/CHANGELOG.md b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/CHANGELOG.md new file mode 100644 index 000000000000..4b332d95586e --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0b1 (2021-04-20) + +* Initial Release diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/MANIFEST.in b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/MANIFEST.in new file mode 100644 index 000000000000..3a9b6517412b --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/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 + diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/README.md b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/README.md new file mode 100644 index 000000000000..0460c776b160 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/README.md @@ -0,0 +1,27 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure Hybridnetwork Management Client Library. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# 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 [Hybridnetwork 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-hybridnetwork%2FREADME.png) diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/_meta.json b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/_meta.json new file mode 100644 index 000000000000..5bf2ebd2e31f --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/_meta.json @@ -0,0 +1,8 @@ +{ + "autorest": "3.0.6369", + "use": "@autorest/python@5.6.2", + "commit": "5d89c9807d3e84a5890b381a68a308198f9ef141", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/hybridnetwork/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.6.2 --version=3.0.6369", + "readme": "specification/hybridnetwork/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/__init__.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/__init__.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/__init__.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/__init__.py new file mode 100644 index 000000000000..407450606060 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/__init__.py @@ -0,0 +1,19 @@ +# 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_network_management_client import HybridNetworkManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['HybridNetworkManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_configuration.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_configuration.py new file mode 100644 index 000000000000..500ef6ded950 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class HybridNetworkManagementClientConfiguration(Configuration): + """Configuration for HybridNetworkManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(HybridNetworkManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-01-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-hybridnetwork/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_hybrid_network_management_client.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_hybrid_network_management_client.py new file mode 100644 index 000000000000..5cfbeffa4052 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_hybrid_network_management_client.py @@ -0,0 +1,115 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + +from ._configuration import HybridNetworkManagementClientConfiguration +from .operations import NetworkFunctionsOperations +from .operations import DevicesOperations +from .operations import Operations +from .operations import VendorsOperations +from .operations import VendorSkusOperations +from .operations import VendorSkuPreviewOperations +from .operations import NetworkFunctionVendorsOperations +from .operations import NetworkFunctionVendorSkusOperations +from .operations import VendorNetworkFunctionsOperations +from .operations import RoleInstancesOperations +from . import models + + +class HybridNetworkManagementClient(object): + """The definitions in this swagger specification will be used to manage the Hybrid Network resources. + + :ivar network_functions: NetworkFunctionsOperations operations + :vartype network_functions: hybrid_network_management_client.operations.NetworkFunctionsOperations + :ivar devices: DevicesOperations operations + :vartype devices: hybrid_network_management_client.operations.DevicesOperations + :ivar operations: Operations operations + :vartype operations: hybrid_network_management_client.operations.Operations + :ivar vendors: VendorsOperations operations + :vartype vendors: hybrid_network_management_client.operations.VendorsOperations + :ivar vendor_skus: VendorSkusOperations operations + :vartype vendor_skus: hybrid_network_management_client.operations.VendorSkusOperations + :ivar vendor_sku_preview: VendorSkuPreviewOperations operations + :vartype vendor_sku_preview: hybrid_network_management_client.operations.VendorSkuPreviewOperations + :ivar network_function_vendors: NetworkFunctionVendorsOperations operations + :vartype network_function_vendors: hybrid_network_management_client.operations.NetworkFunctionVendorsOperations + :ivar network_function_vendor_skus: NetworkFunctionVendorSkusOperations operations + :vartype network_function_vendor_skus: hybrid_network_management_client.operations.NetworkFunctionVendorSkusOperations + :ivar vendor_network_functions: VendorNetworkFunctionsOperations operations + :vartype vendor_network_functions: hybrid_network_management_client.operations.VendorNetworkFunctionsOperations + :ivar role_instances: RoleInstancesOperations operations + :vartype role_instances: hybrid_network_management_client.operations.RoleInstancesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = HybridNetworkManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.network_functions = NetworkFunctionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.devices = DevicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.vendors = VendorsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.vendor_skus = VendorSkusOperations( + self._client, self._config, self._serialize, self._deserialize) + self.vendor_sku_preview = VendorSkuPreviewOperations( + self._client, self._config, self._serialize, self._deserialize) + self.network_function_vendors = NetworkFunctionVendorsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.network_function_vendor_skus = NetworkFunctionVendorSkusOperations( + self._client, self._config, self._serialize, self._deserialize) + self.vendor_network_functions = VendorNetworkFunctionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.role_instances = RoleInstancesOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> HybridNetworkManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_metadata.json b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_metadata.json new file mode 100644 index 000000000000..4eb475b1ef1c --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_metadata.json @@ -0,0 +1,118 @@ +{ + "chosen_version": "2020-01-01-preview", + "total_api_version_list": ["2020-01-01-preview"], + "client": { + "name": "HybridNetworkManagementClient", + "filename": "_hybrid_network_management_client", + "description": "The definitions in this swagger specification will be used to manage the Hybrid Network resources.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"HybridNetworkManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"HybridNetworkManagementClientConfiguration\"]}}, \"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 + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "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 + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "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=None, # type: Optional[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: Optional[str] = None,", + "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_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "network_functions": "NetworkFunctionsOperations", + "devices": "DevicesOperations", + "operations": "Operations", + "vendors": "VendorsOperations", + "vendor_skus": "VendorSkusOperations", + "vendor_sku_preview": "VendorSkuPreviewOperations", + "network_function_vendors": "NetworkFunctionVendorsOperations", + "network_function_vendor_skus": "NetworkFunctionVendorSkusOperations", + "vendor_network_functions": "VendorNetworkFunctionsOperations", + "role_instances": "RoleInstancesOperations" + }, + "operation_mixins": { + "sync_imports": "None", + "async_imports": "None", + "operations": { + } + } +} \ No newline at end of file diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_version.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/_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/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/__init__.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/__init__.py new file mode 100644 index 000000000000..99f1c4cfca03 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/__init__.py @@ -0,0 +1,10 @@ +# 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_network_management_client import HybridNetworkManagementClient +__all__ = ['HybridNetworkManagementClient'] diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/_configuration.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/_configuration.py new file mode 100644 index 000000000000..f048c4f0c8c0 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/_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 ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class HybridNetworkManagementClientConfiguration(Configuration): + """Configuration for HybridNetworkManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(HybridNetworkManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-01-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-hybridnetwork/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/_hybrid_network_management_client.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/_hybrid_network_management_client.py new file mode 100644 index 000000000000..be1bc4d57771 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/_hybrid_network_management_client.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import HybridNetworkManagementClientConfiguration +from .operations import NetworkFunctionsOperations +from .operations import DevicesOperations +from .operations import Operations +from .operations import VendorsOperations +from .operations import VendorSkusOperations +from .operations import VendorSkuPreviewOperations +from .operations import NetworkFunctionVendorsOperations +from .operations import NetworkFunctionVendorSkusOperations +from .operations import VendorNetworkFunctionsOperations +from .operations import RoleInstancesOperations +from .. import models + + +class HybridNetworkManagementClient(object): + """The definitions in this swagger specification will be used to manage the Hybrid Network resources. + + :ivar network_functions: NetworkFunctionsOperations operations + :vartype network_functions: hybrid_network_management_client.aio.operations.NetworkFunctionsOperations + :ivar devices: DevicesOperations operations + :vartype devices: hybrid_network_management_client.aio.operations.DevicesOperations + :ivar operations: Operations operations + :vartype operations: hybrid_network_management_client.aio.operations.Operations + :ivar vendors: VendorsOperations operations + :vartype vendors: hybrid_network_management_client.aio.operations.VendorsOperations + :ivar vendor_skus: VendorSkusOperations operations + :vartype vendor_skus: hybrid_network_management_client.aio.operations.VendorSkusOperations + :ivar vendor_sku_preview: VendorSkuPreviewOperations operations + :vartype vendor_sku_preview: hybrid_network_management_client.aio.operations.VendorSkuPreviewOperations + :ivar network_function_vendors: NetworkFunctionVendorsOperations operations + :vartype network_function_vendors: hybrid_network_management_client.aio.operations.NetworkFunctionVendorsOperations + :ivar network_function_vendor_skus: NetworkFunctionVendorSkusOperations operations + :vartype network_function_vendor_skus: hybrid_network_management_client.aio.operations.NetworkFunctionVendorSkusOperations + :ivar vendor_network_functions: VendorNetworkFunctionsOperations operations + :vartype vendor_network_functions: hybrid_network_management_client.aio.operations.VendorNetworkFunctionsOperations + :ivar role_instances: RoleInstancesOperations operations + :vartype role_instances: hybrid_network_management_client.aio.operations.RoleInstancesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = HybridNetworkManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.network_functions = NetworkFunctionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.devices = DevicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.vendors = VendorsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.vendor_skus = VendorSkusOperations( + self._client, self._config, self._serialize, self._deserialize) + self.vendor_sku_preview = VendorSkuPreviewOperations( + self._client, self._config, self._serialize, self._deserialize) + self.network_function_vendors = NetworkFunctionVendorsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.network_function_vendor_skus = NetworkFunctionVendorSkusOperations( + self._client, self._config, self._serialize, self._deserialize) + self.vendor_network_functions = VendorNetworkFunctionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.role_instances = RoleInstancesOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "HybridNetworkManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/__init__.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/__init__.py new file mode 100644 index 000000000000..ff21fc7723ce --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/__init__.py @@ -0,0 +1,31 @@ +# 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 ._network_functions_operations import NetworkFunctionsOperations +from ._devices_operations import DevicesOperations +from ._operations import Operations +from ._vendors_operations import VendorsOperations +from ._vendor_skus_operations import VendorSkusOperations +from ._vendor_sku_preview_operations import VendorSkuPreviewOperations +from ._network_function_vendors_operations import NetworkFunctionVendorsOperations +from ._network_function_vendor_skus_operations import NetworkFunctionVendorSkusOperations +from ._vendor_network_functions_operations import VendorNetworkFunctionsOperations +from ._role_instances_operations import RoleInstancesOperations + +__all__ = [ + 'NetworkFunctionsOperations', + 'DevicesOperations', + 'Operations', + 'VendorsOperations', + 'VendorSkusOperations', + 'VendorSkuPreviewOperations', + 'NetworkFunctionVendorsOperations', + 'NetworkFunctionVendorSkusOperations', + 'VendorNetworkFunctionsOperations', + 'RoleInstancesOperations', +] diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_devices_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_devices_operations.py new file mode 100644 index 000000000000..408cec5bd9ea --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_devices_operations.py @@ -0,0 +1,605 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DevicesOperations: + """DevicesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~hybrid_network_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _delete_initial( + self, + resource_group_name: str, + device_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deviceName': self._serialize.url("device_name", device_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + device_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes the specified device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param device_name: The name of the device resource. + :type device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + device_name=device_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deviceName': self._serialize.url("device_name", device_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + device_name: str, + **kwargs + ) -> "_models.Device": + """Gets information about the specified device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param device_name: The name of the device resource. + :type device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Device, or the result of cls(response) + :rtype: ~hybrid_network_management_client.models.Device + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Device"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deviceName': self._serialize.url("device_name", device_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Device', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + device_name: str, + parameters: "_models.Device", + **kwargs + ) -> "_models.Device": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Device"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deviceName': self._serialize.url("device_name", device_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Device') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Device', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Device', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + device_name: str, + parameters: "_models.Device", + **kwargs + ) -> AsyncLROPoller["_models.Device"]: + """Creates or updates a device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param device_name: Resource name for the device resource. + :type device_name: str + :param parameters: Parameters supplied to the create or update device operation. + :type parameters: ~hybrid_network_management_client.models.Device + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Device or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~hybrid_network_management_client.models.Device] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Device"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + device_name=device_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Device', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deviceName': self._serialize.url("device_name", device_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}'} # type: ignore + + async def update_tags( + self, + resource_group_name: str, + device_name: str, + parameters: "_models.TagsObject", + **kwargs + ) -> "_models.Device": + """Updates device tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param device_name: The name of the device resource. + :type device_name: str + :param parameters: Parameters supplied to the update device tags operation. + :type parameters: ~hybrid_network_management_client.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Device, or the result of cls(response) + :rtype: ~hybrid_network_management_client.models.Device + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Device"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update_tags.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deviceName': self._serialize.url("device_name", device_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'TagsObject') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Device', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["_models.DeviceListResult"]: + """Lists all the devices in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeviceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~hybrid_network_management_client.models.DeviceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeviceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeviceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/devices'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.DeviceListResult"]: + """Lists all the device resource in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeviceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~hybrid_network_management_client.models.DeviceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeviceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeviceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices'} # type: ignore + + async def list_registration_key( + self, + resource_group_name: str, + device_name: str, + **kwargs + ) -> "_models.DeviceRegistrationKey": + """List the registration key for the device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param device_name: The name of the device resource. + :type device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeviceRegistrationKey, or the result of cls(response) + :rtype: ~hybrid_network_management_client.models.DeviceRegistrationKey + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeviceRegistrationKey"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_registration_key.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deviceName': self._serialize.url("device_name", device_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeviceRegistrationKey', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_registration_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}/listRegistrationKey'} # type: ignore diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_function_vendor_skus_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_function_vendor_skus_operations.py new file mode 100644 index 000000000000..7f2c19e2fcef --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_function_vendor_skus_operations.py @@ -0,0 +1,188 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NetworkFunctionVendorSkusOperations: + """NetworkFunctionVendorSkusOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~hybrid_network_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_vendor( + self, + vendor_name: str, + **kwargs + ) -> AsyncIterable["_models.NetworkFunctionSkuListResult"]: + """Lists all network function vendor sku details in a vendor. + + :param vendor_name: The name of the network function vendor. + :type vendor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionSkuListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~hybrid_network_management_client.models.NetworkFunctionSkuListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionSkuListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_vendor.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkFunctionSkuListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_vendor.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctionVendors/{vendorName}/vendorSkus'} # type: ignore + + def list_by_sku( + self, + vendor_name: str, + vendor_sku_name: str, + **kwargs + ) -> AsyncIterable["_models.NetworkFunctionSkuDetails"]: + """Lists information about network function vendor sku details. + + :param vendor_name: The name of the network function vendor. + :type vendor_name: str + :param vendor_sku_name: The name of the network function sku. + :type vendor_sku_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionSkuDetails or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~hybrid_network_management_client.models.NetworkFunctionSkuDetails] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionSkuDetails"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_sku.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'vendorSkuName': self._serialize.url("vendor_sku_name", vendor_sku_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkFunctionSkuDetails', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_sku.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctionVendors/{vendorName}/vendorSkus/{vendorSkuName}'} # type: ignore diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_function_vendors_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_function_vendors_operations.py new file mode 100644 index 000000000000..6a45d3b5e389 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_function_vendors_operations.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NetworkFunctionVendorsOperations: + """NetworkFunctionVendorsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~hybrid_network_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["_models.NetworkFunctionVendorListResult"]: + """Lists all the available vendor and sku information. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionVendorListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~hybrid_network_management_client.models.NetworkFunctionVendorListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionVendorListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkFunctionVendorListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctionVendors'} # type: ignore diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_functions_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_functions_operations.py new file mode 100644 index 000000000000..a5a13f8894e6 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_network_functions_operations.py @@ -0,0 +1,547 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NetworkFunctionsOperations: + """NetworkFunctionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~hybrid_network_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _delete_initial( + self, + resource_group_name: str, + network_function_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'networkFunctionName': self._serialize.url("network_function_name", network_function_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + network_function_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes the specified network function resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_name: The name of the network function. + :type network_function_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'networkFunctionName': self._serialize.url("network_function_name", network_function_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + network_function_name: str, + **kwargs + ) -> "_models.NetworkFunction": + """Gets information about the specified network function resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_name: The name of the network function resource. + :type network_function_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunction, or the result of cls(response) + :rtype: ~hybrid_network_management_client.models.NetworkFunction + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunction"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'networkFunctionName': self._serialize.url("network_function_name", network_function_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunction', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + network_function_name: str, + parameters: "_models.NetworkFunction", + **kwargs + ) -> "_models.NetworkFunction": + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunction"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'networkFunctionName': self._serialize.url("network_function_name", network_function_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkFunction') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('NetworkFunction', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkFunction', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + network_function_name: str, + parameters: "_models.NetworkFunction", + **kwargs + ) -> AsyncLROPoller["_models.NetworkFunction"]: + """Creates or updates a network function resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_name: Resource name for the network function resource. + :type network_function_name: str + :param parameters: Parameters supplied in the body to the create or update network function + operation. + :type parameters: ~hybrid_network_management_client.models.NetworkFunction + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetworkFunction or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~hybrid_network_management_client.models.NetworkFunction] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunction"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('NetworkFunction', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'networkFunctionName': self._serialize.url("network_function_name", network_function_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}'} # type: ignore + + async def update_tags( + self, + resource_group_name: str, + network_function_name: str, + parameters: "_models.TagsObject", + **kwargs + ) -> "_models.NetworkFunction": + """Updates the tags for the network function resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_name: Resource name for the network function resource. + :type network_function_name: str + :param parameters: Parameters supplied to the update network function tags operation. + :type parameters: ~hybrid_network_management_client.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunction, or the result of cls(response) + :rtype: ~hybrid_network_management_client.models.NetworkFunction + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunction"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update_tags.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'networkFunctionName': self._serialize.url("network_function_name", network_function_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'TagsObject') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunction', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["_models.NetworkFunctionListResult"]: + """Lists all the network functions in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~hybrid_network_management_client.models.NetworkFunctionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkFunctionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctions'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.NetworkFunctionListResult"]: + """Lists all the network function resources in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~hybrid_network_management_client.models.NetworkFunctionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkFunctionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions'} # type: ignore diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_operations.py new file mode 100644 index 000000000000..98991f13a89f --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_operations.py @@ -0,0 +1,105 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~hybrid_network_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["_models.OperationList"]: + """Gets a list of the operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~hybrid_network_management_client.models.OperationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.HybridNetwork/operations'} # type: ignore diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_role_instances_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_role_instances_operations.py new file mode 100644 index 000000000000..ddd1bb4df5b3 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_role_instances_operations.py @@ -0,0 +1,564 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RoleInstancesOperations: + """RoleInstancesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~hybrid_network_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _start_initial( + self, + location_name: str, + vendor_name: str, + service_key: str, + role_instance_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'serviceKey': self._serialize.url("service_key", service_key, 'str'), + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/start'} # type: ignore + + async def begin_start( + self, + location_name: str, + vendor_name: str, + service_key: str, + role_instance_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Starts a role instance of a vendor network function. + + :param location_name: The Azure region where the network function resource was created by + customer. + :type location_name: str + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param service_key: The GUID for the vendor network function. + :type service_key: str + :param role_instance_name: The name of the role instance of the vendor network function. + :type role_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_initial( + location_name=location_name, + vendor_name=vendor_name, + service_key=service_key, + role_instance_name=role_instance_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'serviceKey': self._serialize.url("service_key", service_key, 'str'), + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/start'} # type: ignore + + async def _stop_initial( + self, + location_name: str, + vendor_name: str, + service_key: str, + role_instance_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'serviceKey': self._serialize.url("service_key", service_key, 'str'), + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/stop'} # type: ignore + + async def begin_stop( + self, + location_name: str, + vendor_name: str, + service_key: str, + role_instance_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Powers off (stop) a role instance of a vendor network function. + + :param location_name: The Azure region where the network function resource was created by + customer. + :type location_name: str + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param service_key: The GUID for the vendor network function. + :type service_key: str + :param role_instance_name: The name of the role instance of the vendor network function. + :type role_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._stop_initial( + location_name=location_name, + vendor_name=vendor_name, + service_key=service_key, + role_instance_name=role_instance_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'serviceKey': self._serialize.url("service_key", service_key, 'str'), + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/stop'} # type: ignore + + async def _restart_initial( + self, + location_name: str, + vendor_name: str, + service_key: str, + role_instance_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'serviceKey': self._serialize.url("service_key", service_key, 'str'), + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/restart'} # type: ignore + + async def begin_restart( + self, + location_name: str, + vendor_name: str, + service_key: str, + role_instance_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Restarts a role instance of a vendor network function. + + :param location_name: The Azure region where the network function resource was created by + customer. + :type location_name: str + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param service_key: The GUID for the vendor network function. + :type service_key: str + :param role_instance_name: The name of the role instance of the vendor network function. + :type role_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._restart_initial( + location_name=location_name, + vendor_name=vendor_name, + service_key=service_key, + role_instance_name=role_instance_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'serviceKey': self._serialize.url("service_key", service_key, 'str'), + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/restart'} # type: ignore + + async def get( + self, + location_name: str, + vendor_name: str, + service_key: str, + role_instance_name: str, + **kwargs + ) -> "_models.RoleInstance": + """Gets the information of role instance of vendor network function. + + :param location_name: The Azure region where the network function resource was created by + customer. + :type location_name: str + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param service_key: The GUID for the vendor network function. + :type service_key: str + :param role_instance_name: The name of the role instance of the vendor network function. + :type role_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoleInstance, or the result of cls(response) + :rtype: ~hybrid_network_management_client.models.RoleInstance + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'serviceKey': self._serialize.url("service_key", service_key, 'str'), + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RoleInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}'} # type: ignore + + def list( + self, + location_name: str, + vendor_name: str, + service_key: str, + **kwargs + ) -> AsyncIterable["_models.NetworkFunctionRoleInstanceListResult"]: + """Lists the information of role instances of vendor network function. + + :param location_name: The Azure region where the network function resource was created by + customer. + :type location_name: str + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param service_key: The GUID for the vendor network function. + :type service_key: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionRoleInstanceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~hybrid_network_management_client.models.NetworkFunctionRoleInstanceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionRoleInstanceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'serviceKey': self._serialize.url("service_key", service_key, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkFunctionRoleInstanceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances'} # type: ignore diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendor_network_functions_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendor_network_functions_operations.py new file mode 100644 index 000000000000..65055468b9ba --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendor_network_functions_operations.py @@ -0,0 +1,329 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VendorNetworkFunctionsOperations: + """VendorNetworkFunctionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~hybrid_network_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + location_name: str, + vendor_name: str, + service_key: str, + **kwargs + ) -> "_models.VendorNetworkFunction": + """Gets information about the specified vendor network function. + + :param location_name: The Azure region where the network function resource was created by the + customer. + :type location_name: str + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param service_key: The GUID for the vendor network function. + :type service_key: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VendorNetworkFunction, or the result of cls(response) + :rtype: ~hybrid_network_management_client.models.VendorNetworkFunction + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VendorNetworkFunction"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'serviceKey': self._serialize.url("service_key", service_key, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VendorNetworkFunction', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}'} # type: ignore + + async def _create_or_update_initial( + self, + location_name: str, + vendor_name: str, + service_key: str, + parameters: "_models.VendorNetworkFunction", + **kwargs + ) -> "_models.VendorNetworkFunction": + cls = kwargs.pop('cls', None) # type: ClsType["_models.VendorNetworkFunction"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'serviceKey': self._serialize.url("service_key", service_key, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VendorNetworkFunction') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VendorNetworkFunction', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VendorNetworkFunction', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}'} # type: ignore + + async def begin_create_or_update( + self, + location_name: str, + vendor_name: str, + service_key: str, + parameters: "_models.VendorNetworkFunction", + **kwargs + ) -> AsyncLROPoller["_models.VendorNetworkFunction"]: + """Creates or updates a vendor network function. + + :param location_name: The Azure region where the network function resource was created by the + customer. + :type location_name: str + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param service_key: The GUID for the vendor network function. + :type service_key: str + :param parameters: Parameters supplied to the create or update vendor network function + operation. + :type parameters: ~hybrid_network_management_client.models.VendorNetworkFunction + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VendorNetworkFunction or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~hybrid_network_management_client.models.VendorNetworkFunction] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VendorNetworkFunction"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + location_name=location_name, + vendor_name=vendor_name, + service_key=service_key, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VendorNetworkFunction', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'serviceKey': self._serialize.url("service_key", service_key, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}'} # type: ignore + + def list( + self, + location_name: str, + vendor_name: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.VendorNetworkFunctionListResult"]: + """Lists all the vendor network function sub resources in an Azure region, filtered by skuType, + skuName, vendorProvisioningState. + + :param location_name: The Azure region where the network function resource was created by the + customer. + :type location_name: str + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param filter: The filter to apply on the operation. The properties you can use for eq (equals) + are: skuType, skuName and vendorProvisioningState. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VendorNetworkFunctionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~hybrid_network_management_client.models.VendorNetworkFunctionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VendorNetworkFunctionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VendorNetworkFunctionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions'} # type: ignore diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendor_sku_preview_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendor_sku_preview_operations.py new file mode 100644 index 000000000000..218bf2a64cd2 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendor_sku_preview_operations.py @@ -0,0 +1,435 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VendorSkuPreviewOperations: + """VendorSkuPreviewOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~hybrid_network_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + vendor_name: str, + sku_name: str, + **kwargs + ) -> AsyncIterable["_models.PreviewSubscriptionsList"]: + """Lists all the preview information of a vendor sku. + + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param sku_name: The name of the sku. + :type sku_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PreviewSubscriptionsList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~hybrid_network_management_client.models.PreviewSubscriptionsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PreviewSubscriptionsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'skuName': self._serialize.url("sku_name", sku_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PreviewSubscriptionsList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions'} # type: ignore + + async def _create_or_update_initial( + self, + vendor_name: str, + sku_name: str, + preview_subscription: str, + parameters: "_models.PreviewSubscription", + **kwargs + ) -> "_models.PreviewSubscription": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PreviewSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'skuName': self._serialize.url("sku_name", sku_name, 'str'), + 'previewSubscription': self._serialize.url("preview_subscription", preview_subscription, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PreviewSubscription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PreviewSubscription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PreviewSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}'} # type: ignore + + async def begin_create_or_update( + self, + vendor_name: str, + sku_name: str, + preview_subscription: str, + parameters: "_models.PreviewSubscription", + **kwargs + ) -> AsyncLROPoller["_models.PreviewSubscription"]: + """Creates or updates preview information of a vendor sku. + + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param sku_name: The name of the vendor sku. + :type sku_name: str + :param preview_subscription: Preview subscription ID. + :type preview_subscription: str + :param parameters: Parameters supplied to the create or update vendor preview subscription + operation. + :type parameters: ~hybrid_network_management_client.models.PreviewSubscription + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PreviewSubscription or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~hybrid_network_management_client.models.PreviewSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PreviewSubscription"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + vendor_name=vendor_name, + sku_name=sku_name, + preview_subscription=preview_subscription, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PreviewSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'skuName': self._serialize.url("sku_name", sku_name, 'str'), + 'previewSubscription': self._serialize.url("preview_subscription", preview_subscription, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}'} # type: ignore + + async def get( + self, + vendor_name: str, + sku_name: str, + preview_subscription: str, + **kwargs + ) -> "_models.PreviewSubscription": + """Gets the preview information of a vendor sku. + + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param sku_name: The name of the vendor sku. + :type sku_name: str + :param preview_subscription: Preview subscription ID. + :type preview_subscription: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PreviewSubscription, or the result of cls(response) + :rtype: ~hybrid_network_management_client.models.PreviewSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PreviewSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'skuName': self._serialize.url("sku_name", sku_name, 'str'), + 'previewSubscription': self._serialize.url("preview_subscription", preview_subscription, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PreviewSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}'} # type: ignore + + async def _delete_initial( + self, + vendor_name: str, + sku_name: str, + preview_subscription: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'skuName': self._serialize.url("sku_name", sku_name, 'str'), + 'previewSubscription': self._serialize.url("preview_subscription", preview_subscription, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}'} # type: ignore + + async def begin_delete( + self, + vendor_name: str, + sku_name: str, + preview_subscription: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes the preview information of a vendor sku. + + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param sku_name: The name of the vendor sku. + :type sku_name: str + :param preview_subscription: Preview subscription ID. + :type preview_subscription: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + vendor_name=vendor_name, + sku_name=sku_name, + preview_subscription=preview_subscription, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'skuName': self._serialize.url("sku_name", sku_name, 'str'), + 'previewSubscription': self._serialize.url("preview_subscription", preview_subscription, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}'} # type: ignore diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendor_skus_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendor_skus_operations.py new file mode 100644 index 000000000000..ffa137bfe076 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendor_skus_operations.py @@ -0,0 +1,412 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VendorSkusOperations: + """VendorSkusOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~hybrid_network_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _delete_initial( + self, + vendor_name: str, + sku_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'skuName': self._serialize.url("sku_name", sku_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}'} # type: ignore + + async def begin_delete( + self, + vendor_name: str, + sku_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes the specified sku. + + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param sku_name: The name of the sku. + :type sku_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + vendor_name=vendor_name, + sku_name=sku_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'skuName': self._serialize.url("sku_name", sku_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}'} # type: ignore + + async def get( + self, + vendor_name: str, + sku_name: str, + **kwargs + ) -> "_models.VendorSku": + """Gets information about the specified sku. + + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param sku_name: The name of the sku. + :type sku_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VendorSku, or the result of cls(response) + :rtype: ~hybrid_network_management_client.models.VendorSku + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VendorSku"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'skuName': self._serialize.url("sku_name", sku_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VendorSku', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}'} # type: ignore + + async def _create_or_update_initial( + self, + vendor_name: str, + sku_name: str, + parameters: "_models.VendorSku", + **kwargs + ) -> "_models.VendorSku": + cls = kwargs.pop('cls', None) # type: ClsType["_models.VendorSku"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'skuName': self._serialize.url("sku_name", sku_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VendorSku') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VendorSku', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VendorSku', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}'} # type: ignore + + async def begin_create_or_update( + self, + vendor_name: str, + sku_name: str, + parameters: "_models.VendorSku", + **kwargs + ) -> AsyncLROPoller["_models.VendorSku"]: + """Creates or updates a sku. + + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param sku_name: The name of the sku. + :type sku_name: str + :param parameters: Parameters supplied to the create or update sku operation. + :type parameters: ~hybrid_network_management_client.models.VendorSku + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VendorSku or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~hybrid_network_management_client.models.VendorSku] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VendorSku"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + vendor_name=vendor_name, + sku_name=sku_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VendorSku', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'skuName': self._serialize.url("sku_name", sku_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}'} # type: ignore + + def list( + self, + vendor_name: str, + **kwargs + ) -> AsyncIterable["_models.VendorSkuListResult"]: + """Lists all the skus of a vendor. + + :param vendor_name: The name of the vendor. + :type vendor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VendorSkuListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~hybrid_network_management_client.models.VendorSkuListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VendorSkuListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VendorSkuListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus'} # type: ignore diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendors_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendors_operations.py new file mode 100644 index 000000000000..2570591a005e --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/aio/operations/_vendors_operations.py @@ -0,0 +1,393 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VendorsOperations: + """VendorsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~hybrid_network_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _delete_initial( + self, + vendor_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}'} # type: ignore + + async def begin_delete( + self, + vendor_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes the specified vendor. + + :param vendor_name: The name of the vendor. + :type vendor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + vendor_name=vendor_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}'} # type: ignore + + async def get( + self, + vendor_name: str, + **kwargs + ) -> "_models.Vendor": + """Gets information about the specified vendor. + + :param vendor_name: The name of the vendor. + :type vendor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vendor, or the result of cls(response) + :rtype: ~hybrid_network_management_client.models.Vendor + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vendor"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Vendor', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}'} # type: ignore + + async def _create_or_update_initial( + self, + vendor_name: str, + parameters: Optional["_models.Vendor"] = None, + **kwargs + ) -> "_models.Vendor": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vendor"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'Vendor') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Vendor', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Vendor', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}'} # type: ignore + + async def begin_create_or_update( + self, + vendor_name: str, + parameters: Optional["_models.Vendor"] = None, + **kwargs + ) -> AsyncLROPoller["_models.Vendor"]: + """Creates or updates a vendor. + + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param parameters: Parameters supplied to the create vendor operation. + :type parameters: ~hybrid_network_management_client.models.Vendor + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Vendor or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~hybrid_network_management_client.models.Vendor] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vendor"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + vendor_name=vendor_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Vendor', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["_models.VendorListResult"]: + """Lists all the vendors in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VendorListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~hybrid_network_management_client.models.VendorListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VendorListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VendorListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors'} # type: ignore diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/__init__.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/__init__.py new file mode 100644 index 000000000000..70f91c6d09a1 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/__init__.py @@ -0,0 +1,194 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import CustomProfile + from ._models_py3 import DataDisk + from ._models_py3 import Device + from ._models_py3 import DeviceListResult + from ._models_py3 import DevicePropertiesFormat + from ._models_py3 import DeviceRegistrationKey + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse + from ._models_py3 import ImageReference + from ._models_py3 import LinuxConfiguration + from ._models_py3 import NetworkFunction + from ._models_py3 import NetworkFunctionListResult + from ._models_py3 import NetworkFunctionRoleConfiguration + from ._models_py3 import NetworkFunctionRoleInstanceListResult + from ._models_py3 import NetworkFunctionSkuDetails + from ._models_py3 import NetworkFunctionSkuListResult + from ._models_py3 import NetworkFunctionSkuRoleDetails + from ._models_py3 import NetworkFunctionTemplate + from ._models_py3 import NetworkFunctionUserConfiguration + from ._models_py3 import NetworkFunctionUserConfigurationOsProfile + from ._models_py3 import NetworkFunctionVendor + from ._models_py3 import NetworkFunctionVendorConfiguration + from ._models_py3 import NetworkFunctionVendorListResult + from ._models_py3 import NetworkInterface + from ._models_py3 import NetworkInterfaceIPConfiguration + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationList + from ._models_py3 import OsDisk + from ._models_py3 import OsProfile + from ._models_py3 import PreviewSubscription + from ._models_py3 import PreviewSubscriptionsList + from ._models_py3 import ProxyResource + from ._models_py3 import Resource + from ._models_py3 import RoleInstance + from ._models_py3 import SkuOverview + from ._models_py3 import SshConfiguration + from ._models_py3 import SshPublicKey + from ._models_py3 import StorageProfile + from ._models_py3 import SubResource + from ._models_py3 import TagsObject + from ._models_py3 import TrackedResource + from ._models_py3 import Vendor + from ._models_py3 import VendorListResult + from ._models_py3 import VendorNetworkFunction + from ._models_py3 import VendorNetworkFunctionListResult + from ._models_py3 import VendorSku + from ._models_py3 import VendorSkuListResult + from ._models_py3 import VirtualHardDisk +except (SyntaxError, ImportError): + from ._models import CustomProfile # type: ignore + from ._models import DataDisk # type: ignore + from ._models import Device # type: ignore + from ._models import DeviceListResult # type: ignore + from ._models import DevicePropertiesFormat # type: ignore + from ._models import DeviceRegistrationKey # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import ImageReference # type: ignore + from ._models import LinuxConfiguration # type: ignore + from ._models import NetworkFunction # type: ignore + from ._models import NetworkFunctionListResult # type: ignore + from ._models import NetworkFunctionRoleConfiguration # type: ignore + from ._models import NetworkFunctionRoleInstanceListResult # type: ignore + from ._models import NetworkFunctionSkuDetails # type: ignore + from ._models import NetworkFunctionSkuListResult # type: ignore + from ._models import NetworkFunctionSkuRoleDetails # type: ignore + from ._models import NetworkFunctionTemplate # type: ignore + from ._models import NetworkFunctionUserConfiguration # type: ignore + from ._models import NetworkFunctionUserConfigurationOsProfile # type: ignore + from ._models import NetworkFunctionVendor # type: ignore + from ._models import NetworkFunctionVendorConfiguration # type: ignore + from ._models import NetworkFunctionVendorListResult # type: ignore + from ._models import NetworkInterface # type: ignore + from ._models import NetworkInterfaceIPConfiguration # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationList # type: ignore + from ._models import OsDisk # type: ignore + from ._models import OsProfile # type: ignore + from ._models import PreviewSubscription # type: ignore + from ._models import PreviewSubscriptionsList # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import Resource # type: ignore + from ._models import RoleInstance # type: ignore + from ._models import SkuOverview # type: ignore + from ._models import SshConfiguration # type: ignore + from ._models import SshPublicKey # type: ignore + from ._models import StorageProfile # type: ignore + from ._models import SubResource # type: ignore + from ._models import TagsObject # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import Vendor # type: ignore + from ._models import VendorListResult # type: ignore + from ._models import VendorNetworkFunction # type: ignore + from ._models import VendorNetworkFunctionListResult # type: ignore + from ._models import VendorSku # type: ignore + from ._models import VendorSkuListResult # type: ignore + from ._models import VirtualHardDisk # type: ignore + +from ._hybrid_network_management_client_enums import ( + DeviceType, + DiskCreateOptionTypes, + IPAllocationMethod, + IPVersion, + NetworkFunctionRoleConfigurationType, + OperatingSystemTypes, + OperationalState, + ProvisioningState, + SkuDeploymentMode, + SkuType, + Status, + VMSwitchType, + VendorProvisioningState, + VirtualMachineSizeTypes, +) + +__all__ = [ + 'CustomProfile', + 'DataDisk', + 'Device', + 'DeviceListResult', + 'DevicePropertiesFormat', + 'DeviceRegistrationKey', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'ImageReference', + 'LinuxConfiguration', + 'NetworkFunction', + 'NetworkFunctionListResult', + 'NetworkFunctionRoleConfiguration', + 'NetworkFunctionRoleInstanceListResult', + 'NetworkFunctionSkuDetails', + 'NetworkFunctionSkuListResult', + 'NetworkFunctionSkuRoleDetails', + 'NetworkFunctionTemplate', + 'NetworkFunctionUserConfiguration', + 'NetworkFunctionUserConfigurationOsProfile', + 'NetworkFunctionVendor', + 'NetworkFunctionVendorConfiguration', + 'NetworkFunctionVendorListResult', + 'NetworkInterface', + 'NetworkInterfaceIPConfiguration', + 'Operation', + 'OperationDisplay', + 'OperationList', + 'OsDisk', + 'OsProfile', + 'PreviewSubscription', + 'PreviewSubscriptionsList', + 'ProxyResource', + 'Resource', + 'RoleInstance', + 'SkuOverview', + 'SshConfiguration', + 'SshPublicKey', + 'StorageProfile', + 'SubResource', + 'TagsObject', + 'TrackedResource', + 'Vendor', + 'VendorListResult', + 'VendorNetworkFunction', + 'VendorNetworkFunctionListResult', + 'VendorSku', + 'VendorSkuListResult', + 'VirtualHardDisk', + 'DeviceType', + 'DiskCreateOptionTypes', + 'IPAllocationMethod', + 'IPVersion', + 'NetworkFunctionRoleConfigurationType', + 'OperatingSystemTypes', + 'OperationalState', + 'ProvisioningState', + 'SkuDeploymentMode', + 'SkuType', + 'Status', + 'VMSwitchType', + 'VendorProvisioningState', + 'VirtualMachineSizeTypes', +] diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/_hybrid_network_management_client_enums.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/_hybrid_network_management_client_enums.py new file mode 100644 index 000000000000..1c10acdb6028 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/_hybrid_network_management_client_enums.py @@ -0,0 +1,171 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class DeviceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the device. + """ + + UNKNOWN = "Unknown" + AZURE_STACK_EDGE = "AzureStackEdge" + +class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies how the virtual machine should be created. + """ + + UNKNOWN = "Unknown" + EMPTY = "Empty" + +class IPAllocationMethod(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """IP address allocation method. + """ + + UNKNOWN = "Unknown" + STATIC = "Static" + DYNAMIC = "Dynamic" + +class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """IP address version. + """ + + UNKNOWN = "Unknown" + I_PV4 = "IPv4" + +class NetworkFunctionRoleConfigurationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Role type. + """ + + UNKNOWN = "Unknown" + VIRTUAL_MACHINE = "VirtualMachine" + +class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The OS type. + """ + + UNKNOWN = "Unknown" + WINDOWS = "Windows" + LINUX = "Linux" + +class OperationalState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The operational state of the role instance. + """ + + UNKNOWN = "Unknown" + STOPPED = "Stopped" + RUNNING = "Running" + STOPPING = "Stopping" + STARTING = "Starting" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The current provisioning state. + """ + + UNKNOWN = "Unknown" + SUCCEEDED = "Succeeded" + ACCEPTED = "Accepted" + DELETING = "Deleting" + FAILED = "Failed" + CANCELED = "Canceled" + DELETED = "Deleted" + +class SkuDeploymentMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The sku deployment mode. + """ + + UNKNOWN = "Unknown" + AZURE = "Azure" + PRIVATE_EDGE_ZONE = "PrivateEdgeZone" + +class SkuType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Sku type. + """ + + UNKNOWN = "Unknown" + EVOLVED_PACKET_CORE = "EvolvedPacketCore" + SDWAN = "SDWAN" + FIREWALL = "Firewall" + +class Status(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The current device status. + """ + + UNKNOWN = "Unknown" + NOT_REGISTERED = "NotRegistered" + REGISTERED = "Registered" + DELETED = "Deleted" + +class VendorProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The current vendor provisioning state. + """ + + UNKNOWN = "Unknown" + NOT_PROVISIONED = "NotProvisioned" + PROVISIONING = "Provisioning" + PROVISIONED = "Provisioned" + DEPROVISIONED = "Deprovisioned" + USER_DATA_VALIDATION_FAILED = "UserDataValidationFailed" + +class VirtualMachineSizeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The size of the virtual machine. + """ + + UNKNOWN = "Unknown" + STANDARD_D1_V2 = "Standard_D1_v2" + STANDARD_D2_V2 = "Standard_D2_v2" + STANDARD_D3_V2 = "Standard_D3_v2" + STANDARD_D4_V2 = "Standard_D4_v2" + STANDARD_D5_V2 = "Standard_D5_v2" + STANDARD_D11_V2 = "Standard_D11_v2" + STANDARD_D12_V2 = "Standard_D12_v2" + STANDARD_D13_V2 = "Standard_D13_v2" + STANDARD_DS1_V2 = "Standard_DS1_v2" + STANDARD_DS2_V2 = "Standard_DS2_v2" + STANDARD_DS3_V2 = "Standard_DS3_v2" + STANDARD_DS4_V2 = "Standard_DS4_v2" + STANDARD_DS5_V2 = "Standard_DS5_v2" + STANDARD_DS11_V2 = "Standard_DS11_v2" + STANDARD_DS12_V2 = "Standard_DS12_v2" + STANDARD_DS13_V2 = "Standard_DS13_v2" + STANDARD_F1 = "Standard_F1" + STANDARD_F2 = "Standard_F2" + STANDARD_F4 = "Standard_F4" + STANDARD_F8 = "Standard_F8" + STANDARD_F16 = "Standard_F16" + STANDARD_F1_S = "Standard_F1s" + STANDARD_F2_S = "Standard_F2s" + STANDARD_F4_S = "Standard_F4s" + STANDARD_F8_S = "Standard_F8s" + STANDARD_F16_S = "Standard_F16s" + +class VMSwitchType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the VM switch. + """ + + UNKNOWN = "Unknown" + MANAGEMENT = "Management" + WAN = "Wan" + LAN = "Lan" diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/_models.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/_models.py new file mode 100644 index 000000000000..335150b78364 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/_models.py @@ -0,0 +1,1769 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class CustomProfile(msrest.serialization.Model): + """Specifies the custom settings for the virtual machine. + + :param metadata_configuration_path: Path for metadata configuration. + :type metadata_configuration_path: str + """ + + _attribute_map = { + 'metadata_configuration_path': {'key': 'metadataConfigurationPath', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomProfile, self).__init__(**kwargs) + self.metadata_configuration_path = kwargs.get('metadata_configuration_path', None) + + +class DataDisk(msrest.serialization.Model): + """Specifies information about the operating system disk used by the virtual machine. :code:`
`:code:`
` For more information about disks, see `About disks and VHDs for Azure virtual machines `_. + + :param create_option: Specifies how the virtual machine should be created. Possible values + include: "Unknown", "Empty". + :type create_option: str or ~hybrid_network_management_client.models.DiskCreateOptionTypes + :param name: The name of data disk. + :type name: str + :param disk_size_gb: Specifies the size of an empty disk in gigabytes. This element can be used + to overwrite the size of the disk in a virtual machine image. + :type disk_size_gb: int + """ + + _attribute_map = { + 'create_option': {'key': 'createOption', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(DataDisk, self).__init__(**kwargs) + self.create_option = kwargs.get('create_option', None) + self.name = kwargs.get('name', None) + self.disk_size_gb = kwargs.get('disk_size_gb', None) + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs['location'] + + +class Device(TrackedResource): + """Device resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :ivar status: The current device status. Possible values include: "Unknown", "NotRegistered", + "Registered", "Deleted". + :vartype status: str or ~hybrid_network_management_client.models.Status + :ivar provisioning_state: The provisioning state of the device resource. Possible values + include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", "Deleted". + :vartype provisioning_state: str or ~hybrid_network_management_client.models.ProvisioningState + :param device_type: The type of the device.Constant filled by server. Possible values include: + "Unknown", "AzureStackEdge". + :type device_type: str or ~hybrid_network_management_client.models.DeviceType + :param azure_stack_edge: The reference to the Azure stack edge device. + :type azure_stack_edge: ~hybrid_network_management_client.models.SubResource + :ivar network_functions: The list of network functions deployed on the device. + :vartype network_functions: list[~hybrid_network_management_client.models.SubResource] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'status': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'network_functions': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'device_type': {'key': 'properties.deviceType', 'type': 'str'}, + 'azure_stack_edge': {'key': 'properties.azureStackEdge', 'type': 'SubResource'}, + 'network_functions': {'key': 'properties.networkFunctions', 'type': '[SubResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(Device, self).__init__(**kwargs) + self.status = None + self.provisioning_state = None + self.device_type = None # type: Optional[str] + self.azure_stack_edge = kwargs.get('azure_stack_edge', None) + self.network_functions = None + + +class DeviceListResult(msrest.serialization.Model): + """Response for devices API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: A list of devices. + :type value: list[~hybrid_network_management_client.models.Device] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Device]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeviceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class DevicePropertiesFormat(msrest.serialization.Model): + """Device properties. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: . + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar status: The current device status. Possible values include: "Unknown", "NotRegistered", + "Registered", "Deleted". + :vartype status: str or ~hybrid_network_management_client.models.Status + :ivar provisioning_state: The provisioning state of the device resource. Possible values + include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", "Deleted". + :vartype provisioning_state: str or ~hybrid_network_management_client.models.ProvisioningState + :param device_type: Required. The type of the device.Constant filled by server. Possible + values include: "Unknown", "AzureStackEdge". + :type device_type: str or ~hybrid_network_management_client.models.DeviceType + :param azure_stack_edge: The reference to the Azure stack edge device. + :type azure_stack_edge: ~hybrid_network_management_client.models.SubResource + :ivar network_functions: The list of network functions deployed on the device. + :vartype network_functions: list[~hybrid_network_management_client.models.SubResource] + """ + + _validation = { + 'status': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'device_type': {'required': True}, + 'network_functions': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'device_type': {'key': 'deviceType', 'type': 'str'}, + 'azure_stack_edge': {'key': 'azureStackEdge', 'type': 'SubResource'}, + 'network_functions': {'key': 'networkFunctions', 'type': '[SubResource]'}, + } + + _subtype_map = { + 'device_type': {} + } + + def __init__( + self, + **kwargs + ): + super(DevicePropertiesFormat, self).__init__(**kwargs) + self.status = None + self.provisioning_state = None + self.device_type = None # type: Optional[str] + self.azure_stack_edge = kwargs.get('azure_stack_edge', None) + self.network_functions = None + + +class DeviceRegistrationKey(msrest.serialization.Model): + """The device registration key. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar registration_key: The registration key for the device. + :vartype registration_key: str + """ + + _validation = { + 'registration_key': {'readonly': True}, + } + + _attribute_map = { + 'registration_key': {'key': 'registrationKey', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeviceRegistrationKey, self).__init__(**kwargs) + self.registration_key = None + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~hybrid_network_management_client.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~hybrid_network_management_client.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~hybrid_network_management_client.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ImageReference(msrest.serialization.Model): + """The image reference properties. + + :param publisher: The image publisher. + :type publisher: str + :param offer: Specifies the offer of the image used to create the virtual machine. + :type offer: str + :param sku: The image SKU. + :type sku: str + :param version: Specifies the version of the image used to create the virtual machine. The + allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. + Specify 'latest' to use the latest version of an image available at deploy time. Even if you + use 'latest', the VM image will not automatically update after deploy time even if a new + version becomes available. + :type version: str + :param exact_version: Specifies in decimal numbers, the exact version of image used to create + the virtual machine. + :type exact_version: str + """ + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'offer': {'key': 'offer', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'exact_version': {'key': 'exactVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ImageReference, self).__init__(**kwargs) + self.publisher = kwargs.get('publisher', None) + self.offer = kwargs.get('offer', None) + self.sku = kwargs.get('sku', None) + self.version = kwargs.get('version', None) + self.exact_version = kwargs.get('exact_version', None) + + +class LinuxConfiguration(msrest.serialization.Model): + """Specifies the Linux operating system settings on the virtual machine. + + :param ssh: Specifies the ssh key configuration for a Linux OS. + :type ssh: ~hybrid_network_management_client.models.SshConfiguration + """ + + _attribute_map = { + 'ssh': {'key': 'ssh', 'type': 'SshConfiguration'}, + } + + def __init__( + self, + **kwargs + ): + super(LinuxConfiguration, self).__init__(**kwargs) + self.ssh = kwargs.get('ssh', None) + + +class NetworkFunction(TrackedResource): + """Network function resource response. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :param etag: A unique read-only string that changes whenever the resource is updated. + :type etag: str + :ivar provisioning_state: The provisioning state of the network function resource. Possible + values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted". + :vartype provisioning_state: str or ~hybrid_network_management_client.models.ProvisioningState + :param device: The reference to the device resource. + :type device: ~hybrid_network_management_client.models.SubResource + :param sku_name: The sku name for the network function. + :type sku_name: str + :ivar sku_type: The sku type for the network function. Possible values include: "Unknown", + "EvolvedPacketCore", "SDWAN", "Firewall". + :vartype sku_type: str or ~hybrid_network_management_client.models.SkuType + :param vendor_name: The vendor name for the network function. + :type vendor_name: str + :ivar service_key: The service key for the network function resource. + :vartype service_key: str + :ivar vendor_provisioning_state: The vendor provisioning state for the network function + resource. Possible values include: "Unknown", "NotProvisioned", "Provisioning", "Provisioned", + "Deprovisioned", "UserDataValidationFailed". + :vartype vendor_provisioning_state: str or + ~hybrid_network_management_client.models.VendorProvisioningState + :ivar managed_application: The resource URI of the managed application. + :vartype managed_application: ~hybrid_network_management_client.models.SubResource + :param managed_application_parameters: The parameters for the managed application. + :type managed_application_parameters: object + :param network_function_user_configurations: The network function configurations from the user. + :type network_function_user_configurations: + list[~hybrid_network_management_client.models.NetworkFunctionUserConfiguration] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'sku_type': {'readonly': True}, + 'service_key': {'readonly': True}, + 'vendor_provisioning_state': {'readonly': True}, + 'managed_application': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'device': {'key': 'properties.device', 'type': 'SubResource'}, + 'sku_name': {'key': 'properties.skuName', 'type': 'str'}, + 'sku_type': {'key': 'properties.skuType', 'type': 'str'}, + 'vendor_name': {'key': 'properties.vendorName', 'type': 'str'}, + 'service_key': {'key': 'properties.serviceKey', 'type': 'str'}, + 'vendor_provisioning_state': {'key': 'properties.vendorProvisioningState', 'type': 'str'}, + 'managed_application': {'key': 'properties.managedApplication', 'type': 'SubResource'}, + 'managed_application_parameters': {'key': 'properties.managedApplicationParameters', 'type': 'object'}, + 'network_function_user_configurations': {'key': 'properties.networkFunctionUserConfigurations', 'type': '[NetworkFunctionUserConfiguration]'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkFunction, self).__init__(**kwargs) + self.etag = kwargs.get('etag', None) + self.provisioning_state = None + self.device = kwargs.get('device', None) + self.sku_name = kwargs.get('sku_name', None) + self.sku_type = None + self.vendor_name = kwargs.get('vendor_name', None) + self.service_key = None + self.vendor_provisioning_state = None + self.managed_application = None + self.managed_application_parameters = kwargs.get('managed_application_parameters', None) + self.network_function_user_configurations = kwargs.get('network_function_user_configurations', None) + + +class NetworkFunctionListResult(msrest.serialization.Model): + """Response for network function API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: A list of network function resources in a subscription or resource group. + :type value: list[~hybrid_network_management_client.models.NetworkFunction] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkFunction]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkFunctionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class NetworkFunctionRoleConfiguration(msrest.serialization.Model): + """Network function role configuration. + + :param role_name: The name of the network function role. + :type role_name: str + :param role_type: Role type. Possible values include: "Unknown", "VirtualMachine". + :type role_type: str or + ~hybrid_network_management_client.models.NetworkFunctionRoleConfigurationType + :param virtual_machine_size: The size of the virtual machine. Possible values include: + "Unknown", "Standard_D1_v2", "Standard_D2_v2", "Standard_D3_v2", "Standard_D4_v2", + "Standard_D5_v2", "Standard_D11_v2", "Standard_D12_v2", "Standard_D13_v2", "Standard_DS1_v2", + "Standard_DS2_v2", "Standard_DS3_v2", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_DS11_v2", + "Standard_DS12_v2", "Standard_DS13_v2", "Standard_F1", "Standard_F2", "Standard_F4", + "Standard_F8", "Standard_F16", "Standard_F1s", "Standard_F2s", "Standard_F4s", "Standard_F8s", + "Standard_F16s". + :type virtual_machine_size: str or + ~hybrid_network_management_client.models.VirtualMachineSizeTypes + :param os_profile: Specifies the operating system settings for the role instance. This value + can be updated during the deployment of network function. + :type os_profile: ~hybrid_network_management_client.models.OsProfile + :param user_data_template: The user data template for customers. This is a json schema template + describing the format and data type of user data parameters. + :type user_data_template: object + :param user_data_parameters: The user parameters for customers. The format of user data + parameters has to be matched with the provided user data template. + :type user_data_parameters: object + :param network_interfaces: The network interface configurations. + :type network_interfaces: list[~hybrid_network_management_client.models.NetworkInterface] + :param storage_profile: Specifies the storage settings for the virtual machine disks. + :type storage_profile: ~hybrid_network_management_client.models.StorageProfile + :param custom_profile: Specifies the custom settings for the virtual machine. + :type custom_profile: ~hybrid_network_management_client.models.CustomProfile + """ + + _attribute_map = { + 'role_name': {'key': 'roleName', 'type': 'str'}, + 'role_type': {'key': 'roleType', 'type': 'str'}, + 'virtual_machine_size': {'key': 'virtualMachineSize', 'type': 'str'}, + 'os_profile': {'key': 'osProfile', 'type': 'OsProfile'}, + 'user_data_template': {'key': 'userDataTemplate', 'type': 'object'}, + 'user_data_parameters': {'key': 'userDataParameters', 'type': 'object'}, + 'network_interfaces': {'key': 'networkInterfaces', 'type': '[NetworkInterface]'}, + 'storage_profile': {'key': 'storageProfile', 'type': 'StorageProfile'}, + 'custom_profile': {'key': 'customProfile', 'type': 'CustomProfile'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkFunctionRoleConfiguration, self).__init__(**kwargs) + self.role_name = kwargs.get('role_name', None) + self.role_type = kwargs.get('role_type', None) + self.virtual_machine_size = kwargs.get('virtual_machine_size', None) + self.os_profile = kwargs.get('os_profile', None) + self.user_data_template = kwargs.get('user_data_template', None) + self.user_data_parameters = kwargs.get('user_data_parameters', None) + self.network_interfaces = kwargs.get('network_interfaces', None) + self.storage_profile = kwargs.get('storage_profile', None) + self.custom_profile = kwargs.get('custom_profile', None) + + +class NetworkFunctionRoleInstanceListResult(msrest.serialization.Model): + """List of role instances of vendor network function. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of role instances. + :vartype value: list[~hybrid_network_management_client.models.RoleInstance] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[RoleInstance]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkFunctionRoleInstanceListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class NetworkFunctionSkuDetails(msrest.serialization.Model): + """The network function sku details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param sku_type: The network function sku type. Possible values include: "Unknown", + "EvolvedPacketCore", "SDWAN", "Firewall". + :type sku_type: str or ~hybrid_network_management_client.models.SkuType + :param value: The network function sku role details. + :type value: list[~hybrid_network_management_client.models.NetworkFunctionSkuRoleDetails] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'sku_type': {'key': 'skuType', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[NetworkFunctionSkuRoleDetails]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkFunctionSkuDetails, self).__init__(**kwargs) + self.sku_type = kwargs.get('sku_type', None) + self.value = kwargs.get('value', None) + self.next_link = None + + +class NetworkFunctionSkuListResult(msrest.serialization.Model): + """A list of available network function skus. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The network function vendor sku overview properties. + :type value: list[~hybrid_network_management_client.models.SkuOverview] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SkuOverview]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkFunctionSkuListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class NetworkFunctionSkuRoleDetails(msrest.serialization.Model): + """The network function user configuration. + + :param role_name: The name of the network function role. + :type role_name: str + :param user_data_template: The user data template for customers. + :type user_data_template: object + :param user_data_parameters: The user parameters for customers. + :type user_data_parameters: object + :param network_interfaces: The network interface configuration. + :type network_interfaces: list[~hybrid_network_management_client.models.NetworkInterface] + """ + + _attribute_map = { + 'role_name': {'key': 'roleName', 'type': 'str'}, + 'user_data_template': {'key': 'userDataTemplate', 'type': 'object'}, + 'user_data_parameters': {'key': 'userDataParameters', 'type': 'object'}, + 'network_interfaces': {'key': 'networkInterfaces', 'type': '[NetworkInterface]'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkFunctionSkuRoleDetails, self).__init__(**kwargs) + self.role_name = kwargs.get('role_name', None) + self.user_data_template = kwargs.get('user_data_template', None) + self.user_data_parameters = kwargs.get('user_data_parameters', None) + self.network_interfaces = kwargs.get('network_interfaces', None) + + +class NetworkFunctionTemplate(msrest.serialization.Model): + """The network function template. + + :param network_function_role_configurations: An array of network function role definitions. + :type network_function_role_configurations: + list[~hybrid_network_management_client.models.NetworkFunctionRoleConfiguration] + """ + + _attribute_map = { + 'network_function_role_configurations': {'key': 'networkFunctionRoleConfigurations', 'type': '[NetworkFunctionRoleConfiguration]'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkFunctionTemplate, self).__init__(**kwargs) + self.network_function_role_configurations = kwargs.get('network_function_role_configurations', None) + + +class NetworkFunctionUserConfiguration(msrest.serialization.Model): + """The network function user configuration. + + :param role_name: The name of the network function role. + :type role_name: str + :param user_data_parameters: The user data parameters from the customer. + :type user_data_parameters: object + :param network_interfaces: The network interface configuration. + :type network_interfaces: list[~hybrid_network_management_client.models.NetworkInterface] + :param os_profile: Specifies the operating system settings for the role instance. + :type os_profile: + ~hybrid_network_management_client.models.NetworkFunctionUserConfigurationOsProfile + """ + + _attribute_map = { + 'role_name': {'key': 'roleName', 'type': 'str'}, + 'user_data_parameters': {'key': 'userDataParameters', 'type': 'object'}, + 'network_interfaces': {'key': 'networkInterfaces', 'type': '[NetworkInterface]'}, + 'os_profile': {'key': 'osProfile', 'type': 'NetworkFunctionUserConfigurationOsProfile'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkFunctionUserConfiguration, self).__init__(**kwargs) + self.role_name = kwargs.get('role_name', None) + self.user_data_parameters = kwargs.get('user_data_parameters', None) + self.network_interfaces = kwargs.get('network_interfaces', None) + self.os_profile = kwargs.get('os_profile', None) + + +class NetworkFunctionUserConfigurationOsProfile(msrest.serialization.Model): + """Specifies the operating system settings for the role instance. + + :param custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded + string is decoded to a binary array that is saved as a file on the virtual machine. The maximum + length of the binary array is 65535 bytes. :code:`
`:code:`
` **Note: Do not pass any + secrets or passwords in customData property** :code:`
`:code:`
` This property cannot be + updated after the VM is created. :code:`
`:code:`
` customData is passed to the VM to be + saved as a file. For more information see `Custom Data on Azure VMs + `_ + :code:`
`:code:`
` For using cloud-init for your Linux VM, see `Using cloud-init to + customize a Linux VM during creation `_. + :type custom_data: str + """ + + _attribute_map = { + 'custom_data': {'key': 'customData', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkFunctionUserConfigurationOsProfile, self).__init__(**kwargs) + self.custom_data = kwargs.get('custom_data', None) + + +class NetworkFunctionVendor(msrest.serialization.Model): + """The network function vendor. + + :param vendor_name: The network function vendor name. + :type vendor_name: str + :param sku_list: The network function sku list. + :type sku_list: list[~hybrid_network_management_client.models.SkuOverview] + """ + + _attribute_map = { + 'vendor_name': {'key': 'properties.vendorName', 'type': 'str'}, + 'sku_list': {'key': 'properties.skuList', 'type': '[SkuOverview]'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkFunctionVendor, self).__init__(**kwargs) + self.vendor_name = kwargs.get('vendor_name', None) + self.sku_list = kwargs.get('sku_list', None) + + +class NetworkFunctionVendorConfiguration(msrest.serialization.Model): + """Network function vendor configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param role_name: The name of the vendor network function role. + :type role_name: str + :param os_profile: Specifies the operating system settings for the role instance. + :type os_profile: ~hybrid_network_management_client.models.OsProfile + :ivar user_data_parameters: The user parameters from the customer. + :vartype user_data_parameters: object + :param network_interfaces: The network interface configurations. + :type network_interfaces: list[~hybrid_network_management_client.models.NetworkInterface] + """ + + _validation = { + 'user_data_parameters': {'readonly': True}, + } + + _attribute_map = { + 'role_name': {'key': 'roleName', 'type': 'str'}, + 'os_profile': {'key': 'osProfile', 'type': 'OsProfile'}, + 'user_data_parameters': {'key': 'userDataParameters', 'type': 'object'}, + 'network_interfaces': {'key': 'networkInterfaces', 'type': '[NetworkInterface]'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkFunctionVendorConfiguration, self).__init__(**kwargs) + self.role_name = kwargs.get('role_name', None) + self.os_profile = kwargs.get('os_profile', None) + self.user_data_parameters = None + self.network_interfaces = kwargs.get('network_interfaces', None) + + +class NetworkFunctionVendorListResult(msrest.serialization.Model): + """The network function vendor list result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: A list of available network function vendors and skus. + :type value: list[~hybrid_network_management_client.models.NetworkFunctionVendor] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkFunctionVendor]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkFunctionVendorListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class NetworkInterface(msrest.serialization.Model): + """Network interface properties. + + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param mac_address: The MAC address of the network interface. + :type mac_address: str + :param ip_configurations: A list of IP configurations of the network interface. + :type ip_configurations: + list[~hybrid_network_management_client.models.NetworkInterfaceIPConfiguration] + :param vm_switch_type: The type of the VM switch. Possible values include: "Unknown", + "Management", "Wan", "Lan". + :type vm_switch_type: str or ~hybrid_network_management_client.models.VMSwitchType + """ + + _attribute_map = { + 'network_interface_name': {'key': 'networkInterfaceName', 'type': 'str'}, + 'mac_address': {'key': 'macAddress', 'type': 'str'}, + 'ip_configurations': {'key': 'ipConfigurations', 'type': '[NetworkInterfaceIPConfiguration]'}, + 'vm_switch_type': {'key': 'vmSwitchType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkInterface, self).__init__(**kwargs) + self.network_interface_name = kwargs.get('network_interface_name', None) + self.mac_address = kwargs.get('mac_address', None) + self.ip_configurations = kwargs.get('ip_configurations', None) + self.vm_switch_type = kwargs.get('vm_switch_type', None) + + +class NetworkInterfaceIPConfiguration(msrest.serialization.Model): + """Network interface IP configuration properties. + + :param ip_allocation_method: IP address allocation method. Possible values include: "Unknown", + "Static", "Dynamic". + :type ip_allocation_method: str or ~hybrid_network_management_client.models.IPAllocationMethod + :param ip_address: The value of the IP address. + :type ip_address: str + :param subnet: The value of the subnet. + :type subnet: str + :param gateway: The value of the gateway. + :type gateway: str + :param ip_version: IP address version. Possible values include: "Unknown", "IPv4". + :type ip_version: str or ~hybrid_network_management_client.models.IPVersion + :param dns_servers: The list of DNS servers IP addresses. + :type dns_servers: list[str] + """ + + _attribute_map = { + 'ip_allocation_method': {'key': 'ipAllocationMethod', 'type': 'str'}, + 'ip_address': {'key': 'ipAddress', 'type': 'str'}, + 'subnet': {'key': 'subnet', 'type': 'str'}, + 'gateway': {'key': 'gateway', 'type': 'str'}, + 'ip_version': {'key': 'ipVersion', 'type': 'str'}, + 'dns_servers': {'key': 'dnsServers', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkInterfaceIPConfiguration, self).__init__(**kwargs) + self.ip_allocation_method = kwargs.get('ip_allocation_method', None) + self.ip_address = kwargs.get('ip_address', None) + self.subnet = kwargs.get('subnet', None) + self.gateway = kwargs.get('gateway', None) + self.ip_version = kwargs.get('ip_version', None) + self.dns_servers = kwargs.get('dns_servers', None) + + +class Operation(msrest.serialization.Model): + """Object that describes a single Microsoft.HybridNetwork operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The object that represents the operation. + :vartype display: ~hybrid_network_management_client.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + 'display': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = None + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.HybridNetwork. + :type provider: str + :param resource: Resource on which the operation is performed: Registration definition, + registration assignment, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + :param description: Description of the operation. + :type description: str + """ + + _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 = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class OperationList(msrest.serialization.Model): + """A list of the operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of Microsoft.HybridNetwork operations. + :vartype value: list[~hybrid_network_management_client.models.Operation] + :ivar next_link: The URL to get the next set of results. + :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(OperationList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class OsDisk(msrest.serialization.Model): + """Specifies information about the operating system disk used by the virtual machine. :code:`
`:code:`
` For more information about disks, see `About disks and VHDs for Azure virtual machines `_. + + :param os_type: The OS type. Possible values include: "Unknown", "Windows", "Linux". + :type os_type: str or ~hybrid_network_management_client.models.OperatingSystemTypes + :param name: The VHD name. + :type name: str + :param vhd: The virtual hard disk. + :type vhd: ~hybrid_network_management_client.models.VirtualHardDisk + :param disk_size_gb: Specifies the size of os disk in gigabytes. This is the fully expanded + disk size needed of the VHD image on the ASE. This disk size should be greater than the size of + the VHD provided in vhdUri. + :type disk_size_gb: int + """ + + _attribute_map = { + 'os_type': {'key': 'osType', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'vhd': {'key': 'vhd', 'type': 'VirtualHardDisk'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(OsDisk, self).__init__(**kwargs) + self.os_type = kwargs.get('os_type', None) + self.name = kwargs.get('name', None) + self.vhd = kwargs.get('vhd', None) + self.disk_size_gb = kwargs.get('disk_size_gb', None) + + +class OsProfile(msrest.serialization.Model): + """Specifies the operating system settings for the role instance. + + :param admin_username: Specifies the name of the administrator account. + :code:`
`:code:`
` **Windows-only restriction:** Cannot end in "." + :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", + "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", + "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", + "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". + :code:`
`:code:`
` **Minimum-length (Linux):** 1 character :code:`
`:code:`
` + **Max-length (Linux):** 64 characters :code:`
`:code:`
` **Max-length (Windows):** 20 + characters :code:`
`:code:`
`:code:`
  • ` For root access to the Linux VM, see `Using + root privileges on Linux virtual machines in Azure `_\ :code:`
    `:code:`
  • ` For a list of built-in system users on + Linux that should not be used in this field, see `Selecting User Names for Linux on Azure + `_. + :type admin_username: str + :param linux_configuration: Specifies the Linux operating system settings on the virtual + machine. :code:`
    `:code:`
    `For a list of supported Linux distributions, see `Linux on + Azure-Endorsed Distributions `_ + :code:`
    `:code:`
    ` For running non-endorsed distributions, see `Information for Non- + Endorsed Distributions `_. + :type linux_configuration: ~hybrid_network_management_client.models.LinuxConfiguration + :param custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded + string is decoded to a binary array that is saved as a file on the virtual machine. The maximum + length of the binary array is 65535 bytes. :code:`
    `:code:`
    ` **Note: Do not pass any + secrets or passwords in customData property** :code:`
    `:code:`
    ` This property cannot be + updated after the VM is created. :code:`
    `:code:`
    ` customData is passed to the VM to be + saved as a file. For more information see `Custom Data on Azure VMs + `_ + :code:`
    `:code:`
    ` For using cloud-init for your Linux VM, see `Using cloud-init to + customize a Linux VM during creation `_. + :type custom_data: str + :param custom_data_required: Indicates if custom data is required to deploy this role. + :type custom_data_required: bool + """ + + _attribute_map = { + 'admin_username': {'key': 'adminUsername', 'type': 'str'}, + 'linux_configuration': {'key': 'linuxConfiguration', 'type': 'LinuxConfiguration'}, + 'custom_data': {'key': 'customData', 'type': 'str'}, + 'custom_data_required': {'key': 'customDataRequired', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(OsProfile, self).__init__(**kwargs) + self.admin_username = kwargs.get('admin_username', None) + self.linux_configuration = kwargs.get('linux_configuration', None) + self.custom_data = kwargs.get('custom_data', None) + self.custom_data_required = kwargs.get('custom_data_required', True) + + +class PreviewSubscription(msrest.serialization.Model): + """Customer subscription which can use a sku. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The preview subscription ID. + :vartype name: str + :ivar id: The ARM ID of the resource. + :vartype id: str + :ivar type: The type of the resource. + :vartype type: str + """ + + _validation = { + 'name': {'readonly': True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PreviewSubscription, self).__init__(**kwargs) + self.name = None + self.id = None + self.type = None + + +class PreviewSubscriptionsList(msrest.serialization.Model): + """A list of customer subscriptions which can use a sku. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: A list of preview subscriptions. + :type value: list[~hybrid_network_management_client.models.PreviewSubscription] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PreviewSubscription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PreviewSubscriptionsList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + + +class RoleInstance(msrest.serialization.Model): + """The role instance sub resource. + + :param name: The role instance name. + :type name: str + :param id: The ARM ID of the resource. + :type id: str + :param type: The type of the resource. + :type type: str + :param operational_state: The operational state of the role instance. Possible values include: + "Unknown", "Stopped", "Running", "Stopping", "Starting". + :type operational_state: str or ~hybrid_network_management_client.models.OperationalState + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'operational_state': {'key': 'properties.operationalState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoleInstance, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.id = kwargs.get('id', None) + self.type = kwargs.get('type', None) + self.operational_state = kwargs.get('operational_state', None) + + +class SkuOverview(msrest.serialization.Model): + """The network function sku overview. + + :param sku_name: The vendor sku name. + :type sku_name: str + :param sku_type: The vendor sku type. Possible values include: "Unknown", "EvolvedPacketCore", + "SDWAN", "Firewall". + :type sku_type: str or ~hybrid_network_management_client.models.SkuType + """ + + _attribute_map = { + 'sku_name': {'key': 'skuName', 'type': 'str'}, + 'sku_type': {'key': 'skuType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SkuOverview, self).__init__(**kwargs) + self.sku_name = kwargs.get('sku_name', None) + self.sku_type = kwargs.get('sku_type', None) + + +class SshConfiguration(msrest.serialization.Model): + """SSH configuration for Linux based VMs running on Azure. + + :param public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :type public_keys: list[~hybrid_network_management_client.models.SshPublicKey] + """ + + _attribute_map = { + 'public_keys': {'key': 'publicKeys', 'type': '[SshPublicKey]'}, + } + + def __init__( + self, + **kwargs + ): + super(SshConfiguration, self).__init__(**kwargs) + self.public_keys = kwargs.get('public_keys', None) + + +class SshPublicKey(msrest.serialization.Model): + """Contains information about SSH certificate public key and the path on the Linux VM where the public key is placed. + + :param path: Specifies the full path on the created VM where ssh public key is stored. If the + file already exists, the specified key is appended to the file. Example: + /home/user/.ssh/authorized_keys. + :type path: str + :param key_data: SSH public key certificate used to authenticate with the VM through ssh. The + key needs to be at least 2048-bit and in ssh-rsa format. :code:`
    `:code:`
    ` For creating + ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure + `_. + :type key_data: str + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'key_data': {'key': 'keyData', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SshPublicKey, self).__init__(**kwargs) + self.path = kwargs.get('path', None) + self.key_data = kwargs.get('key_data', None) + + +class StorageProfile(msrest.serialization.Model): + """Specifies the storage settings for the virtual machine disks. + + :param image_reference: The image reference properties. + :type image_reference: ~hybrid_network_management_client.models.ImageReference + :param os_disk: Specifies information about the operating system disk used by the virtual + machine. + :type os_disk: ~hybrid_network_management_client.models.OsDisk + :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + machine. + :type data_disks: list[~hybrid_network_management_client.models.DataDisk] + """ + + _attribute_map = { + 'image_reference': {'key': 'imageReference', 'type': 'ImageReference'}, + 'os_disk': {'key': 'osDisk', 'type': 'OsDisk'}, + 'data_disks': {'key': 'dataDisks', 'type': '[DataDisk]'}, + } + + def __init__( + self, + **kwargs + ): + super(StorageProfile, self).__init__(**kwargs) + self.image_reference = kwargs.get('image_reference', None) + self.os_disk = kwargs.get('os_disk', None) + self.data_disks = kwargs.get('data_disks', None) + + +class SubResource(msrest.serialization.Model): + """Reference to another sub resource. + + :param id: Resource ID. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SubResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class TagsObject(msrest.serialization.Model): + """Tags object for patch operations. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(TagsObject, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class Vendor(ProxyResource): + """Vendor 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 provisioning_state: The provisioning state of the vendor resource. Possible values + include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", "Deleted". + :vartype provisioning_state: str or ~hybrid_network_management_client.models.ProvisioningState + :ivar skus: A list of IDs of the vendor skus offered by the vendor. + :vartype skus: list[~hybrid_network_management_client.models.SubResource] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'skus': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'skus': {'key': 'properties.skus', 'type': '[SubResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(Vendor, self).__init__(**kwargs) + self.provisioning_state = None + self.skus = None + + +class VendorListResult(msrest.serialization.Model): + """Response for vendors API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: A list of vendors. + :type value: list[~hybrid_network_management_client.models.Vendor] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Vendor]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VendorListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class VendorNetworkFunction(ProxyResource): + """Vendor network function sub 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 provisioning_state: The provisioning state of the vendor network function sub resource. + Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted". + :vartype provisioning_state: str or ~hybrid_network_management_client.models.ProvisioningState + :param vendor_provisioning_state: The vendor controlled provisioning state of the vendor + network function. Possible values include: "Unknown", "NotProvisioned", "Provisioning", + "Provisioned", "Deprovisioned", "UserDataValidationFailed". + :type vendor_provisioning_state: str or + ~hybrid_network_management_client.models.VendorProvisioningState + :ivar sku_name: The name of the sku. + :vartype sku_name: str + :ivar sku_type: The sku type. Possible values include: "Unknown", "EvolvedPacketCore", "SDWAN", + "Firewall". + :vartype sku_type: str or ~hybrid_network_management_client.models.SkuType + :param network_function_vendor_configurations: An array of network function vendor + configurations. + :type network_function_vendor_configurations: + list[~hybrid_network_management_client.models.NetworkFunctionVendorConfiguration] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'sku_name': {'readonly': True}, + 'sku_type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'vendor_provisioning_state': {'key': 'properties.vendorProvisioningState', 'type': 'str'}, + 'sku_name': {'key': 'properties.skuName', 'type': 'str'}, + 'sku_type': {'key': 'properties.skuType', 'type': 'str'}, + 'network_function_vendor_configurations': {'key': 'properties.networkFunctionVendorConfigurations', 'type': '[NetworkFunctionVendorConfiguration]'}, + } + + def __init__( + self, + **kwargs + ): + super(VendorNetworkFunction, self).__init__(**kwargs) + self.provisioning_state = None + self.vendor_provisioning_state = kwargs.get('vendor_provisioning_state', None) + self.sku_name = None + self.sku_type = None + self.network_function_vendor_configurations = kwargs.get('network_function_vendor_configurations', None) + + +class VendorNetworkFunctionListResult(msrest.serialization.Model): + """Response for vendors API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: A list of vendor network functions. + :type value: list[~hybrid_network_management_client.models.VendorNetworkFunction] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VendorNetworkFunction]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VendorNetworkFunctionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class VendorSku(ProxyResource): + """Sku sub 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 provisioning_state: The provisioning state of the vendor sku sub resource. Possible + values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted". + :vartype provisioning_state: str or ~hybrid_network_management_client.models.ProvisioningState + :param sku_type: The sku type. Possible values include: "Unknown", "EvolvedPacketCore", + "SDWAN", "Firewall". + :type sku_type: str or ~hybrid_network_management_client.models.SkuType + :param deployment_mode: The sku deployment mode. Possible values include: "Unknown", "Azure", + "PrivateEdgeZone". + :type deployment_mode: str or ~hybrid_network_management_client.models.SkuDeploymentMode + :param preview: Indicates if the vendor sku is in preview mode. + :type preview: bool + :param managed_application_parameters: The parameters for the managed application to be + supplied by the vendor. + :type managed_application_parameters: object + :param managed_application_template: The template for the managed application deployment. + :type managed_application_template: object + :param network_function_template: The template definition of the network function. + :type network_function_template: + ~hybrid_network_management_client.models.NetworkFunctionTemplate + """ + + _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'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'sku_type': {'key': 'properties.skuType', 'type': 'str'}, + 'deployment_mode': {'key': 'properties.deploymentMode', 'type': 'str'}, + 'preview': {'key': 'properties.preview', 'type': 'bool'}, + 'managed_application_parameters': {'key': 'properties.managedApplicationParameters', 'type': 'object'}, + 'managed_application_template': {'key': 'properties.managedApplicationTemplate', 'type': 'object'}, + 'network_function_template': {'key': 'properties.networkFunctionTemplate', 'type': 'NetworkFunctionTemplate'}, + } + + def __init__( + self, + **kwargs + ): + super(VendorSku, self).__init__(**kwargs) + self.provisioning_state = None + self.sku_type = kwargs.get('sku_type', None) + self.deployment_mode = kwargs.get('deployment_mode', None) + self.preview = kwargs.get('preview', None) + self.managed_application_parameters = kwargs.get('managed_application_parameters', None) + self.managed_application_template = kwargs.get('managed_application_template', None) + self.network_function_template = kwargs.get('network_function_template', None) + + +class VendorSkuListResult(msrest.serialization.Model): + """Response for list vendor sku API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: A list of vendor skus offered by the vendor. + :type value: list[~hybrid_network_management_client.models.VendorSku] + :ivar next_link: The URI to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VendorSku]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VendorSkuListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class VirtualHardDisk(msrest.serialization.Model): + """Describes the uri of a disk. + + :param uri: Specifies the virtual hard disk's uri. + :type uri: str + """ + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualHardDisk, self).__init__(**kwargs) + self.uri = kwargs.get('uri', None) diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/_models_py3.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/_models_py3.py new file mode 100644 index 000000000000..fe5245b03e82 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/models/_models_py3.py @@ -0,0 +1,1917 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._hybrid_network_management_client_enums import * + + +class CustomProfile(msrest.serialization.Model): + """Specifies the custom settings for the virtual machine. + + :param metadata_configuration_path: Path for metadata configuration. + :type metadata_configuration_path: str + """ + + _attribute_map = { + 'metadata_configuration_path': {'key': 'metadataConfigurationPath', 'type': 'str'}, + } + + def __init__( + self, + *, + metadata_configuration_path: Optional[str] = None, + **kwargs + ): + super(CustomProfile, self).__init__(**kwargs) + self.metadata_configuration_path = metadata_configuration_path + + +class DataDisk(msrest.serialization.Model): + """Specifies information about the operating system disk used by the virtual machine. :code:`
    `:code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines `_. + + :param create_option: Specifies how the virtual machine should be created. Possible values + include: "Unknown", "Empty". + :type create_option: str or ~hybrid_network_management_client.models.DiskCreateOptionTypes + :param name: The name of data disk. + :type name: str + :param disk_size_gb: Specifies the size of an empty disk in gigabytes. This element can be used + to overwrite the size of the disk in a virtual machine image. + :type disk_size_gb: int + """ + + _attribute_map = { + 'create_option': {'key': 'createOption', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + } + + def __init__( + self, + *, + create_option: Optional[Union[str, "DiskCreateOptionTypes"]] = None, + name: Optional[str] = None, + disk_size_gb: Optional[int] = None, + **kwargs + ): + super(DataDisk, self).__init__(**kwargs) + self.create_option = create_option + self.name = name + self.disk_size_gb = disk_size_gb + + +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 TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class Device(TrackedResource): + """Device resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :ivar status: The current device status. Possible values include: "Unknown", "NotRegistered", + "Registered", "Deleted". + :vartype status: str or ~hybrid_network_management_client.models.Status + :ivar provisioning_state: The provisioning state of the device resource. Possible values + include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", "Deleted". + :vartype provisioning_state: str or ~hybrid_network_management_client.models.ProvisioningState + :param device_type: The type of the device.Constant filled by server. Possible values include: + "Unknown", "AzureStackEdge". + :type device_type: str or ~hybrid_network_management_client.models.DeviceType + :param azure_stack_edge: The reference to the Azure stack edge device. + :type azure_stack_edge: ~hybrid_network_management_client.models.SubResource + :ivar network_functions: The list of network functions deployed on the device. + :vartype network_functions: list[~hybrid_network_management_client.models.SubResource] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'status': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'network_functions': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'device_type': {'key': 'properties.deviceType', 'type': 'str'}, + 'azure_stack_edge': {'key': 'properties.azureStackEdge', 'type': 'SubResource'}, + 'network_functions': {'key': 'properties.networkFunctions', 'type': '[SubResource]'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + azure_stack_edge: Optional["SubResource"] = None, + **kwargs + ): + super(Device, self).__init__(tags=tags, location=location, **kwargs) + self.status = None + self.provisioning_state = None + self.device_type = None # type: Optional[str] + self.azure_stack_edge = azure_stack_edge + self.network_functions = None + + +class DeviceListResult(msrest.serialization.Model): + """Response for devices API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: A list of devices. + :type value: list[~hybrid_network_management_client.models.Device] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Device]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Device"]] = None, + **kwargs + ): + super(DeviceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DevicePropertiesFormat(msrest.serialization.Model): + """Device properties. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: . + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar status: The current device status. Possible values include: "Unknown", "NotRegistered", + "Registered", "Deleted". + :vartype status: str or ~hybrid_network_management_client.models.Status + :ivar provisioning_state: The provisioning state of the device resource. Possible values + include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", "Deleted". + :vartype provisioning_state: str or ~hybrid_network_management_client.models.ProvisioningState + :param device_type: Required. The type of the device.Constant filled by server. Possible + values include: "Unknown", "AzureStackEdge". + :type device_type: str or ~hybrid_network_management_client.models.DeviceType + :param azure_stack_edge: The reference to the Azure stack edge device. + :type azure_stack_edge: ~hybrid_network_management_client.models.SubResource + :ivar network_functions: The list of network functions deployed on the device. + :vartype network_functions: list[~hybrid_network_management_client.models.SubResource] + """ + + _validation = { + 'status': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'device_type': {'required': True}, + 'network_functions': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'device_type': {'key': 'deviceType', 'type': 'str'}, + 'azure_stack_edge': {'key': 'azureStackEdge', 'type': 'SubResource'}, + 'network_functions': {'key': 'networkFunctions', 'type': '[SubResource]'}, + } + + _subtype_map = { + 'device_type': {} + } + + def __init__( + self, + *, + azure_stack_edge: Optional["SubResource"] = None, + **kwargs + ): + super(DevicePropertiesFormat, self).__init__(**kwargs) + self.status = None + self.provisioning_state = None + self.device_type = None # type: Optional[str] + self.azure_stack_edge = azure_stack_edge + self.network_functions = None + + +class DeviceRegistrationKey(msrest.serialization.Model): + """The device registration key. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar registration_key: The registration key for the device. + :vartype registration_key: str + """ + + _validation = { + 'registration_key': {'readonly': True}, + } + + _attribute_map = { + 'registration_key': {'key': 'registrationKey', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeviceRegistrationKey, self).__init__(**kwargs) + self.registration_key = None + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~hybrid_network_management_client.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~hybrid_network_management_client.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~hybrid_network_management_client.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ImageReference(msrest.serialization.Model): + """The image reference properties. + + :param publisher: The image publisher. + :type publisher: str + :param offer: Specifies the offer of the image used to create the virtual machine. + :type offer: str + :param sku: The image SKU. + :type sku: str + :param version: Specifies the version of the image used to create the virtual machine. The + allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. + Specify 'latest' to use the latest version of an image available at deploy time. Even if you + use 'latest', the VM image will not automatically update after deploy time even if a new + version becomes available. + :type version: str + :param exact_version: Specifies in decimal numbers, the exact version of image used to create + the virtual machine. + :type exact_version: str + """ + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'offer': {'key': 'offer', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'exact_version': {'key': 'exactVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + publisher: Optional[str] = None, + offer: Optional[str] = None, + sku: Optional[str] = None, + version: Optional[str] = None, + exact_version: Optional[str] = None, + **kwargs + ): + super(ImageReference, self).__init__(**kwargs) + self.publisher = publisher + self.offer = offer + self.sku = sku + self.version = version + self.exact_version = exact_version + + +class LinuxConfiguration(msrest.serialization.Model): + """Specifies the Linux operating system settings on the virtual machine. + + :param ssh: Specifies the ssh key configuration for a Linux OS. + :type ssh: ~hybrid_network_management_client.models.SshConfiguration + """ + + _attribute_map = { + 'ssh': {'key': 'ssh', 'type': 'SshConfiguration'}, + } + + def __init__( + self, + *, + ssh: Optional["SshConfiguration"] = None, + **kwargs + ): + super(LinuxConfiguration, self).__init__(**kwargs) + self.ssh = ssh + + +class NetworkFunction(TrackedResource): + """Network function resource response. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :param etag: A unique read-only string that changes whenever the resource is updated. + :type etag: str + :ivar provisioning_state: The provisioning state of the network function resource. Possible + values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted". + :vartype provisioning_state: str or ~hybrid_network_management_client.models.ProvisioningState + :param device: The reference to the device resource. + :type device: ~hybrid_network_management_client.models.SubResource + :param sku_name: The sku name for the network function. + :type sku_name: str + :ivar sku_type: The sku type for the network function. Possible values include: "Unknown", + "EvolvedPacketCore", "SDWAN", "Firewall". + :vartype sku_type: str or ~hybrid_network_management_client.models.SkuType + :param vendor_name: The vendor name for the network function. + :type vendor_name: str + :ivar service_key: The service key for the network function resource. + :vartype service_key: str + :ivar vendor_provisioning_state: The vendor provisioning state for the network function + resource. Possible values include: "Unknown", "NotProvisioned", "Provisioning", "Provisioned", + "Deprovisioned", "UserDataValidationFailed". + :vartype vendor_provisioning_state: str or + ~hybrid_network_management_client.models.VendorProvisioningState + :ivar managed_application: The resource URI of the managed application. + :vartype managed_application: ~hybrid_network_management_client.models.SubResource + :param managed_application_parameters: The parameters for the managed application. + :type managed_application_parameters: object + :param network_function_user_configurations: The network function configurations from the user. + :type network_function_user_configurations: + list[~hybrid_network_management_client.models.NetworkFunctionUserConfiguration] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'sku_type': {'readonly': True}, + 'service_key': {'readonly': True}, + 'vendor_provisioning_state': {'readonly': True}, + 'managed_application': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'device': {'key': 'properties.device', 'type': 'SubResource'}, + 'sku_name': {'key': 'properties.skuName', 'type': 'str'}, + 'sku_type': {'key': 'properties.skuType', 'type': 'str'}, + 'vendor_name': {'key': 'properties.vendorName', 'type': 'str'}, + 'service_key': {'key': 'properties.serviceKey', 'type': 'str'}, + 'vendor_provisioning_state': {'key': 'properties.vendorProvisioningState', 'type': 'str'}, + 'managed_application': {'key': 'properties.managedApplication', 'type': 'SubResource'}, + 'managed_application_parameters': {'key': 'properties.managedApplicationParameters', 'type': 'object'}, + 'network_function_user_configurations': {'key': 'properties.networkFunctionUserConfigurations', 'type': '[NetworkFunctionUserConfiguration]'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + etag: Optional[str] = None, + device: Optional["SubResource"] = None, + sku_name: Optional[str] = None, + vendor_name: Optional[str] = None, + managed_application_parameters: Optional[object] = None, + network_function_user_configurations: Optional[List["NetworkFunctionUserConfiguration"]] = None, + **kwargs + ): + super(NetworkFunction, self).__init__(tags=tags, location=location, **kwargs) + self.etag = etag + self.provisioning_state = None + self.device = device + self.sku_name = sku_name + self.sku_type = None + self.vendor_name = vendor_name + self.service_key = None + self.vendor_provisioning_state = None + self.managed_application = None + self.managed_application_parameters = managed_application_parameters + self.network_function_user_configurations = network_function_user_configurations + + +class NetworkFunctionListResult(msrest.serialization.Model): + """Response for network function API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: A list of network function resources in a subscription or resource group. + :type value: list[~hybrid_network_management_client.models.NetworkFunction] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkFunction]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NetworkFunction"]] = None, + **kwargs + ): + super(NetworkFunctionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class NetworkFunctionRoleConfiguration(msrest.serialization.Model): + """Network function role configuration. + + :param role_name: The name of the network function role. + :type role_name: str + :param role_type: Role type. Possible values include: "Unknown", "VirtualMachine". + :type role_type: str or + ~hybrid_network_management_client.models.NetworkFunctionRoleConfigurationType + :param virtual_machine_size: The size of the virtual machine. Possible values include: + "Unknown", "Standard_D1_v2", "Standard_D2_v2", "Standard_D3_v2", "Standard_D4_v2", + "Standard_D5_v2", "Standard_D11_v2", "Standard_D12_v2", "Standard_D13_v2", "Standard_DS1_v2", + "Standard_DS2_v2", "Standard_DS3_v2", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_DS11_v2", + "Standard_DS12_v2", "Standard_DS13_v2", "Standard_F1", "Standard_F2", "Standard_F4", + "Standard_F8", "Standard_F16", "Standard_F1s", "Standard_F2s", "Standard_F4s", "Standard_F8s", + "Standard_F16s". + :type virtual_machine_size: str or + ~hybrid_network_management_client.models.VirtualMachineSizeTypes + :param os_profile: Specifies the operating system settings for the role instance. This value + can be updated during the deployment of network function. + :type os_profile: ~hybrid_network_management_client.models.OsProfile + :param user_data_template: The user data template for customers. This is a json schema template + describing the format and data type of user data parameters. + :type user_data_template: object + :param user_data_parameters: The user parameters for customers. The format of user data + parameters has to be matched with the provided user data template. + :type user_data_parameters: object + :param network_interfaces: The network interface configurations. + :type network_interfaces: list[~hybrid_network_management_client.models.NetworkInterface] + :param storage_profile: Specifies the storage settings for the virtual machine disks. + :type storage_profile: ~hybrid_network_management_client.models.StorageProfile + :param custom_profile: Specifies the custom settings for the virtual machine. + :type custom_profile: ~hybrid_network_management_client.models.CustomProfile + """ + + _attribute_map = { + 'role_name': {'key': 'roleName', 'type': 'str'}, + 'role_type': {'key': 'roleType', 'type': 'str'}, + 'virtual_machine_size': {'key': 'virtualMachineSize', 'type': 'str'}, + 'os_profile': {'key': 'osProfile', 'type': 'OsProfile'}, + 'user_data_template': {'key': 'userDataTemplate', 'type': 'object'}, + 'user_data_parameters': {'key': 'userDataParameters', 'type': 'object'}, + 'network_interfaces': {'key': 'networkInterfaces', 'type': '[NetworkInterface]'}, + 'storage_profile': {'key': 'storageProfile', 'type': 'StorageProfile'}, + 'custom_profile': {'key': 'customProfile', 'type': 'CustomProfile'}, + } + + def __init__( + self, + *, + role_name: Optional[str] = None, + role_type: Optional[Union[str, "NetworkFunctionRoleConfigurationType"]] = None, + virtual_machine_size: Optional[Union[str, "VirtualMachineSizeTypes"]] = None, + os_profile: Optional["OsProfile"] = None, + user_data_template: Optional[object] = None, + user_data_parameters: Optional[object] = None, + network_interfaces: Optional[List["NetworkInterface"]] = None, + storage_profile: Optional["StorageProfile"] = None, + custom_profile: Optional["CustomProfile"] = None, + **kwargs + ): + super(NetworkFunctionRoleConfiguration, self).__init__(**kwargs) + self.role_name = role_name + self.role_type = role_type + self.virtual_machine_size = virtual_machine_size + self.os_profile = os_profile + self.user_data_template = user_data_template + self.user_data_parameters = user_data_parameters + self.network_interfaces = network_interfaces + self.storage_profile = storage_profile + self.custom_profile = custom_profile + + +class NetworkFunctionRoleInstanceListResult(msrest.serialization.Model): + """List of role instances of vendor network function. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of role instances. + :vartype value: list[~hybrid_network_management_client.models.RoleInstance] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[RoleInstance]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkFunctionRoleInstanceListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class NetworkFunctionSkuDetails(msrest.serialization.Model): + """The network function sku details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param sku_type: The network function sku type. Possible values include: "Unknown", + "EvolvedPacketCore", "SDWAN", "Firewall". + :type sku_type: str or ~hybrid_network_management_client.models.SkuType + :param value: The network function sku role details. + :type value: list[~hybrid_network_management_client.models.NetworkFunctionSkuRoleDetails] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'sku_type': {'key': 'skuType', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[NetworkFunctionSkuRoleDetails]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + sku_type: Optional[Union[str, "SkuType"]] = None, + value: Optional[List["NetworkFunctionSkuRoleDetails"]] = None, + **kwargs + ): + super(NetworkFunctionSkuDetails, self).__init__(**kwargs) + self.sku_type = sku_type + self.value = value + self.next_link = None + + +class NetworkFunctionSkuListResult(msrest.serialization.Model): + """A list of available network function skus. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The network function vendor sku overview properties. + :type value: list[~hybrid_network_management_client.models.SkuOverview] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SkuOverview]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SkuOverview"]] = None, + **kwargs + ): + super(NetworkFunctionSkuListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class NetworkFunctionSkuRoleDetails(msrest.serialization.Model): + """The network function user configuration. + + :param role_name: The name of the network function role. + :type role_name: str + :param user_data_template: The user data template for customers. + :type user_data_template: object + :param user_data_parameters: The user parameters for customers. + :type user_data_parameters: object + :param network_interfaces: The network interface configuration. + :type network_interfaces: list[~hybrid_network_management_client.models.NetworkInterface] + """ + + _attribute_map = { + 'role_name': {'key': 'roleName', 'type': 'str'}, + 'user_data_template': {'key': 'userDataTemplate', 'type': 'object'}, + 'user_data_parameters': {'key': 'userDataParameters', 'type': 'object'}, + 'network_interfaces': {'key': 'networkInterfaces', 'type': '[NetworkInterface]'}, + } + + def __init__( + self, + *, + role_name: Optional[str] = None, + user_data_template: Optional[object] = None, + user_data_parameters: Optional[object] = None, + network_interfaces: Optional[List["NetworkInterface"]] = None, + **kwargs + ): + super(NetworkFunctionSkuRoleDetails, self).__init__(**kwargs) + self.role_name = role_name + self.user_data_template = user_data_template + self.user_data_parameters = user_data_parameters + self.network_interfaces = network_interfaces + + +class NetworkFunctionTemplate(msrest.serialization.Model): + """The network function template. + + :param network_function_role_configurations: An array of network function role definitions. + :type network_function_role_configurations: + list[~hybrid_network_management_client.models.NetworkFunctionRoleConfiguration] + """ + + _attribute_map = { + 'network_function_role_configurations': {'key': 'networkFunctionRoleConfigurations', 'type': '[NetworkFunctionRoleConfiguration]'}, + } + + def __init__( + self, + *, + network_function_role_configurations: Optional[List["NetworkFunctionRoleConfiguration"]] = None, + **kwargs + ): + super(NetworkFunctionTemplate, self).__init__(**kwargs) + self.network_function_role_configurations = network_function_role_configurations + + +class NetworkFunctionUserConfiguration(msrest.serialization.Model): + """The network function user configuration. + + :param role_name: The name of the network function role. + :type role_name: str + :param user_data_parameters: The user data parameters from the customer. + :type user_data_parameters: object + :param network_interfaces: The network interface configuration. + :type network_interfaces: list[~hybrid_network_management_client.models.NetworkInterface] + :param os_profile: Specifies the operating system settings for the role instance. + :type os_profile: + ~hybrid_network_management_client.models.NetworkFunctionUserConfigurationOsProfile + """ + + _attribute_map = { + 'role_name': {'key': 'roleName', 'type': 'str'}, + 'user_data_parameters': {'key': 'userDataParameters', 'type': 'object'}, + 'network_interfaces': {'key': 'networkInterfaces', 'type': '[NetworkInterface]'}, + 'os_profile': {'key': 'osProfile', 'type': 'NetworkFunctionUserConfigurationOsProfile'}, + } + + def __init__( + self, + *, + role_name: Optional[str] = None, + user_data_parameters: Optional[object] = None, + network_interfaces: Optional[List["NetworkInterface"]] = None, + os_profile: Optional["NetworkFunctionUserConfigurationOsProfile"] = None, + **kwargs + ): + super(NetworkFunctionUserConfiguration, self).__init__(**kwargs) + self.role_name = role_name + self.user_data_parameters = user_data_parameters + self.network_interfaces = network_interfaces + self.os_profile = os_profile + + +class NetworkFunctionUserConfigurationOsProfile(msrest.serialization.Model): + """Specifies the operating system settings for the role instance. + + :param custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded + string is decoded to a binary array that is saved as a file on the virtual machine. The maximum + length of the binary array is 65535 bytes. :code:`
    `:code:`
    ` **Note: Do not pass any + secrets or passwords in customData property** :code:`
    `:code:`
    ` This property cannot be + updated after the VM is created. :code:`
    `:code:`
    ` customData is passed to the VM to be + saved as a file. For more information see `Custom Data on Azure VMs + `_ + :code:`
    `:code:`
    ` For using cloud-init for your Linux VM, see `Using cloud-init to + customize a Linux VM during creation `_. + :type custom_data: str + """ + + _attribute_map = { + 'custom_data': {'key': 'customData', 'type': 'str'}, + } + + def __init__( + self, + *, + custom_data: Optional[str] = None, + **kwargs + ): + super(NetworkFunctionUserConfigurationOsProfile, self).__init__(**kwargs) + self.custom_data = custom_data + + +class NetworkFunctionVendor(msrest.serialization.Model): + """The network function vendor. + + :param vendor_name: The network function vendor name. + :type vendor_name: str + :param sku_list: The network function sku list. + :type sku_list: list[~hybrid_network_management_client.models.SkuOverview] + """ + + _attribute_map = { + 'vendor_name': {'key': 'properties.vendorName', 'type': 'str'}, + 'sku_list': {'key': 'properties.skuList', 'type': '[SkuOverview]'}, + } + + def __init__( + self, + *, + vendor_name: Optional[str] = None, + sku_list: Optional[List["SkuOverview"]] = None, + **kwargs + ): + super(NetworkFunctionVendor, self).__init__(**kwargs) + self.vendor_name = vendor_name + self.sku_list = sku_list + + +class NetworkFunctionVendorConfiguration(msrest.serialization.Model): + """Network function vendor configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param role_name: The name of the vendor network function role. + :type role_name: str + :param os_profile: Specifies the operating system settings for the role instance. + :type os_profile: ~hybrid_network_management_client.models.OsProfile + :ivar user_data_parameters: The user parameters from the customer. + :vartype user_data_parameters: object + :param network_interfaces: The network interface configurations. + :type network_interfaces: list[~hybrid_network_management_client.models.NetworkInterface] + """ + + _validation = { + 'user_data_parameters': {'readonly': True}, + } + + _attribute_map = { + 'role_name': {'key': 'roleName', 'type': 'str'}, + 'os_profile': {'key': 'osProfile', 'type': 'OsProfile'}, + 'user_data_parameters': {'key': 'userDataParameters', 'type': 'object'}, + 'network_interfaces': {'key': 'networkInterfaces', 'type': '[NetworkInterface]'}, + } + + def __init__( + self, + *, + role_name: Optional[str] = None, + os_profile: Optional["OsProfile"] = None, + network_interfaces: Optional[List["NetworkInterface"]] = None, + **kwargs + ): + super(NetworkFunctionVendorConfiguration, self).__init__(**kwargs) + self.role_name = role_name + self.os_profile = os_profile + self.user_data_parameters = None + self.network_interfaces = network_interfaces + + +class NetworkFunctionVendorListResult(msrest.serialization.Model): + """The network function vendor list result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: A list of available network function vendors and skus. + :type value: list[~hybrid_network_management_client.models.NetworkFunctionVendor] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkFunctionVendor]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NetworkFunctionVendor"]] = None, + **kwargs + ): + super(NetworkFunctionVendorListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class NetworkInterface(msrest.serialization.Model): + """Network interface properties. + + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param mac_address: The MAC address of the network interface. + :type mac_address: str + :param ip_configurations: A list of IP configurations of the network interface. + :type ip_configurations: + list[~hybrid_network_management_client.models.NetworkInterfaceIPConfiguration] + :param vm_switch_type: The type of the VM switch. Possible values include: "Unknown", + "Management", "Wan", "Lan". + :type vm_switch_type: str or ~hybrid_network_management_client.models.VMSwitchType + """ + + _attribute_map = { + 'network_interface_name': {'key': 'networkInterfaceName', 'type': 'str'}, + 'mac_address': {'key': 'macAddress', 'type': 'str'}, + 'ip_configurations': {'key': 'ipConfigurations', 'type': '[NetworkInterfaceIPConfiguration]'}, + 'vm_switch_type': {'key': 'vmSwitchType', 'type': 'str'}, + } + + def __init__( + self, + *, + network_interface_name: Optional[str] = None, + mac_address: Optional[str] = None, + ip_configurations: Optional[List["NetworkInterfaceIPConfiguration"]] = None, + vm_switch_type: Optional[Union[str, "VMSwitchType"]] = None, + **kwargs + ): + super(NetworkInterface, self).__init__(**kwargs) + self.network_interface_name = network_interface_name + self.mac_address = mac_address + self.ip_configurations = ip_configurations + self.vm_switch_type = vm_switch_type + + +class NetworkInterfaceIPConfiguration(msrest.serialization.Model): + """Network interface IP configuration properties. + + :param ip_allocation_method: IP address allocation method. Possible values include: "Unknown", + "Static", "Dynamic". + :type ip_allocation_method: str or ~hybrid_network_management_client.models.IPAllocationMethod + :param ip_address: The value of the IP address. + :type ip_address: str + :param subnet: The value of the subnet. + :type subnet: str + :param gateway: The value of the gateway. + :type gateway: str + :param ip_version: IP address version. Possible values include: "Unknown", "IPv4". + :type ip_version: str or ~hybrid_network_management_client.models.IPVersion + :param dns_servers: The list of DNS servers IP addresses. + :type dns_servers: list[str] + """ + + _attribute_map = { + 'ip_allocation_method': {'key': 'ipAllocationMethod', 'type': 'str'}, + 'ip_address': {'key': 'ipAddress', 'type': 'str'}, + 'subnet': {'key': 'subnet', 'type': 'str'}, + 'gateway': {'key': 'gateway', 'type': 'str'}, + 'ip_version': {'key': 'ipVersion', 'type': 'str'}, + 'dns_servers': {'key': 'dnsServers', 'type': '[str]'}, + } + + def __init__( + self, + *, + ip_allocation_method: Optional[Union[str, "IPAllocationMethod"]] = None, + ip_address: Optional[str] = None, + subnet: Optional[str] = None, + gateway: Optional[str] = None, + ip_version: Optional[Union[str, "IPVersion"]] = None, + dns_servers: Optional[List[str]] = None, + **kwargs + ): + super(NetworkInterfaceIPConfiguration, self).__init__(**kwargs) + self.ip_allocation_method = ip_allocation_method + self.ip_address = ip_address + self.subnet = subnet + self.gateway = gateway + self.ip_version = ip_version + self.dns_servers = dns_servers + + +class Operation(msrest.serialization.Model): + """Object that describes a single Microsoft.HybridNetwork operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The object that represents the operation. + :vartype display: ~hybrid_network_management_client.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + 'display': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = None + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.HybridNetwork. + :type provider: str + :param resource: Resource on which the operation is performed: Registration definition, + registration assignment, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + :param description: Description of the operation. + :type description: str + """ + + _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, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationList(msrest.serialization.Model): + """A list of the operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of Microsoft.HybridNetwork operations. + :vartype value: list[~hybrid_network_management_client.models.Operation] + :ivar next_link: The URL to get the next set of results. + :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(OperationList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class OsDisk(msrest.serialization.Model): + """Specifies information about the operating system disk used by the virtual machine. :code:`
    `:code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines `_. + + :param os_type: The OS type. Possible values include: "Unknown", "Windows", "Linux". + :type os_type: str or ~hybrid_network_management_client.models.OperatingSystemTypes + :param name: The VHD name. + :type name: str + :param vhd: The virtual hard disk. + :type vhd: ~hybrid_network_management_client.models.VirtualHardDisk + :param disk_size_gb: Specifies the size of os disk in gigabytes. This is the fully expanded + disk size needed of the VHD image on the ASE. This disk size should be greater than the size of + the VHD provided in vhdUri. + :type disk_size_gb: int + """ + + _attribute_map = { + 'os_type': {'key': 'osType', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'vhd': {'key': 'vhd', 'type': 'VirtualHardDisk'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + } + + def __init__( + self, + *, + os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, + name: Optional[str] = None, + vhd: Optional["VirtualHardDisk"] = None, + disk_size_gb: Optional[int] = None, + **kwargs + ): + super(OsDisk, self).__init__(**kwargs) + self.os_type = os_type + self.name = name + self.vhd = vhd + self.disk_size_gb = disk_size_gb + + +class OsProfile(msrest.serialization.Model): + """Specifies the operating system settings for the role instance. + + :param admin_username: Specifies the name of the administrator account. + :code:`
    `:code:`
    ` **Windows-only restriction:** Cannot end in "." + :code:`
    `:code:`
    ` **Disallowed values:** "administrator", "admin", "user", "user1", + "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", + "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", + "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". + :code:`
    `:code:`
    ` **Minimum-length (Linux):** 1 character :code:`
    `:code:`
    ` + **Max-length (Linux):** 64 characters :code:`
    `:code:`
    ` **Max-length (Windows):** 20 + characters :code:`
    `:code:`
    `:code:`
  • ` For root access to the Linux VM, see `Using + root privileges on Linux virtual machines in Azure `_\ :code:`
    `:code:`
  • ` For a list of built-in system users on + Linux that should not be used in this field, see `Selecting User Names for Linux on Azure + `_. + :type admin_username: str + :param linux_configuration: Specifies the Linux operating system settings on the virtual + machine. :code:`
    `:code:`
    `For a list of supported Linux distributions, see `Linux on + Azure-Endorsed Distributions `_ + :code:`
    `:code:`
    ` For running non-endorsed distributions, see `Information for Non- + Endorsed Distributions `_. + :type linux_configuration: ~hybrid_network_management_client.models.LinuxConfiguration + :param custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded + string is decoded to a binary array that is saved as a file on the virtual machine. The maximum + length of the binary array is 65535 bytes. :code:`
    `:code:`
    ` **Note: Do not pass any + secrets or passwords in customData property** :code:`
    `:code:`
    ` This property cannot be + updated after the VM is created. :code:`
    `:code:`
    ` customData is passed to the VM to be + saved as a file. For more information see `Custom Data on Azure VMs + `_ + :code:`
    `:code:`
    ` For using cloud-init for your Linux VM, see `Using cloud-init to + customize a Linux VM during creation `_. + :type custom_data: str + :param custom_data_required: Indicates if custom data is required to deploy this role. + :type custom_data_required: bool + """ + + _attribute_map = { + 'admin_username': {'key': 'adminUsername', 'type': 'str'}, + 'linux_configuration': {'key': 'linuxConfiguration', 'type': 'LinuxConfiguration'}, + 'custom_data': {'key': 'customData', 'type': 'str'}, + 'custom_data_required': {'key': 'customDataRequired', 'type': 'bool'}, + } + + def __init__( + self, + *, + admin_username: Optional[str] = None, + linux_configuration: Optional["LinuxConfiguration"] = None, + custom_data: Optional[str] = None, + custom_data_required: Optional[bool] = True, + **kwargs + ): + super(OsProfile, self).__init__(**kwargs) + self.admin_username = admin_username + self.linux_configuration = linux_configuration + self.custom_data = custom_data + self.custom_data_required = custom_data_required + + +class PreviewSubscription(msrest.serialization.Model): + """Customer subscription which can use a sku. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The preview subscription ID. + :vartype name: str + :ivar id: The ARM ID of the resource. + :vartype id: str + :ivar type: The type of the resource. + :vartype type: str + """ + + _validation = { + 'name': {'readonly': True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PreviewSubscription, self).__init__(**kwargs) + self.name = None + self.id = None + self.type = None + + +class PreviewSubscriptionsList(msrest.serialization.Model): + """A list of customer subscriptions which can use a sku. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: A list of preview subscriptions. + :type value: list[~hybrid_network_management_client.models.PreviewSubscription] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PreviewSubscription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PreviewSubscription"]] = None, + **kwargs + ): + super(PreviewSubscriptionsList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + + +class RoleInstance(msrest.serialization.Model): + """The role instance sub resource. + + :param name: The role instance name. + :type name: str + :param id: The ARM ID of the resource. + :type id: str + :param type: The type of the resource. + :type type: str + :param operational_state: The operational state of the role instance. Possible values include: + "Unknown", "Stopped", "Running", "Stopping", "Starting". + :type operational_state: str or ~hybrid_network_management_client.models.OperationalState + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'operational_state': {'key': 'properties.operationalState', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + id: Optional[str] = None, + type: Optional[str] = None, + operational_state: Optional[Union[str, "OperationalState"]] = None, + **kwargs + ): + super(RoleInstance, self).__init__(**kwargs) + self.name = name + self.id = id + self.type = type + self.operational_state = operational_state + + +class SkuOverview(msrest.serialization.Model): + """The network function sku overview. + + :param sku_name: The vendor sku name. + :type sku_name: str + :param sku_type: The vendor sku type. Possible values include: "Unknown", "EvolvedPacketCore", + "SDWAN", "Firewall". + :type sku_type: str or ~hybrid_network_management_client.models.SkuType + """ + + _attribute_map = { + 'sku_name': {'key': 'skuName', 'type': 'str'}, + 'sku_type': {'key': 'skuType', 'type': 'str'}, + } + + def __init__( + self, + *, + sku_name: Optional[str] = None, + sku_type: Optional[Union[str, "SkuType"]] = None, + **kwargs + ): + super(SkuOverview, self).__init__(**kwargs) + self.sku_name = sku_name + self.sku_type = sku_type + + +class SshConfiguration(msrest.serialization.Model): + """SSH configuration for Linux based VMs running on Azure. + + :param public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :type public_keys: list[~hybrid_network_management_client.models.SshPublicKey] + """ + + _attribute_map = { + 'public_keys': {'key': 'publicKeys', 'type': '[SshPublicKey]'}, + } + + def __init__( + self, + *, + public_keys: Optional[List["SshPublicKey"]] = None, + **kwargs + ): + super(SshConfiguration, self).__init__(**kwargs) + self.public_keys = public_keys + + +class SshPublicKey(msrest.serialization.Model): + """Contains information about SSH certificate public key and the path on the Linux VM where the public key is placed. + + :param path: Specifies the full path on the created VM where ssh public key is stored. If the + file already exists, the specified key is appended to the file. Example: + /home/user/.ssh/authorized_keys. + :type path: str + :param key_data: SSH public key certificate used to authenticate with the VM through ssh. The + key needs to be at least 2048-bit and in ssh-rsa format. :code:`
    `:code:`
    ` For creating + ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure + `_. + :type key_data: str + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'key_data': {'key': 'keyData', 'type': 'str'}, + } + + def __init__( + self, + *, + path: Optional[str] = None, + key_data: Optional[str] = None, + **kwargs + ): + super(SshPublicKey, self).__init__(**kwargs) + self.path = path + self.key_data = key_data + + +class StorageProfile(msrest.serialization.Model): + """Specifies the storage settings for the virtual machine disks. + + :param image_reference: The image reference properties. + :type image_reference: ~hybrid_network_management_client.models.ImageReference + :param os_disk: Specifies information about the operating system disk used by the virtual + machine. + :type os_disk: ~hybrid_network_management_client.models.OsDisk + :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + machine. + :type data_disks: list[~hybrid_network_management_client.models.DataDisk] + """ + + _attribute_map = { + 'image_reference': {'key': 'imageReference', 'type': 'ImageReference'}, + 'os_disk': {'key': 'osDisk', 'type': 'OsDisk'}, + 'data_disks': {'key': 'dataDisks', 'type': '[DataDisk]'}, + } + + def __init__( + self, + *, + image_reference: Optional["ImageReference"] = None, + os_disk: Optional["OsDisk"] = None, + data_disks: Optional[List["DataDisk"]] = None, + **kwargs + ): + super(StorageProfile, self).__init__(**kwargs) + self.image_reference = image_reference + self.os_disk = os_disk + self.data_disks = data_disks + + +class SubResource(msrest.serialization.Model): + """Reference to another sub resource. + + :param id: Resource ID. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + super(SubResource, self).__init__(**kwargs) + self.id = id + + +class TagsObject(msrest.serialization.Model): + """Tags object for patch operations. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TagsObject, self).__init__(**kwargs) + self.tags = tags + + +class Vendor(ProxyResource): + """Vendor 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 provisioning_state: The provisioning state of the vendor resource. Possible values + include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", "Deleted". + :vartype provisioning_state: str or ~hybrid_network_management_client.models.ProvisioningState + :ivar skus: A list of IDs of the vendor skus offered by the vendor. + :vartype skus: list[~hybrid_network_management_client.models.SubResource] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'skus': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'skus': {'key': 'properties.skus', 'type': '[SubResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(Vendor, self).__init__(**kwargs) + self.provisioning_state = None + self.skus = None + + +class VendorListResult(msrest.serialization.Model): + """Response for vendors API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: A list of vendors. + :type value: list[~hybrid_network_management_client.models.Vendor] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Vendor]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Vendor"]] = None, + **kwargs + ): + super(VendorListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class VendorNetworkFunction(ProxyResource): + """Vendor network function sub 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 provisioning_state: The provisioning state of the vendor network function sub resource. + Possible values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted". + :vartype provisioning_state: str or ~hybrid_network_management_client.models.ProvisioningState + :param vendor_provisioning_state: The vendor controlled provisioning state of the vendor + network function. Possible values include: "Unknown", "NotProvisioned", "Provisioning", + "Provisioned", "Deprovisioned", "UserDataValidationFailed". + :type vendor_provisioning_state: str or + ~hybrid_network_management_client.models.VendorProvisioningState + :ivar sku_name: The name of the sku. + :vartype sku_name: str + :ivar sku_type: The sku type. Possible values include: "Unknown", "EvolvedPacketCore", "SDWAN", + "Firewall". + :vartype sku_type: str or ~hybrid_network_management_client.models.SkuType + :param network_function_vendor_configurations: An array of network function vendor + configurations. + :type network_function_vendor_configurations: + list[~hybrid_network_management_client.models.NetworkFunctionVendorConfiguration] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'sku_name': {'readonly': True}, + 'sku_type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'vendor_provisioning_state': {'key': 'properties.vendorProvisioningState', 'type': 'str'}, + 'sku_name': {'key': 'properties.skuName', 'type': 'str'}, + 'sku_type': {'key': 'properties.skuType', 'type': 'str'}, + 'network_function_vendor_configurations': {'key': 'properties.networkFunctionVendorConfigurations', 'type': '[NetworkFunctionVendorConfiguration]'}, + } + + def __init__( + self, + *, + vendor_provisioning_state: Optional[Union[str, "VendorProvisioningState"]] = None, + network_function_vendor_configurations: Optional[List["NetworkFunctionVendorConfiguration"]] = None, + **kwargs + ): + super(VendorNetworkFunction, self).__init__(**kwargs) + self.provisioning_state = None + self.vendor_provisioning_state = vendor_provisioning_state + self.sku_name = None + self.sku_type = None + self.network_function_vendor_configurations = network_function_vendor_configurations + + +class VendorNetworkFunctionListResult(msrest.serialization.Model): + """Response for vendors API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: A list of vendor network functions. + :type value: list[~hybrid_network_management_client.models.VendorNetworkFunction] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VendorNetworkFunction]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["VendorNetworkFunction"]] = None, + **kwargs + ): + super(VendorNetworkFunctionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class VendorSku(ProxyResource): + """Sku sub 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 provisioning_state: The provisioning state of the vendor sku sub resource. Possible + values include: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", + "Deleted". + :vartype provisioning_state: str or ~hybrid_network_management_client.models.ProvisioningState + :param sku_type: The sku type. Possible values include: "Unknown", "EvolvedPacketCore", + "SDWAN", "Firewall". + :type sku_type: str or ~hybrid_network_management_client.models.SkuType + :param deployment_mode: The sku deployment mode. Possible values include: "Unknown", "Azure", + "PrivateEdgeZone". + :type deployment_mode: str or ~hybrid_network_management_client.models.SkuDeploymentMode + :param preview: Indicates if the vendor sku is in preview mode. + :type preview: bool + :param managed_application_parameters: The parameters for the managed application to be + supplied by the vendor. + :type managed_application_parameters: object + :param managed_application_template: The template for the managed application deployment. + :type managed_application_template: object + :param network_function_template: The template definition of the network function. + :type network_function_template: + ~hybrid_network_management_client.models.NetworkFunctionTemplate + """ + + _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'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'sku_type': {'key': 'properties.skuType', 'type': 'str'}, + 'deployment_mode': {'key': 'properties.deploymentMode', 'type': 'str'}, + 'preview': {'key': 'properties.preview', 'type': 'bool'}, + 'managed_application_parameters': {'key': 'properties.managedApplicationParameters', 'type': 'object'}, + 'managed_application_template': {'key': 'properties.managedApplicationTemplate', 'type': 'object'}, + 'network_function_template': {'key': 'properties.networkFunctionTemplate', 'type': 'NetworkFunctionTemplate'}, + } + + def __init__( + self, + *, + sku_type: Optional[Union[str, "SkuType"]] = None, + deployment_mode: Optional[Union[str, "SkuDeploymentMode"]] = None, + preview: Optional[bool] = None, + managed_application_parameters: Optional[object] = None, + managed_application_template: Optional[object] = None, + network_function_template: Optional["NetworkFunctionTemplate"] = None, + **kwargs + ): + super(VendorSku, self).__init__(**kwargs) + self.provisioning_state = None + self.sku_type = sku_type + self.deployment_mode = deployment_mode + self.preview = preview + self.managed_application_parameters = managed_application_parameters + self.managed_application_template = managed_application_template + self.network_function_template = network_function_template + + +class VendorSkuListResult(msrest.serialization.Model): + """Response for list vendor sku API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: A list of vendor skus offered by the vendor. + :type value: list[~hybrid_network_management_client.models.VendorSku] + :ivar next_link: The URI to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VendorSku]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["VendorSku"]] = None, + **kwargs + ): + super(VendorSkuListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class VirtualHardDisk(msrest.serialization.Model): + """Describes the uri of a disk. + + :param uri: Specifies the virtual hard disk's uri. + :type uri: str + """ + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + } + + def __init__( + self, + *, + uri: Optional[str] = None, + **kwargs + ): + super(VirtualHardDisk, self).__init__(**kwargs) + self.uri = uri diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/__init__.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/__init__.py new file mode 100644 index 000000000000..ff21fc7723ce --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/__init__.py @@ -0,0 +1,31 @@ +# 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 ._network_functions_operations import NetworkFunctionsOperations +from ._devices_operations import DevicesOperations +from ._operations import Operations +from ._vendors_operations import VendorsOperations +from ._vendor_skus_operations import VendorSkusOperations +from ._vendor_sku_preview_operations import VendorSkuPreviewOperations +from ._network_function_vendors_operations import NetworkFunctionVendorsOperations +from ._network_function_vendor_skus_operations import NetworkFunctionVendorSkusOperations +from ._vendor_network_functions_operations import VendorNetworkFunctionsOperations +from ._role_instances_operations import RoleInstancesOperations + +__all__ = [ + 'NetworkFunctionsOperations', + 'DevicesOperations', + 'Operations', + 'VendorsOperations', + 'VendorSkusOperations', + 'VendorSkuPreviewOperations', + 'NetworkFunctionVendorsOperations', + 'NetworkFunctionVendorSkusOperations', + 'VendorNetworkFunctionsOperations', + 'RoleInstancesOperations', +] diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_devices_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_devices_operations.py new file mode 100644 index 000000000000..41a94b9bc6e9 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_devices_operations.py @@ -0,0 +1,618 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DevicesOperations(object): + """DevicesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~hybrid_network_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _delete_initial( + self, + resource_group_name, # type: str + device_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deviceName': self._serialize.url("device_name", device_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + device_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param device_name: The name of the device resource. + :type device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + device_name=device_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deviceName': self._serialize.url("device_name", device_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + device_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Device" + """Gets information about the specified device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param device_name: The name of the device resource. + :type device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Device, or the result of cls(response) + :rtype: ~hybrid_network_management_client.models.Device + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Device"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deviceName': self._serialize.url("device_name", device_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Device', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + device_name, # type: str + parameters, # type: "_models.Device" + **kwargs # type: Any + ): + # type: (...) -> "_models.Device" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Device"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deviceName': self._serialize.url("device_name", device_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Device') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Device', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Device', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + device_name, # type: str + parameters, # type: "_models.Device" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Device"] + """Creates or updates a device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param device_name: Resource name for the device resource. + :type device_name: str + :param parameters: Parameters supplied to the create or update device operation. + :type parameters: ~hybrid_network_management_client.models.Device + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Device or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~hybrid_network_management_client.models.Device] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Device"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + device_name=device_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Device', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deviceName': self._serialize.url("device_name", device_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}'} # type: ignore + + def update_tags( + self, + resource_group_name, # type: str + device_name, # type: str + parameters, # type: "_models.TagsObject" + **kwargs # type: Any + ): + # type: (...) -> "_models.Device" + """Updates device tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param device_name: The name of the device resource. + :type device_name: str + :param parameters: Parameters supplied to the update device tags operation. + :type parameters: ~hybrid_network_management_client.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Device, or the result of cls(response) + :rtype: ~hybrid_network_management_client.models.Device + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Device"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update_tags.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deviceName': self._serialize.url("device_name", device_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'TagsObject') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Device', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeviceListResult"] + """Lists all the devices in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeviceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~hybrid_network_management_client.models.DeviceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeviceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeviceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/devices'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeviceListResult"] + """Lists all the device resource in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeviceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~hybrid_network_management_client.models.DeviceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeviceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeviceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices'} # type: ignore + + def list_registration_key( + self, + resource_group_name, # type: str + device_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeviceRegistrationKey" + """List the registration key for the device. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param device_name: The name of the device resource. + :type device_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeviceRegistrationKey, or the result of cls(response) + :rtype: ~hybrid_network_management_client.models.DeviceRegistrationKey + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeviceRegistrationKey"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_registration_key.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deviceName': self._serialize.url("device_name", device_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeviceRegistrationKey', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_registration_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/devices/{deviceName}/listRegistrationKey'} # type: ignore diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_function_vendor_skus_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_function_vendor_skus_operations.py new file mode 100644 index 000000000000..2213462fb8b2 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_function_vendor_skus_operations.py @@ -0,0 +1,194 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class NetworkFunctionVendorSkusOperations(object): + """NetworkFunctionVendorSkusOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~hybrid_network_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_vendor( + self, + vendor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkFunctionSkuListResult"] + """Lists all network function vendor sku details in a vendor. + + :param vendor_name: The name of the network function vendor. + :type vendor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionSkuListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~hybrid_network_management_client.models.NetworkFunctionSkuListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionSkuListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_vendor.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkFunctionSkuListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_vendor.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctionVendors/{vendorName}/vendorSkus'} # type: ignore + + def list_by_sku( + self, + vendor_name, # type: str + vendor_sku_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkFunctionSkuDetails"] + """Lists information about network function vendor sku details. + + :param vendor_name: The name of the network function vendor. + :type vendor_name: str + :param vendor_sku_name: The name of the network function sku. + :type vendor_sku_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionSkuDetails or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~hybrid_network_management_client.models.NetworkFunctionSkuDetails] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionSkuDetails"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_sku.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'vendorSkuName': self._serialize.url("vendor_sku_name", vendor_sku_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkFunctionSkuDetails', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_sku.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctionVendors/{vendorName}/vendorSkus/{vendorSkuName}'} # type: ignore diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_function_vendors_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_function_vendors_operations.py new file mode 100644 index 000000000000..afab3644f280 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_function_vendors_operations.py @@ -0,0 +1,114 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class NetworkFunctionVendorsOperations(object): + """NetworkFunctionVendorsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~hybrid_network_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkFunctionVendorListResult"] + """Lists all the available vendor and sku information. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionVendorListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~hybrid_network_management_client.models.NetworkFunctionVendorListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionVendorListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkFunctionVendorListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctionVendors'} # type: ignore diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_functions_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_functions_operations.py new file mode 100644 index 000000000000..311cc88e3464 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_network_functions_operations.py @@ -0,0 +1,559 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class NetworkFunctionsOperations(object): + """NetworkFunctionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~hybrid_network_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _delete_initial( + self, + resource_group_name, # type: str + network_function_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'networkFunctionName': self._serialize.url("network_function_name", network_function_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + network_function_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified network function resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_name: The name of the network function. + :type network_function_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'networkFunctionName': self._serialize.url("network_function_name", network_function_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + network_function_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkFunction" + """Gets information about the specified network function resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_name: The name of the network function resource. + :type network_function_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunction, or the result of cls(response) + :rtype: ~hybrid_network_management_client.models.NetworkFunction + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunction"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'networkFunctionName': self._serialize.url("network_function_name", network_function_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunction', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + network_function_name, # type: str + parameters, # type: "_models.NetworkFunction" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkFunction" + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunction"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'networkFunctionName': self._serialize.url("network_function_name", network_function_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkFunction') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('NetworkFunction', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NetworkFunction', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + network_function_name, # type: str + parameters, # type: "_models.NetworkFunction" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.NetworkFunction"] + """Creates or updates a network function resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_name: Resource name for the network function resource. + :type network_function_name: str + :param parameters: Parameters supplied in the body to the create or update network function + operation. + :type parameters: ~hybrid_network_management_client.models.NetworkFunction + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either NetworkFunction or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~hybrid_network_management_client.models.NetworkFunction] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunction"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_function_name=network_function_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('NetworkFunction', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'networkFunctionName': self._serialize.url("network_function_name", network_function_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}'} # type: ignore + + def update_tags( + self, + resource_group_name, # type: str + network_function_name, # type: str + parameters, # type: "_models.TagsObject" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkFunction" + """Updates the tags for the network function resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param network_function_name: Resource name for the network function resource. + :type network_function_name: str + :param parameters: Parameters supplied to the update network function tags operation. + :type parameters: ~hybrid_network_management_client.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkFunction, or the result of cls(response) + :rtype: ~hybrid_network_management_client.models.NetworkFunction + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunction"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update_tags.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'networkFunctionName': self._serialize.url("network_function_name", network_function_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'TagsObject') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkFunction', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkFunctionListResult"] + """Lists all the network functions in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~hybrid_network_management_client.models.NetworkFunctionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkFunctionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctions'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkFunctionListResult"] + """Lists all the network function resources in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~hybrid_network_management_client.models.NetworkFunctionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkFunctionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions'} # type: ignore diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_operations.py new file mode 100644 index 000000000000..4ffb943303d8 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_operations.py @@ -0,0 +1,110 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~hybrid_network_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationList"] + """Gets a list of the operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~hybrid_network_management_client.models.OperationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.HybridNetwork/operations'} # type: ignore diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_role_instances_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_role_instances_operations.py new file mode 100644 index 000000000000..6b0d5db7a410 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_role_instances_operations.py @@ -0,0 +1,576 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class RoleInstancesOperations(object): + """RoleInstancesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~hybrid_network_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _start_initial( + self, + location_name, # type: str + vendor_name, # type: str + service_key, # type: str + role_instance_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'serviceKey': self._serialize.url("service_key", service_key, 'str'), + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/start'} # type: ignore + + def begin_start( + self, + location_name, # type: str + vendor_name, # type: str + service_key, # type: str + role_instance_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Starts a role instance of a vendor network function. + + :param location_name: The Azure region where the network function resource was created by + customer. + :type location_name: str + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param service_key: The GUID for the vendor network function. + :type service_key: str + :param role_instance_name: The name of the role instance of the vendor network function. + :type role_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_initial( + location_name=location_name, + vendor_name=vendor_name, + service_key=service_key, + role_instance_name=role_instance_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'serviceKey': self._serialize.url("service_key", service_key, 'str'), + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/start'} # type: ignore + + def _stop_initial( + self, + location_name, # type: str + vendor_name, # type: str + service_key, # type: str + role_instance_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'serviceKey': self._serialize.url("service_key", service_key, 'str'), + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/stop'} # type: ignore + + def begin_stop( + self, + location_name, # type: str + vendor_name, # type: str + service_key, # type: str + role_instance_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Powers off (stop) a role instance of a vendor network function. + + :param location_name: The Azure region where the network function resource was created by + customer. + :type location_name: str + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param service_key: The GUID for the vendor network function. + :type service_key: str + :param role_instance_name: The name of the role instance of the vendor network function. + :type role_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._stop_initial( + location_name=location_name, + vendor_name=vendor_name, + service_key=service_key, + role_instance_name=role_instance_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'serviceKey': self._serialize.url("service_key", service_key, 'str'), + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/stop'} # type: ignore + + def _restart_initial( + self, + location_name, # type: str + vendor_name, # type: str + service_key, # type: str + role_instance_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'serviceKey': self._serialize.url("service_key", service_key, 'str'), + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/restart'} # type: ignore + + def begin_restart( + self, + location_name, # type: str + vendor_name, # type: str + service_key, # type: str + role_instance_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Restarts a role instance of a vendor network function. + + :param location_name: The Azure region where the network function resource was created by + customer. + :type location_name: str + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param service_key: The GUID for the vendor network function. + :type service_key: str + :param role_instance_name: The name of the role instance of the vendor network function. + :type role_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restart_initial( + location_name=location_name, + vendor_name=vendor_name, + service_key=service_key, + role_instance_name=role_instance_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'serviceKey': self._serialize.url("service_key", service_key, 'str'), + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}/restart'} # type: ignore + + def get( + self, + location_name, # type: str + vendor_name, # type: str + service_key, # type: str + role_instance_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RoleInstance" + """Gets the information of role instance of vendor network function. + + :param location_name: The Azure region where the network function resource was created by + customer. + :type location_name: str + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param service_key: The GUID for the vendor network function. + :type service_key: str + :param role_instance_name: The name of the role instance of the vendor network function. + :type role_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RoleInstance, or the result of cls(response) + :rtype: ~hybrid_network_management_client.models.RoleInstance + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'serviceKey': self._serialize.url("service_key", service_key, 'str'), + 'roleInstanceName': self._serialize.url("role_instance_name", role_instance_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RoleInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances/{roleInstanceName}'} # type: ignore + + def list( + self, + location_name, # type: str + vendor_name, # type: str + service_key, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkFunctionRoleInstanceListResult"] + """Lists the information of role instances of vendor network function. + + :param location_name: The Azure region where the network function resource was created by + customer. + :type location_name: str + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param service_key: The GUID for the vendor network function. + :type service_key: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkFunctionRoleInstanceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~hybrid_network_management_client.models.NetworkFunctionRoleInstanceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkFunctionRoleInstanceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'serviceKey': self._serialize.url("service_key", service_key, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkFunctionRoleInstanceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}/roleInstances'} # type: ignore diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendor_network_functions_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendor_network_functions_operations.py new file mode 100644 index 000000000000..d62bc8bbf8cf --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendor_network_functions_operations.py @@ -0,0 +1,337 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class VendorNetworkFunctionsOperations(object): + """VendorNetworkFunctionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~hybrid_network_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + location_name, # type: str + vendor_name, # type: str + service_key, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.VendorNetworkFunction" + """Gets information about the specified vendor network function. + + :param location_name: The Azure region where the network function resource was created by the + customer. + :type location_name: str + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param service_key: The GUID for the vendor network function. + :type service_key: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VendorNetworkFunction, or the result of cls(response) + :rtype: ~hybrid_network_management_client.models.VendorNetworkFunction + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VendorNetworkFunction"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'serviceKey': self._serialize.url("service_key", service_key, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VendorNetworkFunction', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}'} # type: ignore + + def _create_or_update_initial( + self, + location_name, # type: str + vendor_name, # type: str + service_key, # type: str + parameters, # type: "_models.VendorNetworkFunction" + **kwargs # type: Any + ): + # type: (...) -> "_models.VendorNetworkFunction" + cls = kwargs.pop('cls', None) # type: ClsType["_models.VendorNetworkFunction"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'serviceKey': self._serialize.url("service_key", service_key, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VendorNetworkFunction') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VendorNetworkFunction', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VendorNetworkFunction', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}'} # type: ignore + + def begin_create_or_update( + self, + location_name, # type: str + vendor_name, # type: str + service_key, # type: str + parameters, # type: "_models.VendorNetworkFunction" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VendorNetworkFunction"] + """Creates or updates a vendor network function. + + :param location_name: The Azure region where the network function resource was created by the + customer. + :type location_name: str + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param service_key: The GUID for the vendor network function. + :type service_key: str + :param parameters: Parameters supplied to the create or update vendor network function + operation. + :type parameters: ~hybrid_network_management_client.models.VendorNetworkFunction + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either VendorNetworkFunction or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~hybrid_network_management_client.models.VendorNetworkFunction] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VendorNetworkFunction"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + location_name=location_name, + vendor_name=vendor_name, + service_key=service_key, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VendorNetworkFunction', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'serviceKey': self._serialize.url("service_key", service_key, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions/{serviceKey}'} # type: ignore + + def list( + self, + location_name, # type: str + vendor_name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VendorNetworkFunctionListResult"] + """Lists all the vendor network function sub resources in an Azure region, filtered by skuType, + skuName, vendorProvisioningState. + + :param location_name: The Azure region where the network function resource was created by the + customer. + :type location_name: str + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param filter: The filter to apply on the operation. The properties you can use for eq (equals) + are: skuType, skuName and vendorProvisioningState. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VendorNetworkFunctionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~hybrid_network_management_client.models.VendorNetworkFunctionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VendorNetworkFunctionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('VendorNetworkFunctionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/locations/{locationName}/vendors/{vendorName}/networkFunctions'} # type: ignore diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendor_sku_preview_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendor_sku_preview_operations.py new file mode 100644 index 000000000000..0d39f64e0ed0 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendor_sku_preview_operations.py @@ -0,0 +1,445 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class VendorSkuPreviewOperations(object): + """VendorSkuPreviewOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~hybrid_network_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + vendor_name, # type: str + sku_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PreviewSubscriptionsList"] + """Lists all the preview information of a vendor sku. + + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param sku_name: The name of the sku. + :type sku_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PreviewSubscriptionsList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~hybrid_network_management_client.models.PreviewSubscriptionsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PreviewSubscriptionsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'skuName': self._serialize.url("sku_name", sku_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PreviewSubscriptionsList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions'} # type: ignore + + def _create_or_update_initial( + self, + vendor_name, # type: str + sku_name, # type: str + preview_subscription, # type: str + parameters, # type: "_models.PreviewSubscription" + **kwargs # type: Any + ): + # type: (...) -> "_models.PreviewSubscription" + cls = kwargs.pop('cls', None) # type: ClsType["_models.PreviewSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'skuName': self._serialize.url("sku_name", sku_name, 'str'), + 'previewSubscription': self._serialize.url("preview_subscription", preview_subscription, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PreviewSubscription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PreviewSubscription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PreviewSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}'} # type: ignore + + def begin_create_or_update( + self, + vendor_name, # type: str + sku_name, # type: str + preview_subscription, # type: str + parameters, # type: "_models.PreviewSubscription" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.PreviewSubscription"] + """Creates or updates preview information of a vendor sku. + + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param sku_name: The name of the vendor sku. + :type sku_name: str + :param preview_subscription: Preview subscription ID. + :type preview_subscription: str + :param parameters: Parameters supplied to the create or update vendor preview subscription + operation. + :type parameters: ~hybrid_network_management_client.models.PreviewSubscription + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either PreviewSubscription or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~hybrid_network_management_client.models.PreviewSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PreviewSubscription"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + vendor_name=vendor_name, + sku_name=sku_name, + preview_subscription=preview_subscription, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PreviewSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'skuName': self._serialize.url("sku_name", sku_name, 'str'), + 'previewSubscription': self._serialize.url("preview_subscription", preview_subscription, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}'} # type: ignore + + def get( + self, + vendor_name, # type: str + sku_name, # type: str + preview_subscription, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PreviewSubscription" + """Gets the preview information of a vendor sku. + + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param sku_name: The name of the vendor sku. + :type sku_name: str + :param preview_subscription: Preview subscription ID. + :type preview_subscription: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PreviewSubscription, or the result of cls(response) + :rtype: ~hybrid_network_management_client.models.PreviewSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PreviewSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'skuName': self._serialize.url("sku_name", sku_name, 'str'), + 'previewSubscription': self._serialize.url("preview_subscription", preview_subscription, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PreviewSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}'} # type: ignore + + def _delete_initial( + self, + vendor_name, # type: str + sku_name, # type: str + preview_subscription, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'skuName': self._serialize.url("sku_name", sku_name, 'str'), + 'previewSubscription': self._serialize.url("preview_subscription", preview_subscription, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}'} # type: ignore + + def begin_delete( + self, + vendor_name, # type: str + sku_name, # type: str + preview_subscription, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the preview information of a vendor sku. + + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param sku_name: The name of the vendor sku. + :type sku_name: str + :param preview_subscription: Preview subscription ID. + :type preview_subscription: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + vendor_name=vendor_name, + sku_name=sku_name, + preview_subscription=preview_subscription, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'skuName': self._serialize.url("sku_name", sku_name, 'str'), + 'previewSubscription': self._serialize.url("preview_subscription", preview_subscription, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}/previewSubscriptions/{previewSubscription}'} # type: ignore diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendor_skus_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendor_skus_operations.py new file mode 100644 index 000000000000..bc5b00718d0c --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendor_skus_operations.py @@ -0,0 +1,422 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class VendorSkusOperations(object): + """VendorSkusOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~hybrid_network_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _delete_initial( + self, + vendor_name, # type: str + sku_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'skuName': self._serialize.url("sku_name", sku_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}'} # type: ignore + + def begin_delete( + self, + vendor_name, # type: str + sku_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified sku. + + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param sku_name: The name of the sku. + :type sku_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + vendor_name=vendor_name, + sku_name=sku_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'skuName': self._serialize.url("sku_name", sku_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}'} # type: ignore + + def get( + self, + vendor_name, # type: str + sku_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.VendorSku" + """Gets information about the specified sku. + + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param sku_name: The name of the sku. + :type sku_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VendorSku, or the result of cls(response) + :rtype: ~hybrid_network_management_client.models.VendorSku + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VendorSku"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'skuName': self._serialize.url("sku_name", sku_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VendorSku', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}'} # type: ignore + + def _create_or_update_initial( + self, + vendor_name, # type: str + sku_name, # type: str + parameters, # type: "_models.VendorSku" + **kwargs # type: Any + ): + # type: (...) -> "_models.VendorSku" + cls = kwargs.pop('cls', None) # type: ClsType["_models.VendorSku"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'skuName': self._serialize.url("sku_name", sku_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VendorSku') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VendorSku', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VendorSku', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}'} # type: ignore + + def begin_create_or_update( + self, + vendor_name, # type: str + sku_name, # type: str + parameters, # type: "_models.VendorSku" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VendorSku"] + """Creates or updates a sku. + + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param sku_name: The name of the sku. + :type sku_name: str + :param parameters: Parameters supplied to the create or update sku operation. + :type parameters: ~hybrid_network_management_client.models.VendorSku + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either VendorSku or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~hybrid_network_management_client.models.VendorSku] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VendorSku"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + vendor_name=vendor_name, + sku_name=sku_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VendorSku', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'skuName': self._serialize.url("sku_name", sku_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus/{skuName}'} # type: ignore + + def list( + self, + vendor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VendorSkuListResult"] + """Lists all the skus of a vendor. + + :param vendor_name: The name of the vendor. + :type vendor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VendorSkuListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~hybrid_network_management_client.models.VendorSkuListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VendorSkuListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('VendorSkuListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}/vendorSkus'} # type: ignore diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendors_operations.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendors_operations.py new file mode 100644 index 000000000000..2d5ce20b8ac3 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/operations/_vendors_operations.py @@ -0,0 +1,403 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class VendorsOperations(object): + """VendorsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~hybrid_network_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _delete_initial( + self, + vendor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}'} # type: ignore + + def begin_delete( + self, + vendor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified vendor. + + :param vendor_name: The name of the vendor. + :type vendor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + vendor_name=vendor_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}'} # type: ignore + + def get( + self, + vendor_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Vendor" + """Gets information about the specified vendor. + + :param vendor_name: The name of the vendor. + :type vendor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vendor, or the result of cls(response) + :rtype: ~hybrid_network_management_client.models.Vendor + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vendor"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Vendor', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}'} # type: ignore + + def _create_or_update_initial( + self, + vendor_name, # type: str + parameters=None, # type: Optional["_models.Vendor"] + **kwargs # type: Any + ): + # type: (...) -> "_models.Vendor" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vendor"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'Vendor') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Vendor', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Vendor', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}'} # type: ignore + + def begin_create_or_update( + self, + vendor_name, # type: str + parameters=None, # type: Optional["_models.Vendor"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Vendor"] + """Creates or updates a vendor. + + :param vendor_name: The name of the vendor. + :type vendor_name: str + :param parameters: Parameters supplied to the create vendor operation. + :type parameters: ~hybrid_network_management_client.models.Vendor + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Vendor or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~hybrid_network_management_client.models.Vendor] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vendor"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + vendor_name=vendor_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Vendor', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'vendorName': self._serialize.url("vendor_name", vendor_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors/{vendorName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VendorListResult"] + """Lists all the vendors in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VendorListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~hybrid_network_management_client.models.VendorListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VendorListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('VendorListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/vendors'} # type: ignore diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/py.typed b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/azure/mgmt/hybridnetwork/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/sdk_packaging.toml b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/sdk_packaging.toml new file mode 100644 index 000000000000..36c4d1103aaa --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/sdk_packaging.toml @@ -0,0 +1,8 @@ +[packaging] +package_name = "azure-mgmt-hybridnetwork" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "Hybridnetwork Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = true diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/setup.cfg b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/setup.py b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/setup.py new file mode 100644 index 000000000000..2c050039c2d5 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/setup.py @@ -0,0 +1,91 @@ +#!/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-hybridnetwork" +PACKAGE_PPRINT_NAME = "Hybridnetwork Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# 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', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + 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-mgmt-core>=1.2.0,<2.0.0', + 'azure-common~=1.1', + ], + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } +) diff --git a/sdk/hybridnetwork/ci.yml b/sdk/hybridnetwork/ci.yml new file mode 100644 index 000000000000..361b13b4429e --- /dev/null +++ b/sdk/hybridnetwork/ci.yml @@ -0,0 +1,35 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - master + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/hybridnetwork/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/hybridnetwork/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: hybridnetwork + Artifacts: + - name: azure-mgmt-hybridnetwork + safeName: azuremgmthybridnetwork diff --git a/shared_requirements.txt b/shared_requirements.txt index 1d205e9c3f63..a6567ddffe81 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -215,6 +215,7 @@ opentelemetry-sdk<2.0.0,>=1.0.0 #override azure-mgmt-storagesync msrest>=0.6.21 #override azure-mgmt-resourcegraph msrest>=0.6.21 #override azure-mgmt-containerservice msrest>=0.6.21 +#override azure-mgmt-hybridnetwork msrest>=0.6.21 #override azure-mgmt-datashare msrest>=0.6.21 #override azure-mgmt-storage msrest>=0.6.21 #override azure-mgmt-hanaonazure msrest>=0.6.21