From b682f616902ec1ab969de3b47f41ccfa5055adad Mon Sep 17 00:00:00 2001 From: msyyc <70930885+msyyc@users.noreply.github.com> Date: Tue, 20 Apr 2021 13:16:35 +0800 Subject: [PATCH] [AutoRelease] t2-webpubsub-2021-04-16-57261 (#18092) * CodeGen from PR 13953 in Azure/azure-rest-api-specs webpubsub readme t1 del (#13953) * version,CHANGELOG * webpubsub changelog config * changelog version change Co-authored-by: SDKAuto Co-authored-by: PythonSdkPipelines Co-authored-by: Zed <601306339@qq.com> Co-authored-by: Zed Lei <59104634+RAY-316@users.noreply.github.com> --- .../azure-mgmt-webpubsub/CHANGELOG.md | 5 + .../azure-mgmt-webpubsub/MANIFEST.in | 6 + sdk/webpubsub/azure-mgmt-webpubsub/README.md | 27 + sdk/webpubsub/azure-mgmt-webpubsub/_meta.json | 8 + .../azure-mgmt-webpubsub/azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../azure/mgmt/webpubsub/__init__.py | 19 + .../azure/mgmt/webpubsub/_configuration.py | 71 + .../azure/mgmt/webpubsub/_metadata.json | 108 + .../azure/mgmt/webpubsub/_version.py | 9 + .../_web_pub_sub_management_client.py | 114 ++ .../azure/mgmt/webpubsub/aio/__init__.py | 10 + .../mgmt/webpubsub/aio/_configuration.py | 67 + .../aio/_web_pub_sub_management_client.py | 107 + .../mgmt/webpubsub/aio/operations/__init__.py | 23 + .../webpubsub/aio/operations/_operations.py | 105 + .../aio/operations/_usages_operations.py | 113 ++ .../aio/operations/_web_pub_sub_operations.py | 972 +++++++++ ...private_endpoint_connections_operations.py | 373 ++++ ...b_sub_private_link_resources_operations.py | 118 ++ ...hared_private_link_resources_operations.py | 438 +++++ .../azure/mgmt/webpubsub/models/__init__.py | 176 ++ .../azure/mgmt/webpubsub/models/_models.py | 1590 +++++++++++++++ .../mgmt/webpubsub/models/_models_py3.py | 1752 +++++++++++++++++ .../_web_pub_sub_management_client_enums.py | 139 ++ .../mgmt/webpubsub/operations/__init__.py | 23 + .../mgmt/webpubsub/operations/_operations.py | 110 ++ .../operations/_usages_operations.py | 118 ++ .../operations/_web_pub_sub_operations.py | 991 ++++++++++ ...private_endpoint_connections_operations.py | 382 ++++ ...b_sub_private_link_resources_operations.py | 123 ++ ...hared_private_link_resources_operations.py | 448 +++++ .../azure/mgmt/webpubsub/py.typed | 1 + .../azure-mgmt-webpubsub/sdk_packaging.toml | 8 + sdk/webpubsub/azure-mgmt-webpubsub/setup.cfg | 2 + sdk/webpubsub/azure-mgmt-webpubsub/setup.py | 91 + sdk/webpubsub/ci.yml | 35 + shared_requirements.txt | 3 +- 38 files changed, 8686 insertions(+), 1 deletion(-) create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/CHANGELOG.md create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/MANIFEST.in create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/README.md create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/_meta.json create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/__init__.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/__init__.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/__init__.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_configuration.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_metadata.json create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_version.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_web_pub_sub_management_client.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/__init__.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_configuration.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_web_pub_sub_management_client.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/__init__.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_operations.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_usages_operations.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_operations.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_private_endpoint_connections_operations.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_private_link_resources_operations.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_shared_private_link_resources_operations.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/__init__.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_models.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_models_py3.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_web_pub_sub_management_client_enums.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/__init__.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_operations.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_usages_operations.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_operations.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_endpoint_connections_operations.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_link_resources_operations.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_shared_private_link_resources_operations.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/py.typed create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/sdk_packaging.toml create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/setup.cfg create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/setup.py create mode 100644 sdk/webpubsub/ci.yml diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/CHANGELOG.md b/sdk/webpubsub/azure-mgmt-webpubsub/CHANGELOG.md new file mode 100644 index 000000000000..a9d85c58a10d --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0b1 (2021-04-16) + +* Initial Release diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/MANIFEST.in b/sdk/webpubsub/azure-mgmt-webpubsub/MANIFEST.in new file mode 100644 index 000000000000..3a9b6517412b --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/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/webpubsub/azure-mgmt-webpubsub/README.md b/sdk/webpubsub/azure-mgmt-webpubsub/README.md new file mode 100644 index 000000000000..1094a61c6a07 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/README.md @@ -0,0 +1,27 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure Webpubsub 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 [Webpubsub 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-webpubsub%2FREADME.png) diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/_meta.json b/sdk/webpubsub/azure-mgmt-webpubsub/_meta.json new file mode 100644 index 000000000000..cedc06806454 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/_meta.json @@ -0,0 +1,8 @@ +{ + "autorest": "3.3.0", + "use": "@autorest/python@5.6.6", + "commit": "a4f67651dcaef459afabb647a05a45a5fbb72ffe", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/webpubsub/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.6 --version=3.3.0", + "readme": "specification/webpubsub/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/__init__.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/__init__.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/__init__.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/__init__.py new file mode 100644 index 000000000000..ebf0402927b3 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/__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 ._web_pub_sub_management_client import WebPubSubManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['WebPubSubManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_configuration.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_configuration.py new file mode 100644 index 000000000000..179c5575f107 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_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 WebPubSubManagementClientConfiguration(Configuration): + """Configuration for WebPubSubManagementClient. + + 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: Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :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(WebPubSubManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-04-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-webpubsub/{}'.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/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_metadata.json b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_metadata.json new file mode 100644 index 000000000000..ddf514dc80da --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_metadata.json @@ -0,0 +1,108 @@ +{ + "chosen_version": "2021-04-01-preview", + "total_api_version_list": ["2021-04-01-preview"], + "client": { + "name": "WebPubSubManagementClient", + "filename": "_web_pub_sub_management_client", + "description": "REST API for Azure WebPubSub Service.", + "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\": [\"WebPubSubManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "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\": [\"WebPubSubManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "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": "Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "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": "Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "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": { + "operations": "Operations", + "web_pub_sub": "WebPubSubOperations", + "usages": "UsagesOperations", + "web_pub_sub_private_endpoint_connections": "WebPubSubPrivateEndpointConnectionsOperations", + "web_pub_sub_private_link_resources": "WebPubSubPrivateLinkResourcesOperations", + "web_pub_sub_shared_private_link_resources": "WebPubSubSharedPrivateLinkResourcesOperations" + } +} \ No newline at end of file diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_version.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_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/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_web_pub_sub_management_client.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_web_pub_sub_management_client.py new file mode 100644 index 000000000000..894aa8967eff --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_web_pub_sub_management_client.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 + +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 azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import WebPubSubManagementClientConfiguration +from .operations import Operations +from .operations import WebPubSubOperations +from .operations import UsagesOperations +from .operations import WebPubSubPrivateEndpointConnectionsOperations +from .operations import WebPubSubPrivateLinkResourcesOperations +from .operations import WebPubSubSharedPrivateLinkResourcesOperations +from . import models + + +class WebPubSubManagementClient(object): + """REST API for Azure WebPubSub Service. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.webpubsub.operations.Operations + :ivar web_pub_sub: WebPubSubOperations operations + :vartype web_pub_sub: azure.mgmt.webpubsub.operations.WebPubSubOperations + :ivar usages: UsagesOperations operations + :vartype usages: azure.mgmt.webpubsub.operations.UsagesOperations + :ivar web_pub_sub_private_endpoint_connections: WebPubSubPrivateEndpointConnectionsOperations operations + :vartype web_pub_sub_private_endpoint_connections: azure.mgmt.webpubsub.operations.WebPubSubPrivateEndpointConnectionsOperations + :ivar web_pub_sub_private_link_resources: WebPubSubPrivateLinkResourcesOperations operations + :vartype web_pub_sub_private_link_resources: azure.mgmt.webpubsub.operations.WebPubSubPrivateLinkResourcesOperations + :ivar web_pub_sub_shared_private_link_resources: WebPubSubSharedPrivateLinkResourcesOperations operations + :vartype web_pub_sub_shared_private_link_resources: azure.mgmt.webpubsub.operations.WebPubSubSharedPrivateLinkResourcesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :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 = WebPubSubManagementClientConfiguration(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.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.web_pub_sub = WebPubSubOperations( + self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.web_pub_sub_private_endpoint_connections = WebPubSubPrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.web_pub_sub_private_link_resources = WebPubSubPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.web_pub_sub_shared_private_link_resources = WebPubSubSharedPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> WebPubSubManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/__init__.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/__init__.py new file mode 100644 index 000000000000..c18824563ccf --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/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 ._web_pub_sub_management_client import WebPubSubManagementClient +__all__ = ['WebPubSubManagementClient'] diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_configuration.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_configuration.py new file mode 100644 index 000000000000..1d8e95d4b445 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/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 WebPubSubManagementClientConfiguration(Configuration): + """Configuration for WebPubSubManagementClient. + + 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: Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :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(WebPubSubManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-04-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-webpubsub/{}'.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/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_web_pub_sub_management_client.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_web_pub_sub_management_client.py new file mode 100644 index 000000000000..0d118d849291 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_web_pub_sub_management_client.py @@ -0,0 +1,107 @@ +# 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.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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 WebPubSubManagementClientConfiguration +from .operations import Operations +from .operations import WebPubSubOperations +from .operations import UsagesOperations +from .operations import WebPubSubPrivateEndpointConnectionsOperations +from .operations import WebPubSubPrivateLinkResourcesOperations +from .operations import WebPubSubSharedPrivateLinkResourcesOperations +from .. import models + + +class WebPubSubManagementClient(object): + """REST API for Azure WebPubSub Service. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.webpubsub.aio.operations.Operations + :ivar web_pub_sub: WebPubSubOperations operations + :vartype web_pub_sub: azure.mgmt.webpubsub.aio.operations.WebPubSubOperations + :ivar usages: UsagesOperations operations + :vartype usages: azure.mgmt.webpubsub.aio.operations.UsagesOperations + :ivar web_pub_sub_private_endpoint_connections: WebPubSubPrivateEndpointConnectionsOperations operations + :vartype web_pub_sub_private_endpoint_connections: azure.mgmt.webpubsub.aio.operations.WebPubSubPrivateEndpointConnectionsOperations + :ivar web_pub_sub_private_link_resources: WebPubSubPrivateLinkResourcesOperations operations + :vartype web_pub_sub_private_link_resources: azure.mgmt.webpubsub.aio.operations.WebPubSubPrivateLinkResourcesOperations + :ivar web_pub_sub_shared_private_link_resources: WebPubSubSharedPrivateLinkResourcesOperations operations + :vartype web_pub_sub_shared_private_link_resources: azure.mgmt.webpubsub.aio.operations.WebPubSubSharedPrivateLinkResourcesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :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 = WebPubSubManagementClientConfiguration(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.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.web_pub_sub = WebPubSubOperations( + self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.web_pub_sub_private_endpoint_connections = WebPubSubPrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.web_pub_sub_private_link_resources = WebPubSubPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.web_pub_sub_shared_private_link_resources = WebPubSubSharedPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "WebPubSubManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/__init__.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/__init__.py new file mode 100644 index 000000000000..adcd49212f72 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._web_pub_sub_operations import WebPubSubOperations +from ._usages_operations import UsagesOperations +from ._web_pub_sub_private_endpoint_connections_operations import WebPubSubPrivateEndpointConnectionsOperations +from ._web_pub_sub_private_link_resources_operations import WebPubSubPrivateLinkResourcesOperations +from ._web_pub_sub_shared_private_link_resources_operations import WebPubSubSharedPrivateLinkResourcesOperations + +__all__ = [ + 'Operations', + 'WebPubSubOperations', + 'UsagesOperations', + 'WebPubSubPrivateEndpointConnectionsOperations', + 'WebPubSubPrivateLinkResourcesOperations', + 'WebPubSubSharedPrivateLinkResourcesOperations', +] diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_operations.py new file mode 100644 index 000000000000..f80f89b348cc --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/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: ~azure.mgmt.webpubsub.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"]: + """Lists all of the available REST API operations of the Microsoft.SignalRService provider. + + :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[~azure.mgmt.webpubsub.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 = "2021-04-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.SignalRService/operations'} # type: ignore diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_usages_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_usages_operations.py new file mode 100644 index 000000000000..ff20eed613dd --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_usages_operations.py @@ -0,0 +1,113 @@ +# 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 UsagesOperations: + """UsagesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.webpubsub.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, + location: str, + **kwargs + ) -> AsyncIterable["_models.SignalRServiceUsageList"]: + """List resource usage quotas by location. + + :param location: the location like "eastus". + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SignalRServiceUsageList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.webpubsub.models.SignalRServiceUsageList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRServiceUsageList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-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 = { + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + 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('SignalRServiceUsageList', 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.SignalRService/locations/{location}/usages'} # type: ignore diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_operations.py new file mode 100644 index 000000000000..6baefcc1c96c --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_operations.py @@ -0,0 +1,972 @@ +# 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 WebPubSubOperations: + """WebPubSubOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.webpubsub.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 check_name_availability( + self, + location: str, + parameters: "_models.NameAvailabilityParameters", + **kwargs + ) -> "_models.NameAvailability": + """Checks that the resource name is valid and is not already in use. + + :param location: the region. + :type location: str + :param parameters: Parameters supplied to the operation. + :type parameters: ~azure.mgmt.webpubsub.models.NameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.webpubsub.models.NameAvailability + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailability"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + 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, 'NameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(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('NameAvailability', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/checkNameAvailability'} # type: ignore + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["_models.WebPubSubResourceList"]: + """Handles requests to list all resources in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebPubSubResourceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.webpubsub.models.WebPubSubResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WebPubSubResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-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'), + } + 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('WebPubSubResourceList', 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.SignalRService/webPubSub'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.WebPubSubResourceList"]: + """Handles requests to list all resources in a resource group. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :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 WebPubSubResourceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.webpubsub.models.WebPubSubResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WebPubSubResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + 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('WebPubSubResourceList', 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.SignalRService/webPubSub'} # type: ignore + + async def get( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> "_models.WebPubSubResource": + """Get the resource and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebPubSubResource, or the result of cls(response) + :rtype: ~azure.mgmt.webpubsub.models.WebPubSubResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WebPubSubResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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('WebPubSubResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + parameters: "_models.WebPubSubResource", + **kwargs + ) -> Optional["_models.WebPubSubResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WebPubSubResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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, 'WebPubSubResource') + 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, 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) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WebPubSubResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('WebPubSubResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: "_models.WebPubSubResource", + **kwargs + ) -> AsyncLROPoller["_models.WebPubSubResource"]: + """Create or update a resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :param parameters: Parameters for the create or update operation. + :type parameters: ~azure.mgmt.webpubsub.models.WebPubSubResource + :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 WebPubSubResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.webpubsub.models.WebPubSubResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WebPubSubResource"] + 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, + resource_name=resource_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WebPubSubResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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.SignalRService/webPubSub/{resourceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Operation to delete a resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: 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, + resource_name=resource_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + resource_name: str, + parameters: "_models.WebPubSubResource", + **kwargs + ) -> Optional["_models.WebPubSubResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WebPubSubResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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, 'WebPubSubResource') + 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, 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) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WebPubSubResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + parameters: "_models.WebPubSubResource", + **kwargs + ) -> AsyncLROPoller["_models.WebPubSubResource"]: + """Operation to update an exiting resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :param parameters: Parameters for the update operation. + :type parameters: ~azure.mgmt.webpubsub.models.WebPubSubResource + :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 WebPubSubResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.webpubsub.models.WebPubSubResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WebPubSubResource"] + 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._update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WebPubSubResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> "_models.WebPubSubKeys": + """Get the access keys of the resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebPubSubKeys, or the result of cls(response) + :rtype: ~azure.mgmt.webpubsub.models.WebPubSubKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WebPubSubKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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('WebPubSubKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/listKeys'} # type: ignore + + async def _regenerate_key_initial( + self, + resource_group_name: str, + resource_name: str, + parameters: "_models.RegenerateKeyParameters", + **kwargs + ) -> "_models.WebPubSubKeys": + cls = kwargs.pop('cls', None) # type: ClsType["_models.WebPubSubKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._regenerate_key_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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, 'RegenerateKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(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 [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) + + deserialized = self._deserialize('WebPubSubKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _regenerate_key_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/regenerateKey'} # type: ignore + + async def begin_regenerate_key( + self, + resource_group_name: str, + resource_name: str, + parameters: "_models.RegenerateKeyParameters", + **kwargs + ) -> AsyncLROPoller["_models.WebPubSubKeys"]: + """Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated + at the same time. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :param parameters: Parameter that describes the Regenerate Key Operation. + :type parameters: ~azure.mgmt.webpubsub.models.RegenerateKeyParameters + :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 WebPubSubKeys or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.webpubsub.models.WebPubSubKeys] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WebPubSubKeys"] + 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._regenerate_key_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WebPubSubKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + 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_regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/regenerateKey'} # type: ignore + + async def _restart_initial( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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 [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, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/restart'} # type: ignore + + async def begin_restart( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Operation to restart a resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: 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( + resource_group_name=resource_group_name, + resource_name=resource_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + 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_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/restart'} # type: ignore diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_private_endpoint_connections_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..001f9cd692da --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_private_endpoint_connections_operations.py @@ -0,0 +1,373 @@ +# 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 WebPubSubPrivateEndpointConnectionsOperations: + """WebPubSubPrivateEndpointConnectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.webpubsub.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncIterable["_models.PrivateEndpointConnectionList"]: + """List private endpoint connections. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.webpubsub.models.PrivateEndpointConnectionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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('PrivateEndpointConnectionList', 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections'} # type: ignore + + async def get( + self, + private_endpoint_connection_name: str, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> "_models.PrivateEndpointConnection": + """Get the specified private endpoint connection. + + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.webpubsub.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def update( + self, + private_endpoint_connection_name: str, + resource_group_name: str, + resource_name: str, + parameters: "_models.PrivateEndpointConnection", + **kwargs + ) -> "_models.PrivateEndpointConnection": + """Update the state of specified private endpoint connection. + + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :param parameters: The resource of private endpoint and its properties. + :type parameters: ~azure.mgmt.webpubsub.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.webpubsub.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _delete_initial( + self, + private_endpoint_connection_name: str, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_delete( + self, + private_endpoint_connection_name: str, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete the specified private endpoint connection. + + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: 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( + private_endpoint_connection_name=private_endpoint_connection_name, + resource_group_name=resource_group_name, + resource_name=resource_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_private_link_resources_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_private_link_resources_operations.py new file mode 100644 index 000000000000..e2355dbd1922 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_private_link_resources_operations.py @@ -0,0 +1,118 @@ +# 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 WebPubSubPrivateLinkResourcesOperations: + """WebPubSubPrivateLinkResourcesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.webpubsub.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncIterable["_models.PrivateLinkResourceList"]: + """Get the private link resources that need to be created for a resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateLinkResourceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.webpubsub.models.PrivateLinkResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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('PrivateLinkResourceList', 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateLinkResources'} # type: ignore diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_shared_private_link_resources_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_shared_private_link_resources_operations.py new file mode 100644 index 000000000000..f1e47adef675 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_shared_private_link_resources_operations.py @@ -0,0 +1,438 @@ +# 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 WebPubSubSharedPrivateLinkResourcesOperations: + """WebPubSubSharedPrivateLinkResourcesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.webpubsub.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncIterable["_models.SharedPrivateLinkResourceList"]: + """List shared private link resources. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedPrivateLinkResourceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.webpubsub.models.SharedPrivateLinkResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedPrivateLinkResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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('SharedPrivateLinkResourceList', 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources'} # type: ignore + + async def get( + self, + shared_private_link_resource_name: str, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> "_models.SharedPrivateLinkResource": + """Get the specified shared private link resource. + + :param shared_private_link_resource_name: The name of the shared private link resource. + :type shared_private_link_resource_name: str + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedPrivateLinkResource, or the result of cls(response) + :rtype: ~azure.mgmt.webpubsub.models.SharedPrivateLinkResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedPrivateLinkResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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('SharedPrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + async def _create_or_update_initial( + self, + shared_private_link_resource_name: str, + resource_group_name: str, + resource_name: str, + parameters: "_models.SharedPrivateLinkResource", + **kwargs + ) -> "_models.SharedPrivateLinkResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedPrivateLinkResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-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 = { + 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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, 'SharedPrivateLinkResource') + 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('SharedPrivateLinkResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SharedPrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + async def begin_create_or_update( + self, + shared_private_link_resource_name: str, + resource_group_name: str, + resource_name: str, + parameters: "_models.SharedPrivateLinkResource", + **kwargs + ) -> AsyncLROPoller["_models.SharedPrivateLinkResource"]: + """Create or update a shared private link resource. + + :param shared_private_link_resource_name: The name of the shared private link resource. + :type shared_private_link_resource_name: str + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :param parameters: The shared private link resource. + :type parameters: ~azure.mgmt.webpubsub.models.SharedPrivateLinkResource + :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 SharedPrivateLinkResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.webpubsub.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedPrivateLinkResource"] + 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( + shared_private_link_resource_name=shared_private_link_resource_name, + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SharedPrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + async def _delete_initial( + self, + shared_private_link_resource_name: str, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + async def begin_delete( + self, + shared_private_link_resource_name: str, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete the specified shared private link resource. + + :param shared_private_link_resource_name: The name of the shared private link resource. + :type shared_private_link_resource_name: str + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: 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( + shared_private_link_resource_name=shared_private_link_resource_name, + resource_group_name=resource_group_name, + resource_name=resource_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/__init__.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/__init__.py new file mode 100644 index 000000000000..3ce5731380a1 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/__init__.py @@ -0,0 +1,176 @@ +# 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 Dimension + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse + from ._models_py3 import EventHandlerSettings + from ._models_py3 import EventHandlerTemplate + from ._models_py3 import LogSpecification + from ._models_py3 import ManagedIdentity + from ._models_py3 import ManagedIdentitySettings + from ._models_py3 import MetricSpecification + from ._models_py3 import NameAvailability + from ._models_py3 import NameAvailabilityParameters + from ._models_py3 import NetworkACL + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationList + from ._models_py3 import OperationProperties + from ._models_py3 import PrivateEndpoint + from ._models_py3 import PrivateEndpointACL + from ._models_py3 import PrivateEndpointConnection + from ._models_py3 import PrivateEndpointConnectionList + from ._models_py3 import PrivateLinkResource + from ._models_py3 import PrivateLinkResourceList + from ._models_py3 import PrivateLinkServiceConnectionState + from ._models_py3 import ProxyResource + from ._models_py3 import RegenerateKeyParameters + from ._models_py3 import Resource + from ._models_py3 import ResourceSku + from ._models_py3 import ServiceSpecification + from ._models_py3 import ShareablePrivateLinkResourceProperties + from ._models_py3 import ShareablePrivateLinkResourceType + from ._models_py3 import SharedPrivateLinkResource + from ._models_py3 import SharedPrivateLinkResourceList + from ._models_py3 import SignalRServiceUsage + from ._models_py3 import SignalRServiceUsageList + from ._models_py3 import SignalRServiceUsageName + from ._models_py3 import SystemData + from ._models_py3 import TrackedResource + from ._models_py3 import UpstreamAuthSettings + from ._models_py3 import UserAssignedIdentityProperty + from ._models_py3 import WebPubSubFeature + from ._models_py3 import WebPubSubKeys + from ._models_py3 import WebPubSubNetworkACLs + from ._models_py3 import WebPubSubResource + from ._models_py3 import WebPubSubResourceList + from ._models_py3 import WebPubSubTlsSettings +except (SyntaxError, ImportError): + from ._models import Dimension # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import EventHandlerSettings # type: ignore + from ._models import EventHandlerTemplate # type: ignore + from ._models import LogSpecification # type: ignore + from ._models import ManagedIdentity # type: ignore + from ._models import ManagedIdentitySettings # type: ignore + from ._models import MetricSpecification # type: ignore + from ._models import NameAvailability # type: ignore + from ._models import NameAvailabilityParameters # type: ignore + from ._models import NetworkACL # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationList # type: ignore + from ._models import OperationProperties # type: ignore + from ._models import PrivateEndpoint # type: ignore + from ._models import PrivateEndpointACL # type: ignore + from ._models import PrivateEndpointConnection # type: ignore + from ._models import PrivateEndpointConnectionList # type: ignore + from ._models import PrivateLinkResource # type: ignore + from ._models import PrivateLinkResourceList # type: ignore + from ._models import PrivateLinkServiceConnectionState # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import RegenerateKeyParameters # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceSku # type: ignore + from ._models import ServiceSpecification # type: ignore + from ._models import ShareablePrivateLinkResourceProperties # type: ignore + from ._models import ShareablePrivateLinkResourceType # type: ignore + from ._models import SharedPrivateLinkResource # type: ignore + from ._models import SharedPrivateLinkResourceList # type: ignore + from ._models import SignalRServiceUsage # type: ignore + from ._models import SignalRServiceUsageList # type: ignore + from ._models import SignalRServiceUsageName # type: ignore + from ._models import SystemData # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import UpstreamAuthSettings # type: ignore + from ._models import UserAssignedIdentityProperty # type: ignore + from ._models import WebPubSubFeature # type: ignore + from ._models import WebPubSubKeys # type: ignore + from ._models import WebPubSubNetworkACLs # type: ignore + from ._models import WebPubSubResource # type: ignore + from ._models import WebPubSubResourceList # type: ignore + from ._models import WebPubSubTlsSettings # type: ignore + +from ._web_pub_sub_management_client_enums import ( + ACLAction, + CreatedByType, + FeatureFlags, + KeyType, + ManagedIdentityType, + PrivateLinkServiceConnectionStatus, + ProvisioningState, + SharedPrivateLinkResourceStatus, + UpstreamAuthType, + WebPubSubRequestType, + WebPubSubSkuTier, +) + +__all__ = [ + 'Dimension', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'EventHandlerSettings', + 'EventHandlerTemplate', + 'LogSpecification', + 'ManagedIdentity', + 'ManagedIdentitySettings', + 'MetricSpecification', + 'NameAvailability', + 'NameAvailabilityParameters', + 'NetworkACL', + 'Operation', + 'OperationDisplay', + 'OperationList', + 'OperationProperties', + 'PrivateEndpoint', + 'PrivateEndpointACL', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionList', + 'PrivateLinkResource', + 'PrivateLinkResourceList', + 'PrivateLinkServiceConnectionState', + 'ProxyResource', + 'RegenerateKeyParameters', + 'Resource', + 'ResourceSku', + 'ServiceSpecification', + 'ShareablePrivateLinkResourceProperties', + 'ShareablePrivateLinkResourceType', + 'SharedPrivateLinkResource', + 'SharedPrivateLinkResourceList', + 'SignalRServiceUsage', + 'SignalRServiceUsageList', + 'SignalRServiceUsageName', + 'SystemData', + 'TrackedResource', + 'UpstreamAuthSettings', + 'UserAssignedIdentityProperty', + 'WebPubSubFeature', + 'WebPubSubKeys', + 'WebPubSubNetworkACLs', + 'WebPubSubResource', + 'WebPubSubResourceList', + 'WebPubSubTlsSettings', + 'ACLAction', + 'CreatedByType', + 'FeatureFlags', + 'KeyType', + 'ManagedIdentityType', + 'PrivateLinkServiceConnectionStatus', + 'ProvisioningState', + 'SharedPrivateLinkResourceStatus', + 'UpstreamAuthType', + 'WebPubSubRequestType', + 'WebPubSubSkuTier', +] diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_models.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_models.py new file mode 100644 index 000000000000..ea0fcacc179a --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_models.py @@ -0,0 +1,1590 @@ +# 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 Dimension(msrest.serialization.Model): + """Specifications of the Dimension of metrics. + + :param name: The public facing name of the dimension. + :type name: str + :param display_name: Localized friendly display name of the dimension. + :type display_name: str + :param internal_name: Name of the dimension as it appears in MDM. + :type internal_name: str + :param to_be_exported_for_shoebox: A Boolean flag indicating whether this dimension should be + included for the shoebox export scenario. + :type to_be_exported_for_shoebox: bool + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'internal_name': {'key': 'internalName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(Dimension, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.internal_name = kwargs.get('internal_name', None) + self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', 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[~azure.mgmt.webpubsub.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.webpubsub.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: ~azure.mgmt.webpubsub.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 EventHandlerSettings(msrest.serialization.Model): + """The settings for event handler in webpubsub service. + + :param items: Get or set the EventHandler items. The key is the hub name and the value is the + corresponding EventHandlerTemplate. + :type items: dict[str, list[~azure.mgmt.webpubsub.models.EventHandlerTemplate]] + """ + + _attribute_map = { + 'items': {'key': 'items', 'type': '{[EventHandlerTemplate]}'}, + } + + def __init__( + self, + **kwargs + ): + super(EventHandlerSettings, self).__init__(**kwargs) + self.items = kwargs.get('items', None) + + +class EventHandlerTemplate(msrest.serialization.Model): + """EventHandler template item settings. + + All required parameters must be populated in order to send to Azure. + + :param url_template: Required. Gets or sets the EventHandler URL template. You can use a + predefined parameter {hub} and {event} inside the template, the value of the EventHandler URL + is dynamically calculated when the client request comes in. + For example, UrlTemplate can be ``http://example.com/api/{hub}/{event}``. The host part can't + contains parameters. + :type url_template: str + :param user_event_pattern: Gets or sets the matching pattern for event names. + There are 3 kind of patterns supported: + + .. code-block:: + + 1. "*", it to matches any event name + 2. Combine multiple events with ",", for example "event1,event2", it matches event "event1" + and "event2" + 3. The single event name, for example, "event1", it matches "event1". + :type user_event_pattern: str + :param system_event_pattern: Gets ot sets the system event pattern. + There are 2 kind of patterns supported: + + .. code-block:: + + 1. The single event name, for example, "connect", it matches "connect" + 2. Combine multiple events with ",", for example "connect,disconnected", it matches event + "connect" and "disconnected". + :type system_event_pattern: str + :param auth: Gets or sets the auth settings for an event handler. If not set, no auth is used. + :type auth: ~azure.mgmt.webpubsub.models.UpstreamAuthSettings + """ + + _validation = { + 'url_template': {'required': True}, + } + + _attribute_map = { + 'url_template': {'key': 'urlTemplate', 'type': 'str'}, + 'user_event_pattern': {'key': 'userEventPattern', 'type': 'str'}, + 'system_event_pattern': {'key': 'systemEventPattern', 'type': 'str'}, + 'auth': {'key': 'auth', 'type': 'UpstreamAuthSettings'}, + } + + def __init__( + self, + **kwargs + ): + super(EventHandlerTemplate, self).__init__(**kwargs) + self.url_template = kwargs['url_template'] + self.user_event_pattern = kwargs.get('user_event_pattern', None) + self.system_event_pattern = kwargs.get('system_event_pattern', None) + self.auth = kwargs.get('auth', None) + + +class LogSpecification(msrest.serialization.Model): + """Specifications of the Logs for Azure Monitoring. + + :param name: Name of the log. + :type name: str + :param display_name: Localized friendly display name of the log. + :type display_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LogSpecification, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + + +class ManagedIdentity(msrest.serialization.Model): + """A class represent managed identities used for request and response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param type: Represent the identity type: systemAssigned, userAssigned, None. Possible values + include: "None", "SystemAssigned", "UserAssigned". + :type type: str or ~azure.mgmt.webpubsub.models.ManagedIdentityType + :param user_assigned_identities: Get or set the user assigned identities. + :type user_assigned_identities: dict[str, + ~azure.mgmt.webpubsub.models.UserAssignedIdentityProperty] + :ivar principal_id: Get the principal id for the system assigned identity. + Only be used in response. + :vartype principal_id: str + :ivar tenant_id: Get the tenant id for the system assigned identity. + Only be used in response. + :vartype tenant_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentityProperty}'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagedIdentity, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + self.principal_id = None + self.tenant_id = None + + +class ManagedIdentitySettings(msrest.serialization.Model): + """Managed identity settings for upstream. + + :param resource: The Resource indicating the App ID URI of the target resource. + It also appears in the aud (audience) claim of the issued token. + :type resource: str + """ + + _attribute_map = { + 'resource': {'key': 'resource', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagedIdentitySettings, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + + +class MetricSpecification(msrest.serialization.Model): + """Specifications of the Metrics for Azure Monitoring. + + :param name: Name of the metric. + :type name: str + :param display_name: Localized friendly display name of the metric. + :type display_name: str + :param display_description: Localized friendly description of the metric. + :type display_description: str + :param unit: The unit that makes sense for the metric. + :type unit: str + :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + Maximum, Total, Count. + :type aggregation_type: str + :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + Ex. a metric that returns the number of times a particular error code was emitted. The error + code may not appear + often, instead of the RP publishing 0, Shoebox can auto fill in 0s for time periods where + nothing was emitted. + :type fill_gap_with_zero: str + :param category: The name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :type category: str + :param dimensions: The dimensions of the metrics. + :type dimensions: list[~azure.mgmt.webpubsub.models.Dimension] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, + } + + def __init__( + self, + **kwargs + ): + super(MetricSpecification, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.display_description = kwargs.get('display_description', None) + self.unit = kwargs.get('unit', None) + self.aggregation_type = kwargs.get('aggregation_type', None) + self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) + self.category = kwargs.get('category', None) + self.dimensions = kwargs.get('dimensions', None) + + +class NameAvailability(msrest.serialization.Model): + """Result of the request to check name availability. It contains a flag and possible reason of failure. + + :param name_available: Indicates whether the name is available or not. + :type name_available: bool + :param reason: The reason of the availability. Required if name is not available. + :type reason: str + :param message: The message of the operation. + :type message: str + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NameAvailability, self).__init__(**kwargs) + self.name_available = kwargs.get('name_available', None) + self.reason = kwargs.get('reason', None) + self.message = kwargs.get('message', None) + + +class NameAvailabilityParameters(msrest.serialization.Model): + """Data POST-ed to the nameAvailability action. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The resource type. Can be "Microsoft.SignalRService/SignalR" or + "Microsoft.SignalRService/webPubSub". + :type type: str + :param name: Required. The resource name to validate. e.g."my-resource-name". + :type name: str + """ + + _validation = { + 'type': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NameAvailabilityParameters, self).__init__(**kwargs) + self.type = kwargs['type'] + self.name = kwargs['name'] + + +class NetworkACL(msrest.serialization.Model): + """Network ACL. + + :param allow: Allowed request types. The value can be one or more of: ClientConnection, + ServerConnection, RESTAPI. + :type allow: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] + :param deny: Denied request types. The value can be one or more of: ClientConnection, + ServerConnection, RESTAPI. + :type deny: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] + """ + + _attribute_map = { + 'allow': {'key': 'allow', 'type': '[str]'}, + 'deny': {'key': 'deny', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkACL, self).__init__(**kwargs) + self.allow = kwargs.get('allow', None) + self.deny = kwargs.get('deny', None) + + +class Operation(msrest.serialization.Model): + """REST API operation supported by resource provider. + + :param name: Name of the operation with format: {provider}/{resource}/{operation}. + :type name: str + :param is_data_action: If the operation is a data action. (for data plane rbac). + :type is_data_action: bool + :param display: The object that describes the operation. + :type display: ~azure.mgmt.webpubsub.models.OperationDisplay + :param origin: Optional. The intended executor of the operation; governs the display of the + operation in the RBAC UX and the audit logs UX. + :type origin: str + :param properties: Extra properties for the operation. + :type properties: ~azure.mgmt.webpubsub.models.OperationProperties + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'OperationProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.is_data_action = kwargs.get('is_data_action', None) + self.display = kwargs.get('display', None) + self.origin = kwargs.get('origin', None) + self.properties = kwargs.get('properties', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that describes a operation. + + :param provider: Friendly name of the resource provider. + :type provider: str + :param resource: Resource type on which the operation is performed. + :type resource: str + :param operation: The localized friendly name for the operation. + :type operation: str + :param description: The localized friendly description for 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): + """Result of the request to list REST API operations. It contains a list of operations. + + :param value: List of operations supported by the resource provider. + :type value: list[~azure.mgmt.webpubsub.models.Operation] + :param next_link: The URL the client should use to fetch the next page (per server side + paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class OperationProperties(msrest.serialization.Model): + """Extra Operation properties. + + :param service_specification: The service specifications. + :type service_specification: ~azure.mgmt.webpubsub.models.ServiceSpecification + """ + + _attribute_map = { + 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationProperties, self).__init__(**kwargs) + self.service_specification = kwargs.get('service_specification', None) + + +class PrivateEndpoint(msrest.serialization.Model): + """Private endpoint. + + :param id: Full qualified Id of the private endpoint. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class PrivateEndpointACL(NetworkACL): + """ACL for a private endpoint. + + All required parameters must be populated in order to send to Azure. + + :param allow: Allowed request types. The value can be one or more of: ClientConnection, + ServerConnection, RESTAPI. + :type allow: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] + :param deny: Denied request types. The value can be one or more of: ClientConnection, + ServerConnection, RESTAPI. + :type deny: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] + :param name: Required. Name of the private endpoint connection. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'allow': {'key': 'allow', 'type': '[str]'}, + 'deny': {'key': 'deny', 'type': '[str]'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointACL, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class Resource(msrest.serialization.Model): + """The core properties of ARM 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". + :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 PrivateEndpointConnection(ProxyResource): + """A private endpoint connection to an azure 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.webpubsub.models.SystemData + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", + "Updating", "Deleting", "Moving". + :vartype provisioning_state: str or ~azure.mgmt.webpubsub.models.ProvisioningState + :param private_endpoint: Private endpoint associated with the private endpoint connection. + :type private_endpoint: ~azure.mgmt.webpubsub.models.PrivateEndpoint + :param private_link_service_connection_state: Connection state. + :type private_link_service_connection_state: + ~azure.mgmt.webpubsub.models.PrivateLinkServiceConnectionState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.system_data = None + self.provisioning_state = None + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) + + +class PrivateEndpointConnectionList(msrest.serialization.Model): + """A list of private endpoint connections. + + :param value: The list of the private endpoint connections. + :type value: list[~azure.mgmt.webpubsub.models.PrivateEndpointConnection] + :param next_link: Request URL that can be used to query next page of private endpoint + connections. Returned when the total number of requested private endpoint connections exceed + maximum page size. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class PrivateLinkResource(ProxyResource): + """Private link 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". + :vartype type: str + :param group_id: Group Id of the private link resource. + :type group_id: str + :param required_members: Required members of the private link resource. + :type required_members: list[str] + :param required_zone_names: Required private DNS zone names. + :type required_zone_names: list[str] + :param shareable_private_link_resource_types: The list of resources that are onboarded to + private link service. + :type shareable_private_link_resource_types: + list[~azure.mgmt.webpubsub.models.ShareablePrivateLinkResourceType] + """ + + _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'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + 'shareable_private_link_resource_types': {'key': 'properties.shareablePrivateLinkResourceTypes', 'type': '[ShareablePrivateLinkResourceType]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResource, self).__init__(**kwargs) + self.group_id = kwargs.get('group_id', None) + self.required_members = kwargs.get('required_members', None) + self.required_zone_names = kwargs.get('required_zone_names', None) + self.shareable_private_link_resource_types = kwargs.get('shareable_private_link_resource_types', None) + + +class PrivateLinkResourceList(msrest.serialization.Model): + """Contains a list of PrivateLinkResource and a possible link to query more results. + + :param value: List of PrivateLinkResource. + :type value: list[~azure.mgmt.webpubsub.models.PrivateLinkResource] + :param next_link: The URL the client should use to fetch the next page (per server side + paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResourceList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """Connection state of the private endpoint connection. + + :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + :type status: str or ~azure.mgmt.webpubsub.models.PrivateLinkServiceConnectionStatus + :param description: The reason for approval/rejection of the connection. + :type description: str + :param actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :type actions_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.description = kwargs.get('description', None) + self.actions_required = kwargs.get('actions_required', None) + + +class RegenerateKeyParameters(msrest.serialization.Model): + """Parameters describes the request to regenerate access keys. + + :param key_type: The keyType to regenerate. Must be either 'primary' or + 'secondary'(case-insensitive). Possible values include: "Primary", "Secondary". + :type key_type: str or ~azure.mgmt.webpubsub.models.KeyType + """ + + _attribute_map = { + 'key_type': {'key': 'keyType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RegenerateKeyParameters, self).__init__(**kwargs) + self.key_type = kwargs.get('key_type', None) + + +class ResourceSku(msrest.serialization.Model): + """The billing information of the 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. + + :param name: Required. The name of the SKU. Required. + + Allowed values: Standard_S1, Free_F1. + :type name: str + :param tier: Optional tier of this particular SKU. 'Standard' or 'Free'. + + ``Basic`` is deprecated, use ``Standard`` instead. Possible values include: "Free", "Basic", + "Standard", "Premium". + :type tier: str or ~azure.mgmt.webpubsub.models.WebPubSubSkuTier + :ivar size: Not used. Retained for future use. + :vartype size: str + :ivar family: Not used. Retained for future use. + :vartype family: str + :param capacity: Optional, integer. The unit count of the resource. 1 by default. + + If present, following values are allowed: + Free: 1 + Standard: 1,2,5,10,20,50,100. + :type capacity: int + """ + + _validation = { + 'name': {'required': True}, + 'size': {'readonly': True}, + 'family': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceSku, self).__init__(**kwargs) + self.name = kwargs['name'] + self.tier = kwargs.get('tier', None) + self.size = None + self.family = None + self.capacity = kwargs.get('capacity', None) + + +class ServiceSpecification(msrest.serialization.Model): + """An object that describes a specification. + + :param metric_specifications: Specifications of the Metrics for Azure Monitoring. + :type metric_specifications: list[~azure.mgmt.webpubsub.models.MetricSpecification] + :param log_specifications: Specifications of the Logs for Azure Monitoring. + :type log_specifications: list[~azure.mgmt.webpubsub.models.LogSpecification] + """ + + _attribute_map = { + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + } + + def __init__( + self, + **kwargs + ): + super(ServiceSpecification, self).__init__(**kwargs) + self.metric_specifications = kwargs.get('metric_specifications', None) + self.log_specifications = kwargs.get('log_specifications', None) + + +class ShareablePrivateLinkResourceProperties(msrest.serialization.Model): + """Describes the properties of a resource type that has been onboarded to private link service. + + :param description: The description of the resource type that has been onboarded to private + link service. + :type description: str + :param group_id: The resource provider group id for the resource that has been onboarded to + private link service. + :type group_id: str + :param type: The resource provider type for the resource that has been onboarded to private + link service. + :type type: str + """ + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'group_id': {'key': 'groupId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ShareablePrivateLinkResourceProperties, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.group_id = kwargs.get('group_id', None) + self.type = kwargs.get('type', None) + + +class ShareablePrivateLinkResourceType(msrest.serialization.Model): + """Describes a resource type that has been onboarded to private link service. + + :param name: The name of the resource type that has been onboarded to private link service. + :type name: str + :param properties: Describes the properties of a resource type that has been onboarded to + private link service. + :type properties: ~azure.mgmt.webpubsub.models.ShareablePrivateLinkResourceProperties + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ShareablePrivateLinkResourceProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(ShareablePrivateLinkResourceType, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.properties = kwargs.get('properties', None) + + +class SharedPrivateLinkResource(ProxyResource): + """Describes a Shared Private Link 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.webpubsub.models.SystemData + :param group_id: The group id from the provider of resource the shared private link resource is + for. + :type group_id: str + :param private_link_resource_id: The resource id of the resource the shared private link + resource is for. + :type private_link_resource_id: str + :ivar provisioning_state: Provisioning state of the shared private link resource. Possible + values include: "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", + "Updating", "Deleting", "Moving". + :vartype provisioning_state: str or ~azure.mgmt.webpubsub.models.ProvisioningState + :param request_message: The request message for requesting approval of the shared private link + resource. + :type request_message: str + :ivar status: Status of the shared private link resource. Possible values include: "Pending", + "Approved", "Rejected", "Disconnected", "Timeout". + :vartype status: str or ~azure.mgmt.webpubsub.models.SharedPrivateLinkResourceStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'private_link_resource_id': {'key': 'properties.privateLinkResourceId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'request_message': {'key': 'properties.requestMessage', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedPrivateLinkResource, self).__init__(**kwargs) + self.system_data = None + self.group_id = kwargs.get('group_id', None) + self.private_link_resource_id = kwargs.get('private_link_resource_id', None) + self.provisioning_state = None + self.request_message = kwargs.get('request_message', None) + self.status = None + + +class SharedPrivateLinkResourceList(msrest.serialization.Model): + """A list of shared private link resources. + + :param value: The list of the shared private link resources. + :type value: list[~azure.mgmt.webpubsub.models.SharedPrivateLinkResource] + :param next_link: Request URL that can be used to query next page of private endpoint + connections. Returned when the total number of requested private endpoint connections exceed + maximum page size. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedPrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedPrivateLinkResourceList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SignalRServiceUsage(msrest.serialization.Model): + """Object that describes a specific usage of the resources. + + :param id: Fully qualified ARM resource id. + :type id: str + :param current_value: Current value for the usage quota. + :type current_value: long + :param limit: The maximum permitted value for the usage quota. If there is no limit, this value + will be -1. + :type limit: long + :param name: Localizable String object containing the name and a localized value. + :type name: ~azure.mgmt.webpubsub.models.SignalRServiceUsageName + :param unit: Representing the units of the usage quota. Possible values are: Count, Bytes, + Seconds, Percent, CountPerSecond, BytesPerSecond. + :type unit: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'name': {'key': 'name', 'type': 'SignalRServiceUsageName'}, + 'unit': {'key': 'unit', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SignalRServiceUsage, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.current_value = kwargs.get('current_value', None) + self.limit = kwargs.get('limit', None) + self.name = kwargs.get('name', None) + self.unit = kwargs.get('unit', None) + + +class SignalRServiceUsageList(msrest.serialization.Model): + """Object that includes an array of the resource usages and a possible link for next set. + + :param value: List of the resource usages. + :type value: list[~azure.mgmt.webpubsub.models.SignalRServiceUsage] + :param next_link: The URL the client should use to fetch the next page (per server side + paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SignalRServiceUsage]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SignalRServiceUsageList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SignalRServiceUsageName(msrest.serialization.Model): + """Localizable String object containing the name and a localized value. + + :param value: The identifier of the usage. + :type value: str + :param localized_value: Localized name of the usage. + :type localized_value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SignalRServiceUsageName, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.localized_value = kwargs.get('localized_value', None) + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.webpubsub.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.webpubsub.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". + :vartype type: str + :param location: The GEO location of the resource. e.g. West US | East US | North Central US | + South Central US. + :type location: str + :param tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class UpstreamAuthSettings(msrest.serialization.Model): + """Upstream auth settings. + + :param type: Gets or sets the type of auth. None or ManagedIdentity is supported now. Possible + values include: "None", "ManagedIdentity". + :type type: str or ~azure.mgmt.webpubsub.models.UpstreamAuthType + :param managed_identity: Gets or sets the managed identity settings. It's required if the auth + type is set to ManagedIdentity. + :type managed_identity: ~azure.mgmt.webpubsub.models.ManagedIdentitySettings + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'managed_identity': {'key': 'managedIdentity', 'type': 'ManagedIdentitySettings'}, + } + + def __init__( + self, + **kwargs + ): + super(UpstreamAuthSettings, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.managed_identity = kwargs.get('managed_identity', None) + + +class UserAssignedIdentityProperty(msrest.serialization.Model): + """Properties of user assigned identity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Get the principal id for the user assigned identity. + :vartype principal_id: str + :ivar client_id: Get the client id for the user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserAssignedIdentityProperty, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class WebPubSubFeature(msrest.serialization.Model): + """Feature of a resource, which controls the runtime behavior. + + All required parameters must be populated in order to send to Azure. + + :param flag: Required. FeatureFlags is the supported features of Azure SignalR service. + + + * EnableConnectivityLogs: "true"/"false", to enable/disable the connectivity log category + respectively. + * EnableMessagingLogs: "true"/"false", to enable/disable the connectivity log category + respectively. + * EnableLiveTrace: Live Trace allows you to know what's happening inside Azure SignalR + service, it will give you live traces in real time, it will be helpful when you developing your + own Azure SignalR based web application or self-troubleshooting some issues. Please note that + live traces are counted as outbound messages that will be charged. Values allowed: + "true"/"false", to enable/disable live trace feature. Possible values include: + "EnableConnectivityLogs", "EnableMessagingLogs", "EnableLiveTrace". + :type flag: str or ~azure.mgmt.webpubsub.models.FeatureFlags + :param value: Required. Value of the feature flag. See Azure SignalR service document + https://docs.microsoft.com/azure/azure-signalr/ for allowed values. + :type value: str + :param properties: Optional properties related to this feature. + :type properties: dict[str, str] + """ + + _validation = { + 'flag': {'required': True}, + 'value': {'required': True, 'max_length': 128, 'min_length': 1}, + } + + _attribute_map = { + 'flag': {'key': 'flag', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(WebPubSubFeature, self).__init__(**kwargs) + self.flag = kwargs['flag'] + self.value = kwargs['value'] + self.properties = kwargs.get('properties', None) + + +class WebPubSubKeys(msrest.serialization.Model): + """A class represents the access keys of the resource. + + :param primary_key: The primary access key. + :type primary_key: str + :param secondary_key: The secondary access key. + :type secondary_key: str + :param primary_connection_string: Connection string constructed via the primaryKey. + :type primary_connection_string: str + :param secondary_connection_string: Connection string constructed via the secondaryKey. + :type secondary_connection_string: str + """ + + _attribute_map = { + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, + 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WebPubSubKeys, self).__init__(**kwargs) + self.primary_key = kwargs.get('primary_key', None) + self.secondary_key = kwargs.get('secondary_key', None) + self.primary_connection_string = kwargs.get('primary_connection_string', None) + self.secondary_connection_string = kwargs.get('secondary_connection_string', None) + + +class WebPubSubNetworkACLs(msrest.serialization.Model): + """Network ACLs for the resource. + + :param default_action: Default action when no other rule matches. Possible values include: + "Allow", "Deny". + :type default_action: str or ~azure.mgmt.webpubsub.models.ACLAction + :param public_network: ACL for requests from public network. + :type public_network: ~azure.mgmt.webpubsub.models.NetworkACL + :param private_endpoints: ACLs for requests from private endpoints. + :type private_endpoints: list[~azure.mgmt.webpubsub.models.PrivateEndpointACL] + """ + + _attribute_map = { + 'default_action': {'key': 'defaultAction', 'type': 'str'}, + 'public_network': {'key': 'publicNetwork', 'type': 'NetworkACL'}, + 'private_endpoints': {'key': 'privateEndpoints', 'type': '[PrivateEndpointACL]'}, + } + + def __init__( + self, + **kwargs + ): + super(WebPubSubNetworkACLs, self).__init__(**kwargs) + self.default_action = kwargs.get('default_action', None) + self.public_network = kwargs.get('public_network', None) + self.private_endpoints = kwargs.get('private_endpoints', None) + + +class WebPubSubResource(TrackedResource): + """A class represent a 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". + :vartype type: str + :param location: The GEO location of the resource. e.g. West US | East US | North Central US | + South Central US. + :type location: str + :param tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :type tags: dict[str, str] + :param sku: The billing information of the resource.(e.g. Free, Standard). + :type sku: ~azure.mgmt.webpubsub.models.ResourceSku + :param identity: The managed identity response. + :type identity: ~azure.mgmt.webpubsub.models.ManagedIdentity + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.webpubsub.models.SystemData + :ivar provisioning_state: Provisioning state of the resource. Possible values include: + "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", "Updating", "Deleting", + "Moving". + :vartype provisioning_state: str or ~azure.mgmt.webpubsub.models.ProvisioningState + :ivar external_ip: The publicly accessible IP of the resource. + :vartype external_ip: str + :ivar host_name: FQDN of the service instance. + :vartype host_name: str + :ivar public_port: The publicly accessible port of the resource which is designed for + browser/client side usage. + :vartype public_port: int + :ivar server_port: The publicly accessible port of the resource which is designed for customer + server side usage. + :vartype server_port: int + :ivar version: Version of the resource. Probably you need the same or higher version of client + SDKs. + :vartype version: str + :ivar private_endpoint_connections: Private endpoint connections to the resource. + :vartype private_endpoint_connections: + list[~azure.mgmt.webpubsub.models.PrivateEndpointConnection] + :ivar shared_private_link_resources: The list of shared private link resources. + :vartype shared_private_link_resources: + list[~azure.mgmt.webpubsub.models.SharedPrivateLinkResource] + :param tls: TLS settings. + :type tls: ~azure.mgmt.webpubsub.models.WebPubSubTlsSettings + :param features: List of the featureFlags. + + FeatureFlags that are not included in the parameters for the update operation will not be + modified. + And the response will only include featureFlags that are explicitly set. + When a featureFlag is not explicitly set, its globally default value will be used + But keep in mind, the default value doesn't mean "false". It varies in terms of different + FeatureFlags. + :type features: list[~azure.mgmt.webpubsub.models.WebPubSubFeature] + :param event_handler: The settings for event handler in webpubsub service. + :type event_handler: ~azure.mgmt.webpubsub.models.EventHandlerSettings + :param network_ac_ls: Network ACLs. + :type network_ac_ls: ~azure.mgmt.webpubsub.models.WebPubSubNetworkACLs + :param public_network_access: Enable or disable public network access. Default to "Enabled". + When it's Enabled, network ACLs still apply. + When it's Disabled, public network access is always disabled no matter what you set in network + ACLs. + :type public_network_access: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'external_ip': {'readonly': True}, + 'host_name': {'readonly': True}, + 'public_port': {'readonly': True}, + 'server_port': {'readonly': True}, + 'version': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + 'shared_private_link_resources': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'external_ip': {'key': 'properties.externalIP', 'type': 'str'}, + 'host_name': {'key': 'properties.hostName', 'type': 'str'}, + 'public_port': {'key': 'properties.publicPort', 'type': 'int'}, + 'server_port': {'key': 'properties.serverPort', 'type': 'int'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'shared_private_link_resources': {'key': 'properties.sharedPrivateLinkResources', 'type': '[SharedPrivateLinkResource]'}, + 'tls': {'key': 'properties.tls', 'type': 'WebPubSubTlsSettings'}, + 'features': {'key': 'properties.features', 'type': '[WebPubSubFeature]'}, + 'event_handler': {'key': 'properties.eventHandler', 'type': 'EventHandlerSettings'}, + 'network_ac_ls': {'key': 'properties.networkACLs', 'type': 'WebPubSubNetworkACLs'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WebPubSubResource, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.identity = kwargs.get('identity', None) + self.system_data = None + self.provisioning_state = None + self.external_ip = None + self.host_name = None + self.public_port = None + self.server_port = None + self.version = None + self.private_endpoint_connections = None + self.shared_private_link_resources = None + self.tls = kwargs.get('tls', None) + self.features = kwargs.get('features', None) + self.event_handler = kwargs.get('event_handler', None) + self.network_ac_ls = kwargs.get('network_ac_ls', None) + self.public_network_access = kwargs.get('public_network_access', "Enabled") + + +class WebPubSubResourceList(msrest.serialization.Model): + """Object that includes an array of resources and a possible link for next set. + + :param value: List of the resources. + :type value: list[~azure.mgmt.webpubsub.models.WebPubSubResource] + :param next_link: The URL the client should use to fetch the next page (per server side + paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WebPubSubResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WebPubSubResourceList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class WebPubSubTlsSettings(msrest.serialization.Model): + """TLS settings for the resource. + + :param client_cert_enabled: Request client certificate during TLS handshake if enabled. + :type client_cert_enabled: bool + """ + + _attribute_map = { + 'client_cert_enabled': {'key': 'clientCertEnabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(WebPubSubTlsSettings, self).__init__(**kwargs) + self.client_cert_enabled = kwargs.get('client_cert_enabled', None) diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_models_py3.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_models_py3.py new file mode 100644 index 000000000000..f6b68d18a2e9 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_models_py3.py @@ -0,0 +1,1752 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._web_pub_sub_management_client_enums import * + + +class Dimension(msrest.serialization.Model): + """Specifications of the Dimension of metrics. + + :param name: The public facing name of the dimension. + :type name: str + :param display_name: Localized friendly display name of the dimension. + :type display_name: str + :param internal_name: Name of the dimension as it appears in MDM. + :type internal_name: str + :param to_be_exported_for_shoebox: A Boolean flag indicating whether this dimension should be + included for the shoebox export scenario. + :type to_be_exported_for_shoebox: bool + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'internal_name': {'key': 'internalName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + internal_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + **kwargs + ): + super(Dimension, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.internal_name = internal_name + self.to_be_exported_for_shoebox = to_be_exported_for_shoebox + + +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[~azure.mgmt.webpubsub.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.webpubsub.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: ~azure.mgmt.webpubsub.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 EventHandlerSettings(msrest.serialization.Model): + """The settings for event handler in webpubsub service. + + :param items: Get or set the EventHandler items. The key is the hub name and the value is the + corresponding EventHandlerTemplate. + :type items: dict[str, list[~azure.mgmt.webpubsub.models.EventHandlerTemplate]] + """ + + _attribute_map = { + 'items': {'key': 'items', 'type': '{[EventHandlerTemplate]}'}, + } + + def __init__( + self, + *, + items: Optional[Dict[str, List["EventHandlerTemplate"]]] = None, + **kwargs + ): + super(EventHandlerSettings, self).__init__(**kwargs) + self.items = items + + +class EventHandlerTemplate(msrest.serialization.Model): + """EventHandler template item settings. + + All required parameters must be populated in order to send to Azure. + + :param url_template: Required. Gets or sets the EventHandler URL template. You can use a + predefined parameter {hub} and {event} inside the template, the value of the EventHandler URL + is dynamically calculated when the client request comes in. + For example, UrlTemplate can be ``http://example.com/api/{hub}/{event}``. The host part can't + contains parameters. + :type url_template: str + :param user_event_pattern: Gets or sets the matching pattern for event names. + There are 3 kind of patterns supported: + + .. code-block:: + + 1. "*", it to matches any event name + 2. Combine multiple events with ",", for example "event1,event2", it matches event "event1" + and "event2" + 3. The single event name, for example, "event1", it matches "event1". + :type user_event_pattern: str + :param system_event_pattern: Gets ot sets the system event pattern. + There are 2 kind of patterns supported: + + .. code-block:: + + 1. The single event name, for example, "connect", it matches "connect" + 2. Combine multiple events with ",", for example "connect,disconnected", it matches event + "connect" and "disconnected". + :type system_event_pattern: str + :param auth: Gets or sets the auth settings for an event handler. If not set, no auth is used. + :type auth: ~azure.mgmt.webpubsub.models.UpstreamAuthSettings + """ + + _validation = { + 'url_template': {'required': True}, + } + + _attribute_map = { + 'url_template': {'key': 'urlTemplate', 'type': 'str'}, + 'user_event_pattern': {'key': 'userEventPattern', 'type': 'str'}, + 'system_event_pattern': {'key': 'systemEventPattern', 'type': 'str'}, + 'auth': {'key': 'auth', 'type': 'UpstreamAuthSettings'}, + } + + def __init__( + self, + *, + url_template: str, + user_event_pattern: Optional[str] = None, + system_event_pattern: Optional[str] = None, + auth: Optional["UpstreamAuthSettings"] = None, + **kwargs + ): + super(EventHandlerTemplate, self).__init__(**kwargs) + self.url_template = url_template + self.user_event_pattern = user_event_pattern + self.system_event_pattern = system_event_pattern + self.auth = auth + + +class LogSpecification(msrest.serialization.Model): + """Specifications of the Logs for Azure Monitoring. + + :param name: Name of the log. + :type name: str + :param display_name: Localized friendly display name of the log. + :type display_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + **kwargs + ): + super(LogSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + + +class ManagedIdentity(msrest.serialization.Model): + """A class represent managed identities used for request and response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param type: Represent the identity type: systemAssigned, userAssigned, None. Possible values + include: "None", "SystemAssigned", "UserAssigned". + :type type: str or ~azure.mgmt.webpubsub.models.ManagedIdentityType + :param user_assigned_identities: Get or set the user assigned identities. + :type user_assigned_identities: dict[str, + ~azure.mgmt.webpubsub.models.UserAssignedIdentityProperty] + :ivar principal_id: Get the principal id for the system assigned identity. + Only be used in response. + :vartype principal_id: str + :ivar tenant_id: Get the tenant id for the system assigned identity. + Only be used in response. + :vartype tenant_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentityProperty}'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ManagedIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "UserAssignedIdentityProperty"]] = None, + **kwargs + ): + super(ManagedIdentity, self).__init__(**kwargs) + self.type = type + self.user_assigned_identities = user_assigned_identities + self.principal_id = None + self.tenant_id = None + + +class ManagedIdentitySettings(msrest.serialization.Model): + """Managed identity settings for upstream. + + :param resource: The Resource indicating the App ID URI of the target resource. + It also appears in the aud (audience) claim of the issued token. + :type resource: str + """ + + _attribute_map = { + 'resource': {'key': 'resource', 'type': 'str'}, + } + + def __init__( + self, + *, + resource: Optional[str] = None, + **kwargs + ): + super(ManagedIdentitySettings, self).__init__(**kwargs) + self.resource = resource + + +class MetricSpecification(msrest.serialization.Model): + """Specifications of the Metrics for Azure Monitoring. + + :param name: Name of the metric. + :type name: str + :param display_name: Localized friendly display name of the metric. + :type display_name: str + :param display_description: Localized friendly description of the metric. + :type display_description: str + :param unit: The unit that makes sense for the metric. + :type unit: str + :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + Maximum, Total, Count. + :type aggregation_type: str + :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + Ex. a metric that returns the number of times a particular error code was emitted. The error + code may not appear + often, instead of the RP publishing 0, Shoebox can auto fill in 0s for time periods where + nothing was emitted. + :type fill_gap_with_zero: str + :param category: The name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :type category: str + :param dimensions: The dimensions of the metrics. + :type dimensions: list[~azure.mgmt.webpubsub.models.Dimension] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + aggregation_type: Optional[str] = None, + fill_gap_with_zero: Optional[str] = None, + category: Optional[str] = None, + dimensions: Optional[List["Dimension"]] = None, + **kwargs + ): + super(MetricSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.display_description = display_description + self.unit = unit + self.aggregation_type = aggregation_type + self.fill_gap_with_zero = fill_gap_with_zero + self.category = category + self.dimensions = dimensions + + +class NameAvailability(msrest.serialization.Model): + """Result of the request to check name availability. It contains a flag and possible reason of failure. + + :param name_available: Indicates whether the name is available or not. + :type name_available: bool + :param reason: The reason of the availability. Required if name is not available. + :type reason: str + :param message: The message of the operation. + :type message: str + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + super(NameAvailability, self).__init__(**kwargs) + self.name_available = name_available + self.reason = reason + self.message = message + + +class NameAvailabilityParameters(msrest.serialization.Model): + """Data POST-ed to the nameAvailability action. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The resource type. Can be "Microsoft.SignalRService/SignalR" or + "Microsoft.SignalRService/webPubSub". + :type type: str + :param name: Required. The resource name to validate. e.g."my-resource-name". + :type name: str + """ + + _validation = { + 'type': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + type: str, + name: str, + **kwargs + ): + super(NameAvailabilityParameters, self).__init__(**kwargs) + self.type = type + self.name = name + + +class NetworkACL(msrest.serialization.Model): + """Network ACL. + + :param allow: Allowed request types. The value can be one or more of: ClientConnection, + ServerConnection, RESTAPI. + :type allow: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] + :param deny: Denied request types. The value can be one or more of: ClientConnection, + ServerConnection, RESTAPI. + :type deny: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] + """ + + _attribute_map = { + 'allow': {'key': 'allow', 'type': '[str]'}, + 'deny': {'key': 'deny', 'type': '[str]'}, + } + + def __init__( + self, + *, + allow: Optional[List[Union[str, "WebPubSubRequestType"]]] = None, + deny: Optional[List[Union[str, "WebPubSubRequestType"]]] = None, + **kwargs + ): + super(NetworkACL, self).__init__(**kwargs) + self.allow = allow + self.deny = deny + + +class Operation(msrest.serialization.Model): + """REST API operation supported by resource provider. + + :param name: Name of the operation with format: {provider}/{resource}/{operation}. + :type name: str + :param is_data_action: If the operation is a data action. (for data plane rbac). + :type is_data_action: bool + :param display: The object that describes the operation. + :type display: ~azure.mgmt.webpubsub.models.OperationDisplay + :param origin: Optional. The intended executor of the operation; governs the display of the + operation in the RBAC UX and the audit logs UX. + :type origin: str + :param properties: Extra properties for the operation. + :type properties: ~azure.mgmt.webpubsub.models.OperationProperties + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'OperationProperties'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + properties: Optional["OperationProperties"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = name + self.is_data_action = is_data_action + self.display = display + self.origin = origin + self.properties = properties + + +class OperationDisplay(msrest.serialization.Model): + """The object that describes a operation. + + :param provider: Friendly name of the resource provider. + :type provider: str + :param resource: Resource type on which the operation is performed. + :type resource: str + :param operation: The localized friendly name for the operation. + :type operation: str + :param description: The localized friendly description for 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): + """Result of the request to list REST API operations. It contains a list of operations. + + :param value: List of operations supported by the resource provider. + :type value: list[~azure.mgmt.webpubsub.models.Operation] + :param next_link: The URL the client should use to fetch the next page (per server side + paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Operation"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(OperationList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class OperationProperties(msrest.serialization.Model): + """Extra Operation properties. + + :param service_specification: The service specifications. + :type service_specification: ~azure.mgmt.webpubsub.models.ServiceSpecification + """ + + _attribute_map = { + 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__( + self, + *, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): + super(OperationProperties, self).__init__(**kwargs) + self.service_specification = service_specification + + +class PrivateEndpoint(msrest.serialization.Model): + """Private endpoint. + + :param id: Full qualified Id of the private endpoint. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = id + + +class PrivateEndpointACL(NetworkACL): + """ACL for a private endpoint. + + All required parameters must be populated in order to send to Azure. + + :param allow: Allowed request types. The value can be one or more of: ClientConnection, + ServerConnection, RESTAPI. + :type allow: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] + :param deny: Denied request types. The value can be one or more of: ClientConnection, + ServerConnection, RESTAPI. + :type deny: list[str or ~azure.mgmt.webpubsub.models.WebPubSubRequestType] + :param name: Required. Name of the private endpoint connection. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'allow': {'key': 'allow', 'type': '[str]'}, + 'deny': {'key': 'deny', 'type': '[str]'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + allow: Optional[List[Union[str, "WebPubSubRequestType"]]] = None, + deny: Optional[List[Union[str, "WebPubSubRequestType"]]] = None, + **kwargs + ): + super(PrivateEndpointACL, self).__init__(allow=allow, deny=deny, **kwargs) + self.name = name + + +class Resource(msrest.serialization.Model): + """The core properties of ARM 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". + :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 PrivateEndpointConnection(ProxyResource): + """A private endpoint connection to an azure 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.webpubsub.models.SystemData + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", + "Updating", "Deleting", "Moving". + :vartype provisioning_state: str or ~azure.mgmt.webpubsub.models.ProvisioningState + :param private_endpoint: Private endpoint associated with the private endpoint connection. + :type private_endpoint: ~azure.mgmt.webpubsub.models.PrivateEndpoint + :param private_link_service_connection_state: Connection state. + :type private_link_service_connection_state: + ~azure.mgmt.webpubsub.models.PrivateLinkServiceConnectionState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + } + + def __init__( + self, + *, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.system_data = None + self.provisioning_state = None + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + + +class PrivateEndpointConnectionList(msrest.serialization.Model): + """A list of private endpoint connections. + + :param value: The list of the private endpoint connections. + :type value: list[~azure.mgmt.webpubsub.models.PrivateEndpointConnection] + :param next_link: Request URL that can be used to query next page of private endpoint + connections. Returned when the total number of requested private endpoint connections exceed + maximum page size. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateEndpointConnection"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(PrivateEndpointConnectionList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PrivateLinkResource(ProxyResource): + """Private link 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". + :vartype type: str + :param group_id: Group Id of the private link resource. + :type group_id: str + :param required_members: Required members of the private link resource. + :type required_members: list[str] + :param required_zone_names: Required private DNS zone names. + :type required_zone_names: list[str] + :param shareable_private_link_resource_types: The list of resources that are onboarded to + private link service. + :type shareable_private_link_resource_types: + list[~azure.mgmt.webpubsub.models.ShareablePrivateLinkResourceType] + """ + + _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'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + 'shareable_private_link_resource_types': {'key': 'properties.shareablePrivateLinkResourceTypes', 'type': '[ShareablePrivateLinkResourceType]'}, + } + + def __init__( + self, + *, + group_id: Optional[str] = None, + required_members: Optional[List[str]] = None, + required_zone_names: Optional[List[str]] = None, + shareable_private_link_resource_types: Optional[List["ShareablePrivateLinkResourceType"]] = None, + **kwargs + ): + super(PrivateLinkResource, self).__init__(**kwargs) + self.group_id = group_id + self.required_members = required_members + self.required_zone_names = required_zone_names + self.shareable_private_link_resource_types = shareable_private_link_resource_types + + +class PrivateLinkResourceList(msrest.serialization.Model): + """Contains a list of PrivateLinkResource and a possible link to query more results. + + :param value: List of PrivateLinkResource. + :type value: list[~azure.mgmt.webpubsub.models.PrivateLinkResource] + :param next_link: The URL the client should use to fetch the next page (per server side + paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateLinkResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(PrivateLinkResourceList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """Connection state of the private endpoint connection. + + :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + :type status: str or ~azure.mgmt.webpubsub.models.PrivateLinkServiceConnectionStatus + :param description: The reason for approval/rejection of the connection. + :type description: str + :param actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :type actions_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "PrivateLinkServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +class RegenerateKeyParameters(msrest.serialization.Model): + """Parameters describes the request to regenerate access keys. + + :param key_type: The keyType to regenerate. Must be either 'primary' or + 'secondary'(case-insensitive). Possible values include: "Primary", "Secondary". + :type key_type: str or ~azure.mgmt.webpubsub.models.KeyType + """ + + _attribute_map = { + 'key_type': {'key': 'keyType', 'type': 'str'}, + } + + def __init__( + self, + *, + key_type: Optional[Union[str, "KeyType"]] = None, + **kwargs + ): + super(RegenerateKeyParameters, self).__init__(**kwargs) + self.key_type = key_type + + +class ResourceSku(msrest.serialization.Model): + """The billing information of the 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. + + :param name: Required. The name of the SKU. Required. + + Allowed values: Standard_S1, Free_F1. + :type name: str + :param tier: Optional tier of this particular SKU. 'Standard' or 'Free'. + + ``Basic`` is deprecated, use ``Standard`` instead. Possible values include: "Free", "Basic", + "Standard", "Premium". + :type tier: str or ~azure.mgmt.webpubsub.models.WebPubSubSkuTier + :ivar size: Not used. Retained for future use. + :vartype size: str + :ivar family: Not used. Retained for future use. + :vartype family: str + :param capacity: Optional, integer. The unit count of the resource. 1 by default. + + If present, following values are allowed: + Free: 1 + Standard: 1,2,5,10,20,50,100. + :type capacity: int + """ + + _validation = { + 'name': {'required': True}, + 'size': {'readonly': True}, + 'family': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + *, + name: str, + tier: Optional[Union[str, "WebPubSubSkuTier"]] = None, + capacity: Optional[int] = None, + **kwargs + ): + super(ResourceSku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.size = None + self.family = None + self.capacity = capacity + + +class ServiceSpecification(msrest.serialization.Model): + """An object that describes a specification. + + :param metric_specifications: Specifications of the Metrics for Azure Monitoring. + :type metric_specifications: list[~azure.mgmt.webpubsub.models.MetricSpecification] + :param log_specifications: Specifications of the Logs for Azure Monitoring. + :type log_specifications: list[~azure.mgmt.webpubsub.models.LogSpecification] + """ + + _attribute_map = { + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + } + + def __init__( + self, + *, + metric_specifications: Optional[List["MetricSpecification"]] = None, + log_specifications: Optional[List["LogSpecification"]] = None, + **kwargs + ): + super(ServiceSpecification, self).__init__(**kwargs) + self.metric_specifications = metric_specifications + self.log_specifications = log_specifications + + +class ShareablePrivateLinkResourceProperties(msrest.serialization.Model): + """Describes the properties of a resource type that has been onboarded to private link service. + + :param description: The description of the resource type that has been onboarded to private + link service. + :type description: str + :param group_id: The resource provider group id for the resource that has been onboarded to + private link service. + :type group_id: str + :param type: The resource provider type for the resource that has been onboarded to private + link service. + :type type: str + """ + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'group_id': {'key': 'groupId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + group_id: Optional[str] = None, + type: Optional[str] = None, + **kwargs + ): + super(ShareablePrivateLinkResourceProperties, self).__init__(**kwargs) + self.description = description + self.group_id = group_id + self.type = type + + +class ShareablePrivateLinkResourceType(msrest.serialization.Model): + """Describes a resource type that has been onboarded to private link service. + + :param name: The name of the resource type that has been onboarded to private link service. + :type name: str + :param properties: Describes the properties of a resource type that has been onboarded to + private link service. + :type properties: ~azure.mgmt.webpubsub.models.ShareablePrivateLinkResourceProperties + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ShareablePrivateLinkResourceProperties'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["ShareablePrivateLinkResourceProperties"] = None, + **kwargs + ): + super(ShareablePrivateLinkResourceType, self).__init__(**kwargs) + self.name = name + self.properties = properties + + +class SharedPrivateLinkResource(ProxyResource): + """Describes a Shared Private Link 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.webpubsub.models.SystemData + :param group_id: The group id from the provider of resource the shared private link resource is + for. + :type group_id: str + :param private_link_resource_id: The resource id of the resource the shared private link + resource is for. + :type private_link_resource_id: str + :ivar provisioning_state: Provisioning state of the shared private link resource. Possible + values include: "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", + "Updating", "Deleting", "Moving". + :vartype provisioning_state: str or ~azure.mgmt.webpubsub.models.ProvisioningState + :param request_message: The request message for requesting approval of the shared private link + resource. + :type request_message: str + :ivar status: Status of the shared private link resource. Possible values include: "Pending", + "Approved", "Rejected", "Disconnected", "Timeout". + :vartype status: str or ~azure.mgmt.webpubsub.models.SharedPrivateLinkResourceStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'private_link_resource_id': {'key': 'properties.privateLinkResourceId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'request_message': {'key': 'properties.requestMessage', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + } + + def __init__( + self, + *, + group_id: Optional[str] = None, + private_link_resource_id: Optional[str] = None, + request_message: Optional[str] = None, + **kwargs + ): + super(SharedPrivateLinkResource, self).__init__(**kwargs) + self.system_data = None + self.group_id = group_id + self.private_link_resource_id = private_link_resource_id + self.provisioning_state = None + self.request_message = request_message + self.status = None + + +class SharedPrivateLinkResourceList(msrest.serialization.Model): + """A list of shared private link resources. + + :param value: The list of the shared private link resources. + :type value: list[~azure.mgmt.webpubsub.models.SharedPrivateLinkResource] + :param next_link: Request URL that can be used to query next page of private endpoint + connections. Returned when the total number of requested private endpoint connections exceed + maximum page size. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedPrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SharedPrivateLinkResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SharedPrivateLinkResourceList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SignalRServiceUsage(msrest.serialization.Model): + """Object that describes a specific usage of the resources. + + :param id: Fully qualified ARM resource id. + :type id: str + :param current_value: Current value for the usage quota. + :type current_value: long + :param limit: The maximum permitted value for the usage quota. If there is no limit, this value + will be -1. + :type limit: long + :param name: Localizable String object containing the name and a localized value. + :type name: ~azure.mgmt.webpubsub.models.SignalRServiceUsageName + :param unit: Representing the units of the usage quota. Possible values are: Count, Bytes, + Seconds, Percent, CountPerSecond, BytesPerSecond. + :type unit: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'name': {'key': 'name', 'type': 'SignalRServiceUsageName'}, + 'unit': {'key': 'unit', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + current_value: Optional[int] = None, + limit: Optional[int] = None, + name: Optional["SignalRServiceUsageName"] = None, + unit: Optional[str] = None, + **kwargs + ): + super(SignalRServiceUsage, self).__init__(**kwargs) + self.id = id + self.current_value = current_value + self.limit = limit + self.name = name + self.unit = unit + + +class SignalRServiceUsageList(msrest.serialization.Model): + """Object that includes an array of the resource usages and a possible link for next set. + + :param value: List of the resource usages. + :type value: list[~azure.mgmt.webpubsub.models.SignalRServiceUsage] + :param next_link: The URL the client should use to fetch the next page (per server side + paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SignalRServiceUsage]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SignalRServiceUsage"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SignalRServiceUsageList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SignalRServiceUsageName(msrest.serialization.Model): + """Localizable String object containing the name and a localized value. + + :param value: The identifier of the usage. + :type value: str + :param localized_value: Localized name of the usage. + :type localized_value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[str] = None, + localized_value: Optional[str] = None, + **kwargs + ): + super(SignalRServiceUsageName, self).__init__(**kwargs) + self.value = value + self.localized_value = localized_value + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.webpubsub.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.webpubsub.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". + :vartype type: str + :param location: The GEO location of the resource. e.g. West US | East US | North Central US | + South Central US. + :type location: str + :param tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.location = location + self.tags = tags + + +class UpstreamAuthSettings(msrest.serialization.Model): + """Upstream auth settings. + + :param type: Gets or sets the type of auth. None or ManagedIdentity is supported now. Possible + values include: "None", "ManagedIdentity". + :type type: str or ~azure.mgmt.webpubsub.models.UpstreamAuthType + :param managed_identity: Gets or sets the managed identity settings. It's required if the auth + type is set to ManagedIdentity. + :type managed_identity: ~azure.mgmt.webpubsub.models.ManagedIdentitySettings + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'managed_identity': {'key': 'managedIdentity', 'type': 'ManagedIdentitySettings'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "UpstreamAuthType"]] = None, + managed_identity: Optional["ManagedIdentitySettings"] = None, + **kwargs + ): + super(UpstreamAuthSettings, self).__init__(**kwargs) + self.type = type + self.managed_identity = managed_identity + + +class UserAssignedIdentityProperty(msrest.serialization.Model): + """Properties of user assigned identity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Get the principal id for the user assigned identity. + :vartype principal_id: str + :ivar client_id: Get the client id for the user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserAssignedIdentityProperty, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class WebPubSubFeature(msrest.serialization.Model): + """Feature of a resource, which controls the runtime behavior. + + All required parameters must be populated in order to send to Azure. + + :param flag: Required. FeatureFlags is the supported features of Azure SignalR service. + + + * EnableConnectivityLogs: "true"/"false", to enable/disable the connectivity log category + respectively. + * EnableMessagingLogs: "true"/"false", to enable/disable the connectivity log category + respectively. + * EnableLiveTrace: Live Trace allows you to know what's happening inside Azure SignalR + service, it will give you live traces in real time, it will be helpful when you developing your + own Azure SignalR based web application or self-troubleshooting some issues. Please note that + live traces are counted as outbound messages that will be charged. Values allowed: + "true"/"false", to enable/disable live trace feature. Possible values include: + "EnableConnectivityLogs", "EnableMessagingLogs", "EnableLiveTrace". + :type flag: str or ~azure.mgmt.webpubsub.models.FeatureFlags + :param value: Required. Value of the feature flag. See Azure SignalR service document + https://docs.microsoft.com/azure/azure-signalr/ for allowed values. + :type value: str + :param properties: Optional properties related to this feature. + :type properties: dict[str, str] + """ + + _validation = { + 'flag': {'required': True}, + 'value': {'required': True, 'max_length': 128, 'min_length': 1}, + } + + _attribute_map = { + 'flag': {'key': 'flag', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__( + self, + *, + flag: Union[str, "FeatureFlags"], + value: str, + properties: Optional[Dict[str, str]] = None, + **kwargs + ): + super(WebPubSubFeature, self).__init__(**kwargs) + self.flag = flag + self.value = value + self.properties = properties + + +class WebPubSubKeys(msrest.serialization.Model): + """A class represents the access keys of the resource. + + :param primary_key: The primary access key. + :type primary_key: str + :param secondary_key: The secondary access key. + :type secondary_key: str + :param primary_connection_string: Connection string constructed via the primaryKey. + :type primary_connection_string: str + :param secondary_connection_string: Connection string constructed via the secondaryKey. + :type secondary_connection_string: str + """ + + _attribute_map = { + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, + 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, + } + + def __init__( + self, + *, + primary_key: Optional[str] = None, + secondary_key: Optional[str] = None, + primary_connection_string: Optional[str] = None, + secondary_connection_string: Optional[str] = None, + **kwargs + ): + super(WebPubSubKeys, self).__init__(**kwargs) + self.primary_key = primary_key + self.secondary_key = secondary_key + self.primary_connection_string = primary_connection_string + self.secondary_connection_string = secondary_connection_string + + +class WebPubSubNetworkACLs(msrest.serialization.Model): + """Network ACLs for the resource. + + :param default_action: Default action when no other rule matches. Possible values include: + "Allow", "Deny". + :type default_action: str or ~azure.mgmt.webpubsub.models.ACLAction + :param public_network: ACL for requests from public network. + :type public_network: ~azure.mgmt.webpubsub.models.NetworkACL + :param private_endpoints: ACLs for requests from private endpoints. + :type private_endpoints: list[~azure.mgmt.webpubsub.models.PrivateEndpointACL] + """ + + _attribute_map = { + 'default_action': {'key': 'defaultAction', 'type': 'str'}, + 'public_network': {'key': 'publicNetwork', 'type': 'NetworkACL'}, + 'private_endpoints': {'key': 'privateEndpoints', 'type': '[PrivateEndpointACL]'}, + } + + def __init__( + self, + *, + default_action: Optional[Union[str, "ACLAction"]] = None, + public_network: Optional["NetworkACL"] = None, + private_endpoints: Optional[List["PrivateEndpointACL"]] = None, + **kwargs + ): + super(WebPubSubNetworkACLs, self).__init__(**kwargs) + self.default_action = default_action + self.public_network = public_network + self.private_endpoints = private_endpoints + + +class WebPubSubResource(TrackedResource): + """A class represent a 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". + :vartype type: str + :param location: The GEO location of the resource. e.g. West US | East US | North Central US | + South Central US. + :type location: str + :param tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :type tags: dict[str, str] + :param sku: The billing information of the resource.(e.g. Free, Standard). + :type sku: ~azure.mgmt.webpubsub.models.ResourceSku + :param identity: The managed identity response. + :type identity: ~azure.mgmt.webpubsub.models.ManagedIdentity + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.webpubsub.models.SystemData + :ivar provisioning_state: Provisioning state of the resource. Possible values include: + "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", "Updating", "Deleting", + "Moving". + :vartype provisioning_state: str or ~azure.mgmt.webpubsub.models.ProvisioningState + :ivar external_ip: The publicly accessible IP of the resource. + :vartype external_ip: str + :ivar host_name: FQDN of the service instance. + :vartype host_name: str + :ivar public_port: The publicly accessible port of the resource which is designed for + browser/client side usage. + :vartype public_port: int + :ivar server_port: The publicly accessible port of the resource which is designed for customer + server side usage. + :vartype server_port: int + :ivar version: Version of the resource. Probably you need the same or higher version of client + SDKs. + :vartype version: str + :ivar private_endpoint_connections: Private endpoint connections to the resource. + :vartype private_endpoint_connections: + list[~azure.mgmt.webpubsub.models.PrivateEndpointConnection] + :ivar shared_private_link_resources: The list of shared private link resources. + :vartype shared_private_link_resources: + list[~azure.mgmt.webpubsub.models.SharedPrivateLinkResource] + :param tls: TLS settings. + :type tls: ~azure.mgmt.webpubsub.models.WebPubSubTlsSettings + :param features: List of the featureFlags. + + FeatureFlags that are not included in the parameters for the update operation will not be + modified. + And the response will only include featureFlags that are explicitly set. + When a featureFlag is not explicitly set, its globally default value will be used + But keep in mind, the default value doesn't mean "false". It varies in terms of different + FeatureFlags. + :type features: list[~azure.mgmt.webpubsub.models.WebPubSubFeature] + :param event_handler: The settings for event handler in webpubsub service. + :type event_handler: ~azure.mgmt.webpubsub.models.EventHandlerSettings + :param network_ac_ls: Network ACLs. + :type network_ac_ls: ~azure.mgmt.webpubsub.models.WebPubSubNetworkACLs + :param public_network_access: Enable or disable public network access. Default to "Enabled". + When it's Enabled, network ACLs still apply. + When it's Disabled, public network access is always disabled no matter what you set in network + ACLs. + :type public_network_access: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'external_ip': {'readonly': True}, + 'host_name': {'readonly': True}, + 'public_port': {'readonly': True}, + 'server_port': {'readonly': True}, + 'version': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + 'shared_private_link_resources': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'external_ip': {'key': 'properties.externalIP', 'type': 'str'}, + 'host_name': {'key': 'properties.hostName', 'type': 'str'}, + 'public_port': {'key': 'properties.publicPort', 'type': 'int'}, + 'server_port': {'key': 'properties.serverPort', 'type': 'int'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'shared_private_link_resources': {'key': 'properties.sharedPrivateLinkResources', 'type': '[SharedPrivateLinkResource]'}, + 'tls': {'key': 'properties.tls', 'type': 'WebPubSubTlsSettings'}, + 'features': {'key': 'properties.features', 'type': '[WebPubSubFeature]'}, + 'event_handler': {'key': 'properties.eventHandler', 'type': 'EventHandlerSettings'}, + 'network_ac_ls': {'key': 'properties.networkACLs', 'type': 'WebPubSubNetworkACLs'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["ResourceSku"] = None, + identity: Optional["ManagedIdentity"] = None, + tls: Optional["WebPubSubTlsSettings"] = None, + features: Optional[List["WebPubSubFeature"]] = None, + event_handler: Optional["EventHandlerSettings"] = None, + network_ac_ls: Optional["WebPubSubNetworkACLs"] = None, + public_network_access: Optional[str] = "Enabled", + **kwargs + ): + super(WebPubSubResource, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.identity = identity + self.system_data = None + self.provisioning_state = None + self.external_ip = None + self.host_name = None + self.public_port = None + self.server_port = None + self.version = None + self.private_endpoint_connections = None + self.shared_private_link_resources = None + self.tls = tls + self.features = features + self.event_handler = event_handler + self.network_ac_ls = network_ac_ls + self.public_network_access = public_network_access + + +class WebPubSubResourceList(msrest.serialization.Model): + """Object that includes an array of resources and a possible link for next set. + + :param value: List of the resources. + :type value: list[~azure.mgmt.webpubsub.models.WebPubSubResource] + :param next_link: The URL the client should use to fetch the next page (per server side + paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[WebPubSubResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["WebPubSubResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(WebPubSubResourceList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class WebPubSubTlsSettings(msrest.serialization.Model): + """TLS settings for the resource. + + :param client_cert_enabled: Request client certificate during TLS handshake if enabled. + :type client_cert_enabled: bool + """ + + _attribute_map = { + 'client_cert_enabled': {'key': 'clientCertEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + client_cert_enabled: Optional[bool] = None, + **kwargs + ): + super(WebPubSubTlsSettings, self).__init__(**kwargs) + self.client_cert_enabled = client_cert_enabled diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_web_pub_sub_management_client_enums.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_web_pub_sub_management_client_enums.py new file mode 100644 index 000000000000..c9da1141c856 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_web_pub_sub_management_client_enums.py @@ -0,0 +1,139 @@ +# 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 ACLAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Default action when no other rule matches + """ + + ALLOW = "Allow" + DENY = "Deny" + +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class FeatureFlags(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """FeatureFlags is the supported features of Azure SignalR service. + + + * EnableConnectivityLogs: "true"/"false", to enable/disable the connectivity log category + respectively. + * EnableMessagingLogs: "true"/"false", to enable/disable the connectivity log category + respectively. + * EnableLiveTrace: Live Trace allows you to know what's happening inside Azure SignalR service, + it will give you live traces in real time, it will be helpful when you developing your own + Azure SignalR based web application or self-troubleshooting some issues. Please note that live + traces are counted as outbound messages that will be charged. Values allowed: "true"/"false", + to enable/disable live trace feature. + """ + + ENABLE_CONNECTIVITY_LOGS = "EnableConnectivityLogs" + ENABLE_MESSAGING_LOGS = "EnableMessagingLogs" + ENABLE_LIVE_TRACE = "EnableLiveTrace" + +class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). + """ + + PRIMARY = "Primary" + SECONDARY = "Secondary" + +class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Represent the identity type: systemAssigned, userAssigned, None + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + +class PrivateLinkServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + service. + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the resource. + """ + + UNKNOWN = "Unknown" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + RUNNING = "Running" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + MOVING = "Moving" + +class SharedPrivateLinkResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of the shared private link resource + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + TIMEOUT = "Timeout" + +class UpstreamAuthType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Gets or sets the type of auth. None or ManagedIdentity is supported now. + """ + + NONE = "None" + MANAGED_IDENTITY = "ManagedIdentity" + +class WebPubSubRequestType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Allowed request types. The value can be one or more of: ClientConnection, ServerConnection, + RESTAPI. + """ + + CLIENT_CONNECTION = "ClientConnection" + SERVER_CONNECTION = "ServerConnection" + RESTAPI = "RESTAPI" + TRACE = "Trace" + +class WebPubSubSkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Optional tier of this particular SKU. 'Standard' or 'Free'. + + ``Basic`` is deprecated, use ``Standard`` instead. + """ + + FREE = "Free" + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/__init__.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/__init__.py new file mode 100644 index 000000000000..adcd49212f72 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._web_pub_sub_operations import WebPubSubOperations +from ._usages_operations import UsagesOperations +from ._web_pub_sub_private_endpoint_connections_operations import WebPubSubPrivateEndpointConnectionsOperations +from ._web_pub_sub_private_link_resources_operations import WebPubSubPrivateLinkResourcesOperations +from ._web_pub_sub_shared_private_link_resources_operations import WebPubSubSharedPrivateLinkResourcesOperations + +__all__ = [ + 'Operations', + 'WebPubSubOperations', + 'UsagesOperations', + 'WebPubSubPrivateEndpointConnectionsOperations', + 'WebPubSubPrivateLinkResourcesOperations', + 'WebPubSubSharedPrivateLinkResourcesOperations', +] diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_operations.py new file mode 100644 index 000000000000..64427f6bef1f --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/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: ~azure.mgmt.webpubsub.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"] + """Lists all of the available REST API operations of the Microsoft.SignalRService provider. + + :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[~azure.mgmt.webpubsub.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 = "2021-04-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.SignalRService/operations'} # type: ignore diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_usages_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_usages_operations.py new file mode 100644 index 000000000000..11ad7ba94ed8 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_usages_operations.py @@ -0,0 +1,118 @@ +# 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 UsagesOperations(object): + """UsagesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.webpubsub.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, + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SignalRServiceUsageList"] + """List resource usage quotas by location. + + :param location: the location like "eastus". + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SignalRServiceUsageList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.webpubsub.models.SignalRServiceUsageList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SignalRServiceUsageList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-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 = { + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + 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('SignalRServiceUsageList', 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.SignalRService/locations/{location}/usages'} # type: ignore diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_operations.py new file mode 100644 index 000000000000..582c57d4e186 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_operations.py @@ -0,0 +1,991 @@ +# 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 WebPubSubOperations(object): + """WebPubSubOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.webpubsub.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 check_name_availability( + self, + location, # type: str + parameters, # type: "_models.NameAvailabilityParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.NameAvailability" + """Checks that the resource name is valid and is not already in use. + + :param location: the region. + :type location: str + :param parameters: Parameters supplied to the operation. + :type parameters: ~azure.mgmt.webpubsub.models.NameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.webpubsub.models.NameAvailability + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailability"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + 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, 'NameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(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('NameAvailability', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/checkNameAvailability'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.WebPubSubResourceList"] + """Handles requests to list all resources in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WebPubSubResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.webpubsub.models.WebPubSubResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WebPubSubResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-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'), + } + 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('WebPubSubResourceList', 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.SignalRService/webPubSub'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.WebPubSubResourceList"] + """Handles requests to list all resources in a resource group. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :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 WebPubSubResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.webpubsub.models.WebPubSubResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WebPubSubResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + 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('WebPubSubResourceList', 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.SignalRService/webPubSub'} # type: ignore + + def get( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.WebPubSubResource" + """Get the resource and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebPubSubResource, or the result of cls(response) + :rtype: ~azure.mgmt.webpubsub.models.WebPubSubResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WebPubSubResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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('WebPubSubResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + parameters, # type: "_models.WebPubSubResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.WebPubSubResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WebPubSubResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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, 'WebPubSubResource') + 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, 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) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WebPubSubResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('WebPubSubResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + resource_name, # type: str + parameters, # type: "_models.WebPubSubResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.WebPubSubResource"] + """Create or update a resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :param parameters: Parameters for the create or update operation. + :type parameters: ~azure.mgmt.webpubsub.models.WebPubSubResource + :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 WebPubSubResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.webpubsub.models.WebPubSubResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WebPubSubResource"] + 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, + resource_name=resource_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WebPubSubResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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.SignalRService/webPubSub/{resourceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Operation to delete a resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: 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, + resource_name=resource_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + parameters, # type: "_models.WebPubSubResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.WebPubSubResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WebPubSubResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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, 'WebPubSubResource') + 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, 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) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WebPubSubResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + resource_name, # type: str + parameters, # type: "_models.WebPubSubResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.WebPubSubResource"] + """Operation to update an exiting resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :param parameters: Parameters for the update operation. + :type parameters: ~azure.mgmt.webpubsub.models.WebPubSubResource + :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 WebPubSubResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.webpubsub.models.WebPubSubResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WebPubSubResource"] + 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._update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WebPubSubResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.WebPubSubKeys" + """Get the access keys of the resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WebPubSubKeys, or the result of cls(response) + :rtype: ~azure.mgmt.webpubsub.models.WebPubSubKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WebPubSubKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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('WebPubSubKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/listKeys'} # type: ignore + + def _regenerate_key_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + parameters, # type: "_models.RegenerateKeyParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.WebPubSubKeys" + cls = kwargs.pop('cls', None) # type: ClsType["_models.WebPubSubKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._regenerate_key_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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, 'RegenerateKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(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 [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) + + deserialized = self._deserialize('WebPubSubKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _regenerate_key_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/regenerateKey'} # type: ignore + + def begin_regenerate_key( + self, + resource_group_name, # type: str + resource_name, # type: str + parameters, # type: "_models.RegenerateKeyParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.WebPubSubKeys"] + """Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated + at the same time. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :param parameters: Parameter that describes the Regenerate Key Operation. + :type parameters: ~azure.mgmt.webpubsub.models.RegenerateKeyParameters + :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 WebPubSubKeys or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.webpubsub.models.WebPubSubKeys] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WebPubSubKeys"] + 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._regenerate_key_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WebPubSubKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + 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_regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/regenerateKey'} # type: ignore + + def _restart_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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 [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, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/restart'} # type: ignore + + def begin_restart( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Operation to restart a resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: 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( + resource_group_name=resource_group_name, + resource_name=resource_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + 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_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/restart'} # type: ignore diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_endpoint_connections_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..c5c64a5ce78d --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_endpoint_connections_operations.py @@ -0,0 +1,382 @@ +# 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 WebPubSubPrivateEndpointConnectionsOperations(object): + """WebPubSubPrivateEndpointConnectionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.webpubsub.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, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PrivateEndpointConnectionList"] + """List private endpoint connections. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.webpubsub.models.PrivateEndpointConnectionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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('PrivateEndpointConnectionList', 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections'} # type: ignore + + def get( + self, + private_endpoint_connection_name, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnection" + """Get the specified private endpoint connection. + + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.webpubsub.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def update( + self, + private_endpoint_connection_name, # type: str + resource_group_name, # type: str + resource_name, # type: str + parameters, # type: "_models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnection" + """Update the state of specified private endpoint connection. + + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :param parameters: The resource of private endpoint and its properties. + :type parameters: ~azure.mgmt.webpubsub.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.webpubsub.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def _delete_initial( + self, + private_endpoint_connection_name, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def begin_delete( + self, + private_endpoint_connection_name, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete the specified private endpoint connection. + + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: 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( + private_endpoint_connection_name=private_endpoint_connection_name, + resource_group_name=resource_group_name, + resource_name=resource_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_link_resources_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_link_resources_operations.py new file mode 100644 index 000000000000..a4ba2bff4eeb --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_link_resources_operations.py @@ -0,0 +1,123 @@ +# 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 WebPubSubPrivateLinkResourcesOperations(object): + """WebPubSubPrivateLinkResourcesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.webpubsub.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, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PrivateLinkResourceList"] + """Get the private link resources that need to be created for a resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateLinkResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.webpubsub.models.PrivateLinkResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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('PrivateLinkResourceList', 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateLinkResources'} # type: ignore diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_shared_private_link_resources_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_shared_private_link_resources_operations.py new file mode 100644 index 000000000000..403ef3945665 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_shared_private_link_resources_operations.py @@ -0,0 +1,448 @@ +# 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 WebPubSubSharedPrivateLinkResourcesOperations(object): + """WebPubSubSharedPrivateLinkResourcesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.webpubsub.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, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SharedPrivateLinkResourceList"] + """List shared private link resources. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedPrivateLinkResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.webpubsub.models.SharedPrivateLinkResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedPrivateLinkResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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('SharedPrivateLinkResourceList', 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources'} # type: ignore + + def get( + self, + shared_private_link_resource_name, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedPrivateLinkResource" + """Get the specified shared private link resource. + + :param shared_private_link_resource_name: The name of the shared private link resource. + :type shared_private_link_resource_name: str + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedPrivateLinkResource, or the result of cls(response) + :rtype: ~azure.mgmt.webpubsub.models.SharedPrivateLinkResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedPrivateLinkResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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('SharedPrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + def _create_or_update_initial( + self, + shared_private_link_resource_name, # type: str + resource_group_name, # type: str + resource_name, # type: str + parameters, # type: "_models.SharedPrivateLinkResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedPrivateLinkResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedPrivateLinkResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-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 = { + 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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, 'SharedPrivateLinkResource') + 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('SharedPrivateLinkResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SharedPrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + def begin_create_or_update( + self, + shared_private_link_resource_name, # type: str + resource_group_name, # type: str + resource_name, # type: str + parameters, # type: "_models.SharedPrivateLinkResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.SharedPrivateLinkResource"] + """Create or update a shared private link resource. + + :param shared_private_link_resource_name: The name of the shared private link resource. + :type shared_private_link_resource_name: str + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :param parameters: The shared private link resource. + :type parameters: ~azure.mgmt.webpubsub.models.SharedPrivateLinkResource + :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 SharedPrivateLinkResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.webpubsub.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedPrivateLinkResource"] + 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( + shared_private_link_resource_name=shared_private_link_resource_name, + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SharedPrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + def _delete_initial( + self, + shared_private_link_resource_name, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + 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.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore + + def begin_delete( + self, + shared_private_link_resource_name, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete the specified shared private link resource. + + :param shared_private_link_resource_name: The name of the shared private link resource. + :type shared_private_link_resource_name: str + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: 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( + shared_private_link_resource_name=shared_private_link_resource_name, + resource_group_name=resource_group_name, + resource_name=resource_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'sharedPrivateLinkResourceName': self._serialize.url("shared_private_link_resource_name", shared_private_link_resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}'} # type: ignore diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/py.typed b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/sdk_packaging.toml b/sdk/webpubsub/azure-mgmt-webpubsub/sdk_packaging.toml new file mode 100644 index 000000000000..7017e846c504 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/sdk_packaging.toml @@ -0,0 +1,8 @@ +[packaging] +package_name = "azure-mgmt-webpubsub" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "Webpubsub Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = true diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/setup.cfg b/sdk/webpubsub/azure-mgmt-webpubsub/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/setup.py b/sdk/webpubsub/azure-mgmt-webpubsub/setup.py new file mode 100644 index 000000000000..da710e439fff --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/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-webpubsub" +PACKAGE_PPRINT_NAME = "Webpubsub 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/webpubsub/ci.yml b/sdk/webpubsub/ci.yml new file mode 100644 index 000000000000..c1f52dcd6619 --- /dev/null +++ b/sdk/webpubsub/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/webpubsub/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/webpubsub/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: webpubsub + Artifacts: + - name: azure-mgmt-webpubsub + safeName: azuremgmtwebpubsub diff --git a/shared_requirements.txt b/shared_requirements.txt index 1c0d9cfa6e1d..36b6d8e1cc4d 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -244,6 +244,7 @@ opentelemetry-sdk<2.0.0,>=1.0.0 #override azure-mgmt-databoxedge msrest>=0.6.21 #override azure-mgmt-hybridcompute msrest>=0.6.21 #override azure-mgmt-reservations msrest>=0.6.21 +#override azure-mgmt-webpubsub msrest>=0.6.21 #override azure-mgmt-keyvault msrest>=0.6.21 #override azure-mgmt-resource msrest>=0.6.21 -#override azure-template azure-core<2.0.0,>=1.10.0 +#override azure-template azure-core<2.0.0,>=1.10.0 \ No newline at end of file