From 368cd6b7c32c04d5f29d93ad04c7398f7849dc22 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 16 Jul 2021 01:44:52 +0000 Subject: [PATCH] CodeGen from PR 15048 in Azure/azure-rest-api-specs Merge 15238cf7626f0a4c76d5e682845e5b1559d52f74 into 7026463801584950d4ccbaa6b05b15d29555dd3a --- .../CHANGELOG.md | 5 + .../MANIFEST.in | 6 + .../README.md | 27 + .../_meta.json | 8 + .../azure/__init__.py | 1 + .../azure/messaging/__init__.py | 1 + .../messaging/webpubsubservice/__init__.py | 19 + ...re_messaging_web_pub_sub_service_client.py | 49 + .../webpubsubservice/_configuration.py | 36 + ...saging_web_pub_sub_service_client_enums.py | 18 + .../webpubsubservice/operations/__init__.py | 18 + .../operations/_health_api_operations.py | 74 ++ .../operations/_web_pub_sub_operations.py | 937 ++++++++++++++++++ .../messaging/webpubsubservice/version.py | 13 + .../sdk_packaging.toml | 8 + .../setup.cfg | 2 + .../azure-messaging-webpubsubservice/setup.py | 91 ++ sdk/webpubsub/ci.yml | 35 + 18 files changed, 1348 insertions(+) create mode 100644 sdk/webpubsub/azure-messaging-webpubsubservice/CHANGELOG.md create mode 100644 sdk/webpubsub/azure-messaging-webpubsubservice/MANIFEST.in create mode 100644 sdk/webpubsub/azure-messaging-webpubsubservice/README.md create mode 100644 sdk/webpubsub/azure-messaging-webpubsubservice/_meta.json create mode 100644 sdk/webpubsub/azure-messaging-webpubsubservice/azure/__init__.py create mode 100644 sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/__init__.py create mode 100644 sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/__init__.py create mode 100644 sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_azure_messaging_web_pub_sub_service_client.py create mode 100644 sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_configuration.py create mode 100644 sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/models/_azure_messaging_web_pub_sub_service_client_enums.py create mode 100644 sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/operations/__init__.py create mode 100644 sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/operations/_health_api_operations.py create mode 100644 sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/operations/_web_pub_sub_operations.py create mode 100644 sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/version.py create mode 100644 sdk/webpubsub/azure-messaging-webpubsubservice/sdk_packaging.toml create mode 100644 sdk/webpubsub/azure-messaging-webpubsubservice/setup.cfg create mode 100644 sdk/webpubsub/azure-messaging-webpubsubservice/setup.py create mode 100644 sdk/webpubsub/ci.yml diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/CHANGELOG.md b/sdk/webpubsub/azure-messaging-webpubsubservice/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/MANIFEST.in b/sdk/webpubsub/azure-messaging-webpubsubservice/MANIFEST.in new file mode 100644 index 000000000000..0dc0a455b6da --- /dev/null +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/MANIFEST.in @@ -0,0 +1,6 @@ +include _meta.json +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/messaging/__init__.py + diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/README.md b/sdk/webpubsub/azure-messaging-webpubsubservice/README.md new file mode 100644 index 000000000000..04f78efb5acd --- /dev/null +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/README.md @@ -0,0 +1,27 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService 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 [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-messaging-webpubsubservice%2FREADME.png) diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/_meta.json b/sdk/webpubsub/azure-messaging-webpubsubservice/_meta.json new file mode 100644 index 000000000000..c966c7636d3d --- /dev/null +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/_meta.json @@ -0,0 +1,8 @@ +{ + "autorest": "V2", + "use": "@microsoft.azure/autorest.python@~4.0.71", + "commit": "8b5c4cad689cd8b75d0c145aa973bd8bc66f56c1", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/webpubsub/data-plane/readme.md --keep-version-file --multiapi --no-async --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --use=@microsoft.azure/autorest.python@~4.0.71 --version=V2", + "readme": "specification/webpubsub/data-plane/readme.md" +} \ No newline at end of file diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/__init__.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/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-messaging-webpubsubservice/azure/messaging/__init__.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/__init__.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/__init__.py new file mode 100644 index 000000000000..b16e0167cbd2 --- /dev/null +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/__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 ._configuration import AzureMessagingWebPubSubServiceClientConfiguration +from ._azure_messaging_web_pub_sub_service_client import AzureMessagingWebPubSubServiceClient +__all__ = ['AzureMessagingWebPubSubServiceClient', 'AzureMessagingWebPubSubServiceClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_azure_messaging_web_pub_sub_service_client.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_azure_messaging_web_pub_sub_service_client.py new file mode 100644 index 000000000000..5820955893fd --- /dev/null +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_azure_messaging_web_pub_sub_service_client.py @@ -0,0 +1,49 @@ +# 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 msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import AzureMessagingWebPubSubServiceClientConfiguration +from msrest.exceptions import HttpOperationError +from .operations import HealthApiOperations +from .operations import WebPubSubOperations + + +class AzureMessagingWebPubSubServiceClient(SDKClient): + """AzureMessagingWebPubSubServiceClient + + :ivar config: Configuration for client. + :vartype config: AzureMessagingWebPubSubServiceClientConfiguration + + :ivar health_api: HealthApi operations + :vartype health_api: azure.messaging.webpubsub.operations.HealthApiOperations + :ivar web_pub_sub: WebPubSub operations + :vartype web_pub_sub: azure.messaging.webpubsub.operations.WebPubSubOperations + + :param str base_url: Service URL + """ + + def __init__( + self, base_url=None): + + self.config = AzureMessagingWebPubSubServiceClientConfiguration(base_url) + super(AzureMessagingWebPubSubServiceClient, self).__init__(None, self.config) + + client_models = {} + self.api_version = '2021-05-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.health_api = HealthApiOperations( + self._client, self.config, self._serialize, self._deserialize) + self.web_pub_sub = WebPubSubOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_configuration.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_configuration.py new file mode 100644 index 000000000000..abdb3cdd6dc3 --- /dev/null +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_configuration.py @@ -0,0 +1,36 @@ +# 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 msrest import Configuration + +from .version import VERSION + + +class AzureMessagingWebPubSubServiceClientConfiguration(Configuration): + """Configuration for AzureMessagingWebPubSubServiceClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param str base_url: Service URL + """ + + def __init__( + self, base_url=None): + + if not base_url: + base_url = 'http://localhost' + + super(AzureMessagingWebPubSubServiceClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-messaging-webpubsubservice/{}'.format(VERSION)) diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/models/_azure_messaging_web_pub_sub_service_client_enums.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/models/_azure_messaging_web_pub_sub_service_client_enums.py new file mode 100644 index 000000000000..6ed1e7975365 --- /dev/null +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/models/_azure_messaging_web_pub_sub_service_client_enums.py @@ -0,0 +1,18 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class WebPubSubPermission(str, Enum): + + send_to_group = "sendToGroup" + join_leave_group = "joinLeaveGroup" diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/operations/__init__.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/operations/__init__.py new file mode 100644 index 000000000000..bb134d9292ac --- /dev/null +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/operations/__init__.py @@ -0,0 +1,18 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._health_api_operations import HealthApiOperations +from ._web_pub_sub_operations import WebPubSubOperations + +__all__ = [ + 'HealthApiOperations', + 'WebPubSubOperations', +] diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/operations/_health_api_operations.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/operations/_health_api_operations.py new file mode 100644 index 000000000000..1542a8a21222 --- /dev/null +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/operations/_health_api_operations.py @@ -0,0 +1,74 @@ +# 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 msrest.pipeline import ClientRawResponse +from msrest.exceptions import HttpOperationError + + +class HealthApiOperations(object): + """HealthApiOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def get_service_status( + self, api_version="2021-05-01-preview", custom_headers=None, raw=False, **operation_config): + """Get service health status. + + :param api_version: The version of the REST APIs. + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + # Construct URL + url = self.get_service_status.metadata['url'] + + # Construct parameters + query_parameters = {} + if api_version is not None: + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.head(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise HttpOperationError(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + get_service_status.metadata = {'url': '/api/health'} diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/operations/_web_pub_sub_operations.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/operations/_web_pub_sub_operations.py new file mode 100644 index 000000000000..a0f02362cf49 --- /dev/null +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/operations/_web_pub_sub_operations.py @@ -0,0 +1,937 @@ +# 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 msrest.pipeline import ClientRawResponse +from msrest.exceptions import HttpOperationError + + +class WebPubSubOperations(object): + """WebPubSubOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def send_to_all( + self, hub, message, excluded=None, api_version="2021-05-01-preview", custom_headers=None, raw=False, **operation_config): + """Broadcast content inside request body to all the connected client + connections. + + :param hub: Target hub name, which should start with alphabetic + characters and only contain alpha-numeric characters or underscore. + :type hub: str + :param message: The payload body. + :type message: str + :param excluded: Excluded connection Ids. + :type excluded: list[str] + :param api_version: The version of the REST APIs. + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + # Construct URL + url = self.send_to_all.metadata['url'] + path_format_arguments = { + 'hub': self._serialize.url("hub", hub, 'str', pattern=r'^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if excluded is not None: + query_parameters['excluded'] = self._serialize.query("excluded", excluded, '[str]', div=',') + if api_version is not None: + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(message, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202]: + raise HttpOperationError(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + send_to_all.metadata = {'url': '/api/hubs/{hub}/:send'} + + def connection_exists( + self, hub, connection_id, api_version="2021-05-01-preview", custom_headers=None, raw=False, **operation_config): + """Check if the connection with the given connectionId exists. + + :param hub: Target hub name, which should start with alphabetic + characters and only contain alpha-numeric characters or underscore. + :type hub: str + :param connection_id: The connection Id. + :type connection_id: str + :param api_version: The version of the REST APIs. + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + # Construct URL + url = self.connection_exists.metadata['url'] + path_format_arguments = { + 'hub': self._serialize.url("hub", hub, 'str', pattern=r'^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$'), + 'connectionId': self._serialize.url("connection_id", connection_id, 'str', min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if api_version is not None: + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.head(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 404]: + raise HttpOperationError(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + connection_exists.metadata = {'url': '/api/hubs/{hub}/connections/{connectionId}'} + + def close_connection( + self, hub, connection_id, reason=None, api_version="2021-05-01-preview", custom_headers=None, raw=False, **operation_config): + """Close the client connection. + + :param hub: Target hub name, which should start with alphabetic + characters and only contain alpha-numeric characters or underscore. + :type hub: str + :param connection_id: Target connection Id. + :type connection_id: str + :param reason: The reason closing the client connection. + :type reason: str + :param api_version: The version of the REST APIs. + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + # Construct URL + url = self.close_connection.metadata['url'] + path_format_arguments = { + 'hub': self._serialize.url("hub", hub, 'str', pattern=r'^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$'), + 'connectionId': self._serialize.url("connection_id", connection_id, 'str', min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if reason is not None: + query_parameters['reason'] = self._serialize.query("reason", reason, 'str') + if api_version is not None: + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise HttpOperationError(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + close_connection.metadata = {'url': '/api/hubs/{hub}/connections/{connectionId}'} + + def send_to_connection( + self, hub, connection_id, message, api_version="2021-05-01-preview", custom_headers=None, raw=False, **operation_config): + """Send content inside request body to the specific connection. + + :param hub: Target hub name, which should start with alphabetic + characters and only contain alpha-numeric characters or underscore. + :type hub: str + :param connection_id: The connection Id. + :type connection_id: str + :param message: The payload body. + :type message: str + :param api_version: The version of the REST APIs. + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + # Construct URL + url = self.send_to_connection.metadata['url'] + path_format_arguments = { + 'hub': self._serialize.url("hub", hub, 'str', pattern=r'^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$'), + 'connectionId': self._serialize.url("connection_id", connection_id, 'str', min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if api_version is not None: + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(message, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202]: + raise HttpOperationError(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + send_to_connection.metadata = {'url': '/api/hubs/{hub}/connections/{connectionId}/:send'} + + def group_exists( + self, hub, group, api_version="2021-05-01-preview", custom_headers=None, raw=False, **operation_config): + """Check if there are any client connections inside the given group. + + :param hub: Target hub name, which should start with alphabetic + characters and only contain alpha-numeric characters or underscore. + :type hub: str + :param group: Target group name, which length should be greater than 0 + and less than 1025. + :type group: str + :param api_version: The version of the REST APIs. + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + # Construct URL + url = self.group_exists.metadata['url'] + path_format_arguments = { + 'hub': self._serialize.url("hub", hub, 'str', pattern=r'^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$'), + 'group': self._serialize.url("group", group, 'str', max_length=1024, min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if api_version is not None: + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.head(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 404]: + raise HttpOperationError(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + group_exists.metadata = {'url': '/api/hubs/{hub}/groups/{group}'} + + def send_to_group( + self, hub, group, message, excluded=None, api_version="2021-05-01-preview", custom_headers=None, raw=False, **operation_config): + """Send content inside request body to a group of connections. + + :param hub: Target hub name, which should start with alphabetic + characters and only contain alpha-numeric characters or underscore. + :type hub: str + :param group: Target group name, which length should be greater than 0 + and less than 1025. + :type group: str + :param message: The payload body. + :type message: str + :param excluded: Excluded connection Ids + :type excluded: list[str] + :param api_version: The version of the REST APIs. + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + # Construct URL + url = self.send_to_group.metadata['url'] + path_format_arguments = { + 'hub': self._serialize.url("hub", hub, 'str', pattern=r'^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$'), + 'group': self._serialize.url("group", group, 'str', max_length=1024, min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if excluded is not None: + query_parameters['excluded'] = self._serialize.query("excluded", excluded, '[str]', div=',') + if api_version is not None: + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(message, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202]: + raise HttpOperationError(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + send_to_group.metadata = {'url': '/api/hubs/{hub}/groups/{group}/:send'} + + def add_connection_to_group( + self, hub, group, connection_id, api_version="2021-05-01-preview", custom_headers=None, raw=False, **operation_config): + """Add a connection to the target group. + + :param hub: Target hub name, which should start with alphabetic + characters and only contain alpha-numeric characters or underscore. + :type hub: str + :param group: Target group name, which length should be greater than 0 + and less than 1025. + :type group: str + :param connection_id: Target connection Id + :type connection_id: str + :param api_version: The version of the REST APIs. + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + # Construct URL + url = self.add_connection_to_group.metadata['url'] + path_format_arguments = { + 'hub': self._serialize.url("hub", hub, 'str', pattern=r'^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$'), + 'group': self._serialize.url("group", group, 'str', max_length=1024, min_length=1), + 'connectionId': self._serialize.url("connection_id", connection_id, 'str', min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if api_version is not None: + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 404]: + raise HttpOperationError(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + add_connection_to_group.metadata = {'url': '/api/hubs/{hub}/groups/{group}/connections/{connectionId}'} + + def remove_connection_from_group( + self, hub, group, connection_id, api_version="2021-05-01-preview", custom_headers=None, raw=False, **operation_config): + """Remove a connection from the target group. + + :param hub: Target hub name, which should start with alphabetic + characters and only contain alpha-numeric characters or underscore. + :type hub: str + :param group: Target group name, which length should be greater than 0 + and less than 1025. + :type group: str + :param connection_id: Target connection Id. + :type connection_id: str + :param api_version: The version of the REST APIs. + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + # Construct URL + url = self.remove_connection_from_group.metadata['url'] + path_format_arguments = { + 'hub': self._serialize.url("hub", hub, 'str', pattern=r'^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$'), + 'group': self._serialize.url("group", group, 'str', max_length=1024, min_length=1), + 'connectionId': self._serialize.url("connection_id", connection_id, 'str', min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if api_version is not None: + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise HttpOperationError(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + remove_connection_from_group.metadata = {'url': '/api/hubs/{hub}/groups/{group}/connections/{connectionId}'} + + def user_exists( + self, hub, user_id, api_version="2021-05-01-preview", custom_headers=None, raw=False, **operation_config): + """Check if there are any client connections connected for the given user. + + :param hub: Target hub name, which should start with alphabetic + characters and only contain alpha-numeric characters or underscore. + :type hub: str + :param user_id: Target user Id. + :type user_id: str + :param api_version: The version of the REST APIs. + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + # Construct URL + url = self.user_exists.metadata['url'] + path_format_arguments = { + 'hub': self._serialize.url("hub", hub, 'str', pattern=r'^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$'), + 'userId': self._serialize.url("user_id", user_id, 'str', min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if api_version is not None: + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.head(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 404]: + raise HttpOperationError(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + user_exists.metadata = {'url': '/api/hubs/{hub}/users/{userId}'} + + def send_to_user( + self, hub, user_id, message, api_version="2021-05-01-preview", custom_headers=None, raw=False, **operation_config): + """Send content inside request body to the specific user. + + :param hub: Target hub name, which should start with alphabetic + characters and only contain alpha-numeric characters or underscore. + :type hub: str + :param user_id: The user Id. + :type user_id: str + :param message: The payload body. + :type message: str + :param api_version: The version of the REST APIs. + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + # Construct URL + url = self.send_to_user.metadata['url'] + path_format_arguments = { + 'hub': self._serialize.url("hub", hub, 'str', pattern=r'^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$'), + 'userId': self._serialize.url("user_id", user_id, 'str', min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if api_version is not None: + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(message, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202]: + raise HttpOperationError(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + send_to_user.metadata = {'url': '/api/hubs/{hub}/users/{userId}/:send'} + + def add_user_to_group( + self, hub, group, user_id, api_version="2021-05-01-preview", custom_headers=None, raw=False, **operation_config): + """Add a user to the target group. + + :param hub: Target hub name, which should start with alphabetic + characters and only contain alpha-numeric characters or underscore. + :type hub: str + :param group: Target group name, which length should be greater than 0 + and less than 1025. + :type group: str + :param user_id: Target user Id. + :type user_id: str + :param api_version: The version of the REST APIs. + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + # Construct URL + url = self.add_user_to_group.metadata['url'] + path_format_arguments = { + 'hub': self._serialize.url("hub", hub, 'str', pattern=r'^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$'), + 'group': self._serialize.url("group", group, 'str', max_length=1024, min_length=1), + 'userId': self._serialize.url("user_id", user_id, 'str', min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if api_version is not None: + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 404]: + raise HttpOperationError(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + add_user_to_group.metadata = {'url': '/api/hubs/{hub}/users/{userId}/groups/{group}'} + + def remove_user_from_group( + self, hub, group, user_id, api_version="2021-05-01-preview", custom_headers=None, raw=False, **operation_config): + """Remove a user from the target group. + + :param hub: Target hub name, which should start with alphabetic + characters and only contain alpha-numeric characters or underscore. + :type hub: str + :param group: Target group name, which length should be greater than 0 + and less than 1025. + :type group: str + :param user_id: Target user Id. + :type user_id: str + :param api_version: The version of the REST APIs. + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + # Construct URL + url = self.remove_user_from_group.metadata['url'] + path_format_arguments = { + 'hub': self._serialize.url("hub", hub, 'str', pattern=r'^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$'), + 'group': self._serialize.url("group", group, 'str', max_length=1024, min_length=1), + 'userId': self._serialize.url("user_id", user_id, 'str', min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if api_version is not None: + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise HttpOperationError(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + remove_user_from_group.metadata = {'url': '/api/hubs/{hub}/users/{userId}/groups/{group}'} + + def remove_user_from_all_groups( + self, hub, user_id, api_version="2021-05-01-preview", custom_headers=None, raw=False, **operation_config): + """Remove a user from all groups. + + :param hub: Target hub name, which should start with alphabetic + characters and only contain alpha-numeric characters or underscore. + :type hub: str + :param user_id: Target user Id. + :type user_id: str + :param api_version: The version of the REST APIs. + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + # Construct URL + url = self.remove_user_from_all_groups.metadata['url'] + path_format_arguments = { + 'hub': self._serialize.url("hub", hub, 'str', pattern=r'^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$'), + 'userId': self._serialize.url("user_id", user_id, 'str', min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if api_version is not None: + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise HttpOperationError(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + remove_user_from_all_groups.metadata = {'url': '/api/hubs/{hub}/users/{userId}/groups'} + + def grant_permission( + self, hub, permission, connection_id, target_name=None, api_version="2021-05-01-preview", custom_headers=None, raw=False, **operation_config): + """Grant permission to the connection. + + :param hub: Target hub name, which should start with alphabetic + characters and only contain alpha-numeric characters or underscore. + :type hub: str + :param permission: The permission: current supported actions are + joinLeaveGroup and sendToGroup. Possible values include: + 'sendToGroup', 'joinLeaveGroup' + :type permission: str or + ~azure.messaging.webpubsub.models.WebPubSubPermission + :param connection_id: Target connection Id. + :type connection_id: str + :param target_name: The meaning of the target depends on the specific + permission. For joinLeaveGroup and sendToGroup, targetName is a + required parameter standing for the group name. + :type target_name: str + :param api_version: The version of the REST APIs. + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + # Construct URL + url = self.grant_permission.metadata['url'] + path_format_arguments = { + 'hub': self._serialize.url("hub", hub, 'str', pattern=r'^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$'), + 'permission': self._serialize.url("permission", permission, 'str'), + 'connectionId': self._serialize.url("connection_id", connection_id, 'str', min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if target_name is not None: + query_parameters['targetName'] = self._serialize.query("target_name", target_name, 'str') + if api_version is not None: + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise HttpOperationError(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + grant_permission.metadata = {'url': '/api/hubs/{hub}/permissions/{permission}/connections/{connectionId}'} + + def revoke_permission( + self, hub, permission, connection_id, target_name=None, api_version="2021-05-01-preview", custom_headers=None, raw=False, **operation_config): + """Revoke permission for the connection. + + :param hub: Target hub name, which should start with alphabetic + characters and only contain alpha-numeric characters or underscore. + :type hub: str + :param permission: The permission: current supported actions are + joinLeaveGroup and sendToGroup. Possible values include: + 'sendToGroup', 'joinLeaveGroup' + :type permission: str or + ~azure.messaging.webpubsub.models.WebPubSubPermission + :param connection_id: Target connection Id. + :type connection_id: str + :param target_name: The meaning of the target depends on the specific + permission. For joinLeaveGroup and sendToGroup, targetName is a + required parameter standing for the group name. + :type target_name: str + :param api_version: The version of the REST APIs. + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + # Construct URL + url = self.revoke_permission.metadata['url'] + path_format_arguments = { + 'hub': self._serialize.url("hub", hub, 'str', pattern=r'^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$'), + 'permission': self._serialize.url("permission", permission, 'str'), + 'connectionId': self._serialize.url("connection_id", connection_id, 'str', min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if target_name is not None: + query_parameters['targetName'] = self._serialize.query("target_name", target_name, 'str') + if api_version is not None: + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise HttpOperationError(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + revoke_permission.metadata = {'url': '/api/hubs/{hub}/permissions/{permission}/connections/{connectionId}'} + + def check_permission( + self, hub, permission, connection_id, target_name=None, api_version="2021-05-01-preview", custom_headers=None, raw=False, **operation_config): + """Check if a connection has permission to the specified action. + + :param hub: Target hub name, which should start with alphabetic + characters and only contain alpha-numeric characters or underscore. + :type hub: str + :param permission: The permission: current supported actions are + joinLeaveGroup and sendToGroup. Possible values include: + 'sendToGroup', 'joinLeaveGroup' + :type permission: str or + ~azure.messaging.webpubsub.models.WebPubSubPermission + :param connection_id: Target connection Id. + :type connection_id: str + :param target_name: The meaning of the target depends on the specific + permission. For joinLeaveGroup and sendToGroup, targetName is a + required parameter standing for the group name. + :type target_name: str + :param api_version: The version of the REST APIs. + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + # Construct URL + url = self.check_permission.metadata['url'] + path_format_arguments = { + 'hub': self._serialize.url("hub", hub, 'str', pattern=r'^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$'), + 'permission': self._serialize.url("permission", permission, 'str'), + 'connectionId': self._serialize.url("connection_id", connection_id, 'str', min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if target_name is not None: + query_parameters['targetName'] = self._serialize.query("target_name", target_name, 'str') + if api_version is not None: + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.head(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 404]: + raise HttpOperationError(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + check_permission.metadata = {'url': '/api/hubs/{hub}/permissions/{permission}/connections/{connectionId}'} diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/version.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/version.py new file mode 100644 index 000000000000..affaef0c987e --- /dev/null +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/version.py @@ -0,0 +1,13 @@ +# 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-messaging-webpubsubservice/sdk_packaging.toml b/sdk/webpubsub/azure-messaging-webpubsubservice/sdk_packaging.toml new file mode 100644 index 000000000000..018bb902146b --- /dev/null +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/sdk_packaging.toml @@ -0,0 +1,8 @@ +[packaging] +package_name = "azure-messaging-webpubsubservice" +package_nspkg = "azure-messaging-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = true diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/setup.cfg b/sdk/webpubsub/azure-messaging-webpubsubservice/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/setup.py b/sdk/webpubsub/azure-messaging-webpubsubservice/setup.py new file mode 100644 index 000000000000..c493b1577a2e --- /dev/null +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/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-messaging-webpubsubservice" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# 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.messaging', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'msrestazure>=0.4.32,<2.0.0', + 'azure-common~=1.1', + ], + extras_require={ + ":python_version<'3.0'": ['azure-messaging-nspkg'], + } +) diff --git a/sdk/webpubsub/ci.yml b/sdk/webpubsub/ci.yml new file mode 100644 index 000000000000..ba6b99237b6b --- /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/messaging-webpubsubservice/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/messaging-webpubsubservice/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: messaging-webpubsubservice + Artifacts: + - name: azure-mgmt-messaging-webpubsubservice + safeName: azuremgmtmessaging-webpubsubservice