diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/CHANGELOG.md b/sdk/notificationhubs/azure-mgmt-notificationhubs/CHANGELOG.md index eced27d4e723..3ae724805042 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/CHANGELOG.md +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 8.0.0 (2022-01-05) + +**Breaking changes** + + - Return type of `list_keys` in `NamespacesOperions` changed from `SharedAccessAuthorizationRuleListResult` to `ResourceListKeys` + ## 7.0.0 (2020-12-22) - GA release diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/_meta.json b/sdk/notificationhubs/azure-mgmt-notificationhubs/_meta.json new file mode 100644 index 000000000000..bd28568e9b05 --- /dev/null +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.7.2", + "use": [ + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" + ], + "commit": "d92d7a99548a48491f2dcccb2d9c2774ae98725a", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/notificationhubs/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.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "readme": "specification/notificationhubs/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/__init__.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/__init__.py index 68c38ee6818c..72e8272f6b4a 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/__init__.py +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['NotificationHubsManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_configuration.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_configuration.py index fe5cab0929fc..1f6f810844c7 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_configuration.py +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None + super(NotificationHubsManagementClientConfiguration, self).__init__(**kwargs) 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(NotificationHubsManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +68,4 @@ def _configure( 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) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_metadata.json b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_metadata.json new file mode 100644 index 000000000000..3485e4b56861 --- /dev/null +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_metadata.json @@ -0,0 +1,104 @@ +{ + "chosen_version": "2017-04-01", + "total_api_version_list": ["2017-04-01"], + "client": { + "name": "NotificationHubsManagementClient", + "filename": "_notification_hubs_management_client", + "description": "Azure NotificationHub client.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": 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\": [\"NotificationHubsManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"NotificationHubsManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Gets subscription credentials which uniquely identify 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 credentials which uniquely identify 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=\"https://management.azure.com\", # type: str", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "namespaces": "NamespacesOperations", + "notification_hubs": "NotificationHubsOperations" + } +} \ No newline at end of file diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_notification_hubs_management_client.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_notification_hubs_management_client.py index 9fc702e4e0b0..92daea8924d2 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_notification_hubs_management_client.py +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_notification_hubs_management_client.py @@ -6,23 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import NotificationHubsManagementClientConfiguration +from .operations import NamespacesOperations, NotificationHubsOperations, Operations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Optional from azure.core.credentials import TokenCredential - -from ._configuration import NotificationHubsManagementClientConfiguration -from .operations import Operations -from .operations import NamespacesOperations -from .operations import NotificationHubsOperations -from . import models - + from azure.core.rest import HttpRequest, HttpResponse class NotificationHubsManagementClient(object): """Azure NotificationHub client. @@ -35,36 +34,61 @@ class NotificationHubsManagementClient(object): :vartype notification_hubs: azure.mgmt.notificationhubs.operations.NotificationHubsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription credentials which uniquely identify 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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential, # type: "TokenCredential" subscription_id, # type: str - base_url=None, # type: Optional[str] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = NotificationHubsManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = NotificationHubsManagementClientConfiguration(credential=credential, subscription_id=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._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.notification_hubs = NotificationHubsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs # type: Any + ): + # type: (...) -> HttpResponse + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.namespaces = NamespacesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.notification_hubs = NotificationHubsOperations( - self._client, self._config, self._serialize, self._deserialize) + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_patch.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_vendor.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_version.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_version.py index 364f3c906cf9..142a0420b39b 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_version.py +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "8.0.0" diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/__init__.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/__init__.py index 420ccaff06e2..4ba3cdf67d89 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/__init__.py +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/__init__.py @@ -8,3 +8,8 @@ from ._notification_hubs_management_client import NotificationHubsManagementClient __all__ = ['NotificationHubsManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/_configuration.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/_configuration.py index 5eedd509285a..0ef09db74857 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/_configuration.py +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(NotificationHubsManagementClientConfiguration, self).__init__(**kwargs) 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(NotificationHubsManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( 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) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/_notification_hubs_management_client.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/_notification_hubs_management_client.py index 6fe1f594d6f8..88ad80267cd2 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/_notification_hubs_management_client.py +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/_notification_hubs_management_client.py @@ -6,23 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import NotificationHubsManagementClientConfiguration +from .operations import NamespacesOperations, NotificationHubsOperations, Operations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import NotificationHubsManagementClientConfiguration -from .operations import Operations -from .operations import NamespacesOperations -from .operations import NotificationHubsOperations -from .. import models - - -class NotificationHubsManagementClient(object): +class NotificationHubsManagementClient: """Azure NotificationHub client. :ivar operations: Operations operations @@ -30,38 +29,63 @@ class NotificationHubsManagementClient(object): :ivar namespaces: NamespacesOperations operations :vartype namespaces: azure.mgmt.notificationhubs.aio.operations.NamespacesOperations :ivar notification_hubs: NotificationHubsOperations operations - :vartype notification_hubs: azure.mgmt.notificationhubs.aio.operations.NotificationHubsOperations + :vartype notification_hubs: + azure.mgmt.notificationhubs.aio.operations.NotificationHubsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription credentials which uniquely identify 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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = NotificationHubsManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = NotificationHubsManagementClientConfiguration(credential=credential, subscription_id=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._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.notification_hubs = NotificationHubsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.namespaces = NamespacesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.notification_hubs = NotificationHubsOperations( - self._client, self._config, self._serialize, self._deserialize) + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/_patch.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/operations/_namespaces_operations.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/operations/_namespaces_operations.py index 13d89c322e41..dadea2b0bea0 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/operations/_namespaces_operations.py +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/operations/_namespaces_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._namespaces_operations import build_check_availability_request, build_create_or_update_authorization_rule_request, build_create_or_update_request, build_delete_authorization_rule_request, build_delete_request_initial, build_get_authorization_rule_request, build_get_request, build_list_all_request, build_list_authorization_rules_request, build_list_keys_request, build_list_request, build_patch_request, build_regenerate_keys_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,10 +48,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_availability( self, parameters: "_models.CheckAvailabilityParameters", - **kwargs + **kwargs: Any ) -> "_models.CheckAvailabilityResult": """Checks the availability of the given service namespace across all Azure subscriptions. This is useful because the domain name is created based on the service namespace name. @@ -63,30 +69,20 @@ async def check_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_availability.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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'CheckAvailabilityParameters') + + request = build_check_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CheckAvailabilityParameters') - 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 @@ -100,14 +96,17 @@ async def check_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/checkNamespaceAvailability'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, namespace_name: str, parameters: "_models.NamespaceCreateOrUpdateParameters", - **kwargs + **kwargs: Any ) -> "_models.NamespaceResource": """Creates/Updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is idempotent. @@ -128,32 +127,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'NamespaceCreateOrUpdateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NamespaceCreateOrUpdateParameters') - 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 @@ -171,14 +160,17 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}'} # type: ignore + + @distributed_trace_async async def patch( self, resource_group_name: str, namespace_name: str, parameters: "_models.NamespacePatchParameters", - **kwargs + **kwargs: Any ) -> "_models.NamespaceResource": """Patches the existing namespace. @@ -198,32 +190,22 @@ async def patch( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'NamespacePatchParameters') + + request = build_patch_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NamespacePatchParameters') - 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 @@ -237,38 +219,32 @@ async def patch( return cls(pipeline_response, deserialized, {}) return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, namespace_name: str, - **kwargs + **kwargs: Any ) -> 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 = "2017-04-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, '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] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -281,11 +257,13 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, namespace_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. @@ -296,15 +274,17 @@ async def begin_delete( :type namespace_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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in 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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -318,21 +298,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -344,13 +317,15 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, namespace_name: str, - **kwargs + **kwargs: Any ) -> "_models.NamespaceResource": """Returns the description for the specified namespace. @@ -368,27 +343,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -402,15 +367,18 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}'} # type: ignore + + @distributed_trace_async async def create_or_update_authorization_rule( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: "_models.SharedAccessAuthorizationRuleCreateOrUpdateParameters", - **kwargs + **kwargs: Any ) -> "_models.SharedAccessAuthorizationRuleResource": """Creates an authorization rule for a namespace. @@ -421,7 +389,8 @@ async def create_or_update_authorization_rule( :param authorization_rule_name: Authorization Rule Name. :type authorization_rule_name: str :param parameters: The shared access authorization rule. - :type parameters: ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + :type parameters: + ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) :rtype: ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleResource @@ -432,33 +401,23 @@ async def create_or_update_authorization_rule( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + + request = build_create_or_update_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update_authorization_rule.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') - 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 @@ -472,14 +431,17 @@ async def create_or_update_authorization_rule( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + @distributed_trace_async async def delete_authorization_rule( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, - **kwargs + **kwargs: Any ) -> None: """Deletes a namespace authorization rule. @@ -499,26 +461,18 @@ async def delete_authorization_rule( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - - # Construct URL - url = self.delete_authorization_rule.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, '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] + + request = build_delete_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + template_url=self.delete_authorization_rule.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -531,12 +485,14 @@ async def delete_authorization_rule( delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + @distributed_trace_async async def get_authorization_rule( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, - **kwargs + **kwargs: Any ) -> "_models.SharedAccessAuthorizationRuleResource": """Gets an authorization rule for a namespace by name. @@ -556,28 +512,18 @@ async def get_authorization_rule( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - accept = "application/json" - - # Construct URL - url = self.get_authorization_rule.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + template_url=self.get_authorization_rule.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -591,12 +537,15 @@ async def get_authorization_rule( return cls(pipeline_response, deserialized, {}) return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.NamespaceListResult"]: """Lists the available namespaces within a resourceGroup. @@ -605,7 +554,8 @@ def list( :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 NamespaceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.notificationhubs.models.NamespaceListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.notificationhubs.models.NamespaceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NamespaceListResult"] @@ -613,35 +563,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('NamespaceListResult', pipeline_response) + deserialized = self._deserialize("NamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -659,20 +605,23 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces'} # type: ignore + @distributed_trace def list_all( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.NamespaceListResult"]: """Lists all the available namespaces within the subscription irrespective of the resourceGroups. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either NamespaceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.notificationhubs.models.NamespaceListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.notificationhubs.models.NamespaceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NamespaceListResult"] @@ -680,34 +629,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - 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_all.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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('NamespaceListResult', pipeline_response) + deserialized = self._deserialize("NamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -725,16 +669,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/namespaces'} # type: ignore + @distributed_trace def list_authorization_rules( self, resource_group_name: str, namespace_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.SharedAccessAuthorizationRuleListResult"]: """Gets the authorization rules for a namespace. @@ -743,8 +689,10 @@ def list_authorization_rules( :param namespace_name: The namespace name. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleListResult] + :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleListResult"] @@ -752,36 +700,33 @@ def list_authorization_rules( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - 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_authorization_rules.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, '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) + + request = build_list_authorization_rules_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + template_url=self.list_authorization_rules.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_authorization_rules_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SharedAccessAuthorizationRuleListResult', pipeline_response) + deserialized = self._deserialize("SharedAccessAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -799,18 +744,20 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules'} # type: ignore + @distributed_trace_async async def list_keys( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, - **kwargs - ) -> "_models.SharedAccessAuthorizationRuleListResult": + **kwargs: Any + ) -> "_models.ResourceListKeys": """Gets the Primary and Secondary ConnectionStrings to the namespace. :param resource_group_name: The name of the resource group. @@ -821,37 +768,27 @@ async def list_keys( authorizationRule. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SharedAccessAuthorizationRuleListResult, or the result of cls(response) - :rtype: ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleListResult + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.notificationhubs.models.ResourceListKeys :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -859,21 +796,24 @@ async def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SharedAccessAuthorizationRuleListResult', pipeline_response) + deserialized = self._deserialize('ResourceListKeys', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys'} # type: ignore + + @distributed_trace_async async def regenerate_keys( self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, parameters: "_models.PolicykeyResource", - **kwargs + **kwargs: Any ) -> "_models.ResourceListKeys": """Regenerates the Primary/Secondary Keys to the Namespace Authorization Rule. @@ -896,33 +836,23 @@ async def regenerate_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'PolicykeyResource') + + request = build_regenerate_keys_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PolicykeyResource') - 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 @@ -936,4 +866,6 @@ async def regenerate_keys( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/operations/_notification_hubs_operations.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/operations/_notification_hubs_operations.py index 9e73c65df62c..e255bbe0d8a2 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/operations/_notification_hubs_operations.py +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/operations/_notification_hubs_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._notification_hubs_operations import build_check_notification_hub_availability_request, build_create_or_update_authorization_rule_request, build_create_or_update_request, build_debug_send_request, build_delete_authorization_rule_request, build_delete_request, build_get_authorization_rule_request, build_get_pns_credentials_request, build_get_request, build_list_authorization_rules_request, build_list_keys_request, build_list_request, build_patch_request, build_regenerate_keys_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,12 +46,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_notification_hub_availability( self, resource_group_name: str, namespace_name: str, parameters: "_models.CheckAvailabilityParameters", - **kwargs + **kwargs: Any ) -> "_models.CheckAvailabilityResult": """Checks the availability of the given notificationHub in a namespace. @@ -66,32 +72,22 @@ async def check_notification_hub_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_notification_hub_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'CheckAvailabilityParameters') + + request = build_check_notification_hub_availability_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_notification_hub_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CheckAvailabilityParameters') - 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 @@ -105,15 +101,18 @@ async def check_notification_hub_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_notification_hub_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/checkNotificationHubAvailability'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, namespace_name: str, notification_hub_name: str, parameters: "_models.NotificationHubCreateOrUpdateParameters", - **kwargs + **kwargs: Any ) -> "_models.NotificationHubResource": """Creates/Update a NotificationHub in a namespace. @@ -135,33 +134,23 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'NotificationHubCreateOrUpdateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NotificationHubCreateOrUpdateParameters') - 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 @@ -179,15 +168,18 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}'} # type: ignore + + @distributed_trace_async async def patch( self, resource_group_name: str, namespace_name: str, notification_hub_name: str, parameters: Optional["_models.NotificationHubPatchParameters"] = None, - **kwargs + **kwargs: Any ) -> "_models.NotificationHubResource": """Patch a NotificationHub in a namespace. @@ -209,36 +201,26 @@ async def patch( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'NotificationHubPatchParameters') + _json = self._serialize.body(parameters, 'NotificationHubPatchParameters') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_patch_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -252,14 +234,17 @@ async def patch( return cls(pipeline_response, deserialized, {}) return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, namespace_name: str, notification_hub_name: str, - **kwargs + **kwargs: Any ) -> None: """Deletes a notification hub associated with a namespace. @@ -279,26 +264,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, '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] + + request = build_delete_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -311,12 +288,14 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, namespace_name: str, notification_hub_name: str, - **kwargs + **kwargs: Any ) -> "_models.NotificationHubResource": """Lists the notification hubs associated with a namespace. @@ -336,28 +315,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -371,15 +340,18 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}'} # type: ignore + + @distributed_trace_async async def debug_send( self, resource_group_name: str, namespace_name: str, notification_hub_name: str, - parameters: Optional[object] = None, - **kwargs + parameters: Any = None, + **kwargs: Any ) -> "_models.DebugSendResponse": """test send a push notification. @@ -390,7 +362,7 @@ async def debug_send( :param notification_hub_name: The notification hub name. :type notification_hub_name: str :param parameters: Debug send parameters. - :type parameters: object + :type parameters: any :keyword callable cls: A custom type or function that will be passed the direct response :return: DebugSendResponse, or the result of cls(response) :rtype: ~azure.mgmt.notificationhubs.models.DebugSendResponse @@ -401,36 +373,26 @@ async def debug_send( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.debug_send.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'object') + _json = self._serialize.body(parameters, 'object') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_debug_send_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.debug_send.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -444,8 +406,11 @@ async def debug_send( return cls(pipeline_response, deserialized, {}) return deserialized + debug_send.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/debugsend'} # type: ignore + + @distributed_trace_async async def create_or_update_authorization_rule( self, resource_group_name: str, @@ -453,7 +418,7 @@ async def create_or_update_authorization_rule( notification_hub_name: str, authorization_rule_name: str, parameters: "_models.SharedAccessAuthorizationRuleCreateOrUpdateParameters", - **kwargs + **kwargs: Any ) -> "_models.SharedAccessAuthorizationRuleResource": """Creates/Updates an authorization rule for a NotificationHub. @@ -466,7 +431,8 @@ async def create_or_update_authorization_rule( :param authorization_rule_name: Authorization Rule Name. :type authorization_rule_name: str :param parameters: The shared access authorization rule. - :type parameters: ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + :type parameters: + ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) :rtype: ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleResource @@ -477,34 +443,24 @@ async def create_or_update_authorization_rule( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, 'str'), - 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + + request = build_create_or_update_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update_authorization_rule.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') - 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 @@ -518,15 +474,18 @@ async def create_or_update_authorization_rule( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + @distributed_trace_async async def delete_authorization_rule( self, resource_group_name: str, namespace_name: str, notification_hub_name: str, authorization_rule_name: str, - **kwargs + **kwargs: Any ) -> None: """Deletes a notificationHub authorization rule. @@ -548,27 +507,19 @@ async def delete_authorization_rule( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - - # Construct URL - url = self.delete_authorization_rule.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, 'str'), - 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, '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] + + request = build_delete_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + template_url=self.delete_authorization_rule.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -581,13 +532,15 @@ async def delete_authorization_rule( delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + @distributed_trace_async async def get_authorization_rule( self, resource_group_name: str, namespace_name: str, notification_hub_name: str, authorization_rule_name: str, - **kwargs + **kwargs: Any ) -> "_models.SharedAccessAuthorizationRuleResource": """Gets an authorization rule for a NotificationHub by name. @@ -609,29 +562,19 @@ async def get_authorization_rule( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - accept = "application/json" - - # Construct URL - url = self.get_authorization_rule.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, 'str'), - 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + template_url=self.get_authorization_rule.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -645,13 +588,16 @@ async def get_authorization_rule( return cls(pipeline_response, deserialized, {}) return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, namespace_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.NotificationHubListResult"]: """Lists the notification hubs associated with a namespace. @@ -660,8 +606,10 @@ def list( :param namespace_name: The namespace name. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NotificationHubListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.notificationhubs.models.NotificationHubListResult] + :return: An iterator like instance of either NotificationHubListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.notificationhubs.models.NotificationHubListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NotificationHubListResult"] @@ -669,36 +617,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, '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) + + request = build_list_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('NotificationHubListResult', pipeline_response) + deserialized = self._deserialize("NotificationHubListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -716,17 +661,19 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs'} # type: ignore + @distributed_trace def list_authorization_rules( self, resource_group_name: str, namespace_name: str, notification_hub_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.SharedAccessAuthorizationRuleListResult"]: """Gets the authorization rules for a NotificationHub. @@ -737,8 +684,10 @@ def list_authorization_rules( :param notification_hub_name: The notification hub name. :type notification_hub_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleListResult] + :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleListResult"] @@ -746,37 +695,35 @@ def list_authorization_rules( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - 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_authorization_rules.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, '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) + + request = build_list_authorization_rules_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + subscription_id=self._config.subscription_id, + template_url=self.list_authorization_rules.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_authorization_rules_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SharedAccessAuthorizationRuleListResult', pipeline_response) + deserialized = self._deserialize("SharedAccessAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -794,18 +741,20 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules'} # type: ignore + @distributed_trace_async async def list_keys( self, resource_group_name: str, namespace_name: str, notification_hub_name: str, authorization_rule_name: str, - **kwargs + **kwargs: Any ) -> "_models.ResourceListKeys": """Gets the Primary and Secondary ConnectionStrings to the NotificationHub. @@ -828,29 +777,19 @@ async def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, 'str'), - 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -864,8 +803,11 @@ async def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/listKeys'} # type: ignore + + @distributed_trace_async async def regenerate_keys( self, resource_group_name: str, @@ -873,7 +815,7 @@ async def regenerate_keys( notification_hub_name: str, authorization_rule_name: str, parameters: "_models.PolicykeyResource", - **kwargs + **kwargs: Any ) -> "_models.ResourceListKeys": """Regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule. @@ -899,34 +841,24 @@ async def regenerate_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, 'str'), - 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'PolicykeyResource') + + request = build_regenerate_keys_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PolicykeyResource') - 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 @@ -940,14 +872,17 @@ async def regenerate_keys( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + @distributed_trace_async async def get_pns_credentials( self, resource_group_name: str, namespace_name: str, notification_hub_name: str, - **kwargs + **kwargs: Any ) -> "_models.PnsCredentialsResource": """Lists the PNS Credentials associated with a notification hub . @@ -967,28 +902,18 @@ async def get_pns_credentials( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - accept = "application/json" - - # Construct URL - url = self.get_pns_credentials.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_pns_credentials_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + subscription_id=self._config.subscription_id, + template_url=self.get_pns_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1002,4 +927,6 @@ async def get_pns_credentials( return cls(pipeline_response, deserialized, {}) return deserialized + get_pns_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/pnsCredentials'} # type: ignore + diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/operations/_operations.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/operations/_operations.py index 9dcca4acba63..eff48a1f93aa 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/operations/_operations.py +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,15 +46,17 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available NotificationHubs REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.notificationhubs.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.notificationhubs.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - 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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +97,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/_models.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/_models.py index b543103daff1..2250dc92cff5 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/_models.py +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/_models.py @@ -13,12 +13,12 @@ class AdmCredential(msrest.serialization.Model): """Description of a NotificationHub AdmCredential. - :param client_id: The client identifier. - :type client_id: str - :param client_secret: The credential secret access key. - :type client_secret: str - :param auth_token_url: The URL of the authorization token. - :type auth_token_url: str + :ivar client_id: The client identifier. + :vartype client_id: str + :ivar client_secret: The credential secret access key. + :vartype client_secret: str + :ivar auth_token_url: The URL of the authorization token. + :vartype auth_token_url: str """ _attribute_map = { @@ -31,6 +31,14 @@ def __init__( self, **kwargs ): + """ + :keyword client_id: The client identifier. + :paramtype client_id: str + :keyword client_secret: The credential secret access key. + :paramtype client_secret: str + :keyword auth_token_url: The URL of the authorization token. + :paramtype auth_token_url: str + """ super(AdmCredential, self).__init__(**kwargs) self.client_id = kwargs.get('client_id', None) self.client_secret = kwargs.get('client_secret', None) @@ -40,32 +48,31 @@ def __init__( class ApnsCredential(msrest.serialization.Model): """Description of a NotificationHub ApnsCredential. - :param apns_certificate: The APNS certificate. Specify if using Certificate Authentication - Mode. - :type apns_certificate: str - :param certificate_key: The APNS certificate password if it exists. - :type certificate_key: str - :param endpoint: The APNS endpoint of this credential. If using Certificate Authentication Mode + :ivar apns_certificate: The APNS certificate. Specify if using Certificate Authentication Mode. + :vartype apns_certificate: str + :ivar certificate_key: The APNS certificate password if it exists. + :vartype certificate_key: str + :ivar endpoint: The APNS endpoint of this credential. If using Certificate Authentication Mode and Sandbox specify 'gateway.sandbox.push.apple.com'. If using Certificate Authentication Mode and Production specify 'gateway.push.apple.com'. If using Token Authentication Mode and Sandbox specify 'https://api.development.push.apple.com:443/3/device'. If using Token Authentication Mode and Production specify 'https://api.push.apple.com:443/3/device'. - :type endpoint: str - :param thumbprint: The APNS certificate thumbprint. Specify if using Certificate Authentication + :vartype endpoint: str + :ivar thumbprint: The APNS certificate thumbprint. Specify if using Certificate Authentication Mode. - :type thumbprint: str - :param key_id: A 10-character key identifier (kid) key, obtained from your developer account. + :vartype thumbprint: str + :ivar key_id: A 10-character key identifier (kid) key, obtained from your developer account. Specify if using Token Authentication Mode. - :type key_id: str - :param app_name: The name of the application or BundleId. Specify if using Token Authentication + :vartype key_id: str + :ivar app_name: The name of the application or BundleId. Specify if using Token Authentication Mode. - :type app_name: str - :param app_id: The issuer (iss) registered claim key. The value is a 10-character TeamId, + :vartype app_name: str + :ivar app_id: The issuer (iss) registered claim key. The value is a 10-character TeamId, obtained from your developer account. Specify if using Token Authentication Mode. - :type app_id: str - :param token: Provider Authentication Token, obtained through your developer account. Specify - if using Token Authentication Mode. - :type token: str + :vartype app_id: str + :ivar token: Provider Authentication Token, obtained through your developer account. Specify if + using Token Authentication Mode. + :vartype token: str """ _attribute_map = { @@ -83,6 +90,34 @@ def __init__( self, **kwargs ): + """ + :keyword apns_certificate: The APNS certificate. Specify if using Certificate Authentication + Mode. + :paramtype apns_certificate: str + :keyword certificate_key: The APNS certificate password if it exists. + :paramtype certificate_key: str + :keyword endpoint: The APNS endpoint of this credential. If using Certificate Authentication + Mode and Sandbox specify 'gateway.sandbox.push.apple.com'. If using Certificate Authentication + Mode and Production specify 'gateway.push.apple.com'. If using Token Authentication Mode and + Sandbox specify 'https://api.development.push.apple.com:443/3/device'. If using Token + Authentication Mode and Production specify 'https://api.push.apple.com:443/3/device'. + :paramtype endpoint: str + :keyword thumbprint: The APNS certificate thumbprint. Specify if using Certificate + Authentication Mode. + :paramtype thumbprint: str + :keyword key_id: A 10-character key identifier (kid) key, obtained from your developer account. + Specify if using Token Authentication Mode. + :paramtype key_id: str + :keyword app_name: The name of the application or BundleId. Specify if using Token + Authentication Mode. + :paramtype app_name: str + :keyword app_id: The issuer (iss) registered claim key. The value is a 10-character TeamId, + obtained from your developer account. Specify if using Token Authentication Mode. + :paramtype app_id: str + :keyword token: Provider Authentication Token, obtained through your developer account. Specify + if using Token Authentication Mode. + :paramtype token: str + """ super(ApnsCredential, self).__init__(**kwargs) self.apns_certificate = kwargs.get('apns_certificate', None) self.certificate_key = kwargs.get('certificate_key', None) @@ -97,12 +132,12 @@ def __init__( class BaiduCredential(msrest.serialization.Model): """Description of a NotificationHub BaiduCredential. - :param baidu_api_key: Baidu Api Key. - :type baidu_api_key: str - :param baidu_end_point: Baidu Endpoint. - :type baidu_end_point: str - :param baidu_secret_key: Baidu Secret Key. - :type baidu_secret_key: str + :ivar baidu_api_key: Baidu Api Key. + :vartype baidu_api_key: str + :ivar baidu_end_point: Baidu Endpoint. + :vartype baidu_end_point: str + :ivar baidu_secret_key: Baidu Secret Key. + :vartype baidu_secret_key: str """ _attribute_map = { @@ -115,6 +150,14 @@ def __init__( self, **kwargs ): + """ + :keyword baidu_api_key: Baidu Api Key. + :paramtype baidu_api_key: str + :keyword baidu_end_point: Baidu Endpoint. + :paramtype baidu_end_point: str + :keyword baidu_secret_key: Baidu Secret Key. + :paramtype baidu_secret_key: str + """ super(BaiduCredential, self).__init__(**kwargs) self.baidu_api_key = kwargs.get('baidu_api_key', None) self.baidu_end_point = kwargs.get('baidu_end_point', None) @@ -130,19 +173,19 @@ class CheckAvailabilityParameters(msrest.serialization.Model): :ivar id: Resource Id. :vartype id: str - :param name: Required. Resource name. - :type name: str + :ivar name: Required. Resource name. + :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku - :param is_availiable: True if the name is available and can be used to create new + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar is_availiable: True if the name is available and can be used to create new Namespace/NotificationHub. Otherwise false. - :type is_availiable: bool + :vartype is_availiable: bool """ _validation = { @@ -165,6 +208,19 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. Resource name. + :paramtype name: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + :keyword is_availiable: True if the name is available and can be used to create new + Namespace/NotificationHub. Otherwise false. + :paramtype is_availiable: bool + """ super(CheckAvailabilityParameters, self).__init__(**kwargs) self.id = None self.name = kwargs['name'] @@ -186,12 +242,12 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku """ _validation = { @@ -213,6 +269,14 @@ def __init__( self, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -233,15 +297,15 @@ class CheckAvailabilityResult(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku - :param is_availiable: True if the name is available and can be used to create new + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar is_availiable: True if the name is available and can be used to create new Namespace/NotificationHub. Otherwise false. - :type is_availiable: bool + :vartype is_availiable: bool """ _validation = { @@ -264,6 +328,17 @@ def __init__( self, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + :keyword is_availiable: True if the name is available and can be used to create new + Namespace/NotificationHub. Otherwise false. + :paramtype is_availiable: bool + """ super(CheckAvailabilityResult, self).__init__(**kwargs) self.is_availiable = kwargs.get('is_availiable', None) @@ -279,18 +354,18 @@ class DebugSendResponse(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku - :param success: successful send. - :type success: float - :param failure: send failure. - :type failure: float - :param results: actual failure description. - :type results: object + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar success: successful send. + :vartype success: float + :ivar failure: send failure. + :vartype failure: float + :ivar results: actual failure description. + :vartype results: any """ _validation = { @@ -315,6 +390,20 @@ def __init__( self, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + :keyword success: successful send. + :paramtype success: float + :keyword failure: send failure. + :paramtype failure: float + :keyword results: actual failure description. + :paramtype results: any + """ super(DebugSendResponse, self).__init__(**kwargs) self.success = kwargs.get('success', None) self.failure = kwargs.get('failure', None) @@ -324,10 +413,10 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Error response indicates NotificationHubs service is not able to process the incoming request. The reason is provided in the error message. - :param code: Error code. - :type code: str - :param message: Error message indicating why the operation failed. - :type message: str + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str """ _attribute_map = { @@ -339,6 +428,12 @@ def __init__( self, **kwargs ): + """ + :keyword code: Error code. + :paramtype code: str + :keyword message: Error message indicating why the operation failed. + :paramtype message: str + """ super(ErrorResponse, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -347,11 +442,11 @@ def __init__( class GcmCredential(msrest.serialization.Model): """Description of a NotificationHub GcmCredential. - :param gcm_endpoint: The FCM legacy endpoint. Default value is + :ivar gcm_endpoint: The FCM legacy endpoint. Default value is 'https://fcm.googleapis.com/fcm/send'. - :type gcm_endpoint: str - :param google_api_key: The Google API key. - :type google_api_key: str + :vartype gcm_endpoint: str + :ivar google_api_key: The Google API key. + :vartype google_api_key: str """ _attribute_map = { @@ -363,6 +458,13 @@ def __init__( self, **kwargs ): + """ + :keyword gcm_endpoint: The FCM legacy endpoint. Default value is + 'https://fcm.googleapis.com/fcm/send'. + :paramtype gcm_endpoint: str + :keyword google_api_key: The Google API key. + :paramtype google_api_key: str + """ super(GcmCredential, self).__init__(**kwargs) self.gcm_endpoint = kwargs.get('gcm_endpoint', None) self.google_api_key = kwargs.get('google_api_key', None) @@ -371,12 +473,12 @@ def __init__( class MpnsCredential(msrest.serialization.Model): """Description of a NotificationHub MpnsCredential. - :param mpns_certificate: The MPNS certificate. - :type mpns_certificate: str - :param certificate_key: The certificate key for this credential. - :type certificate_key: str - :param thumbprint: The MPNS certificate Thumbprint. - :type thumbprint: str + :ivar mpns_certificate: The MPNS certificate. + :vartype mpns_certificate: str + :ivar certificate_key: The certificate key for this credential. + :vartype certificate_key: str + :ivar thumbprint: The MPNS certificate Thumbprint. + :vartype thumbprint: str """ _attribute_map = { @@ -389,6 +491,14 @@ def __init__( self, **kwargs ): + """ + :keyword mpns_certificate: The MPNS certificate. + :paramtype mpns_certificate: str + :keyword certificate_key: The certificate key for this credential. + :paramtype certificate_key: str + :keyword thumbprint: The MPNS certificate Thumbprint. + :paramtype thumbprint: str + """ super(MpnsCredential, self).__init__(**kwargs) self.mpns_certificate = kwargs.get('mpns_certificate', None) self.certificate_key = kwargs.get('certificate_key', None) @@ -406,45 +516,45 @@ class NamespaceCreateOrUpdateParameters(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku - :param name_properties_name: The name of the namespace. - :type name_properties_name: str - :param provisioning_state: Provisioning state of the Namespace. - :type provisioning_state: str - :param region: Specifies the targeted region in which the namespace should be created. It can - be any of the following values: Australia East, Australia Southeast, Central US, East US, East - US 2, West US, North Central US, South Central US, East Asia, Southeast Asia, Brazil South, - Japan East, Japan West, North Europe, West Europe. - :type region: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar name_properties_name: The name of the namespace. + :vartype name_properties_name: str + :ivar provisioning_state: Provisioning state of the Namespace. + :vartype provisioning_state: str + :ivar region: Specifies the targeted region in which the namespace should be created. It can be + any of the following values: Australia East, Australia Southeast, Central US, East US, East US + 2, West US, North Central US, South Central US, East Asia, Southeast Asia, Brazil South, Japan + East, Japan West, North Europe, West Europe. + :vartype region: str :ivar metric_id: Identifier for Azure Insights metrics. :vartype metric_id: str - :param status: Status of the namespace. It can be any of these values:1 = Created/Active2 = + :ivar status: Status of the namespace. It can be any of these values:1 = Created/Active2 = Creating3 = Suspended4 = Deleting. - :type status: str - :param created_at: The time the namespace was created. - :type created_at: ~datetime.datetime - :param updated_at: The time the namespace was updated. - :type updated_at: ~datetime.datetime - :param service_bus_endpoint: Endpoint you can use to perform NotificationHub operations. - :type service_bus_endpoint: str - :param subscription_id: The Id of the Azure subscription associated with the namespace. - :type subscription_id: str - :param scale_unit: ScaleUnit where the namespace gets created. - :type scale_unit: str - :param enabled: Whether or not the namespace is currently enabled. - :type enabled: bool - :param critical: Whether or not the namespace is set as Critical. - :type critical: bool - :param data_center: Data center for the namespace. - :type data_center: str - :param namespace_type: The namespace type. Possible values include: "Messaging", + :vartype status: str + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform NotificationHub operations. + :vartype service_bus_endpoint: str + :ivar subscription_id: The Id of the Azure subscription associated with the namespace. + :vartype subscription_id: str + :ivar scale_unit: ScaleUnit where the namespace gets created. + :vartype scale_unit: str + :ivar enabled: Whether or not the namespace is currently enabled. + :vartype enabled: bool + :ivar critical: Whether or not the namespace is set as Critical. + :vartype critical: bool + :ivar data_center: Data center for the namespace. + :vartype data_center: str + :ivar namespace_type: The namespace type. Possible values include: "Messaging", "NotificationHub". - :type namespace_type: str or ~azure.mgmt.notificationhubs.models.NamespaceType + :vartype namespace_type: str or ~azure.mgmt.notificationhubs.models.NamespaceType """ _validation = { @@ -481,6 +591,45 @@ def __init__( self, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + :keyword name_properties_name: The name of the namespace. + :paramtype name_properties_name: str + :keyword provisioning_state: Provisioning state of the Namespace. + :paramtype provisioning_state: str + :keyword region: Specifies the targeted region in which the namespace should be created. It can + be any of the following values: Australia East, Australia Southeast, Central US, East US, East + US 2, West US, North Central US, South Central US, East Asia, Southeast Asia, Brazil South, + Japan East, Japan West, North Europe, West Europe. + :paramtype region: str + :keyword status: Status of the namespace. It can be any of these values:1 = Created/Active2 = + Creating3 = Suspended4 = Deleting. + :paramtype status: str + :keyword created_at: The time the namespace was created. + :paramtype created_at: ~datetime.datetime + :keyword updated_at: The time the namespace was updated. + :paramtype updated_at: ~datetime.datetime + :keyword service_bus_endpoint: Endpoint you can use to perform NotificationHub operations. + :paramtype service_bus_endpoint: str + :keyword subscription_id: The Id of the Azure subscription associated with the namespace. + :paramtype subscription_id: str + :keyword scale_unit: ScaleUnit where the namespace gets created. + :paramtype scale_unit: str + :keyword enabled: Whether or not the namespace is currently enabled. + :paramtype enabled: bool + :keyword critical: Whether or not the namespace is set as Critical. + :paramtype critical: bool + :keyword data_center: Data center for the namespace. + :paramtype data_center: str + :keyword namespace_type: The namespace type. Possible values include: "Messaging", + "NotificationHub". + :paramtype namespace_type: str or ~azure.mgmt.notificationhubs.models.NamespaceType + """ super(NamespaceCreateOrUpdateParameters, self).__init__(**kwargs) self.name_properties_name = kwargs.get('name_properties_name', None) self.provisioning_state = kwargs.get('provisioning_state', None) @@ -501,11 +650,11 @@ def __init__( class NamespaceListResult(msrest.serialization.Model): """The response of the List Namespace operation. - :param value: Result of the List Namespace operation. - :type value: list[~azure.mgmt.notificationhubs.models.NamespaceResource] - :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + :ivar value: Result of the List Namespace operation. + :vartype value: list[~azure.mgmt.notificationhubs.models.NamespaceResource] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of Namespaces. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -517,6 +666,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Result of the List Namespace operation. + :paramtype value: list[~azure.mgmt.notificationhubs.models.NamespaceResource] + :keyword next_link: Link to the next set of results. Not empty if Value contains incomplete + list of Namespaces. + :paramtype next_link: str + """ super(NamespaceListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -525,10 +681,10 @@ def __init__( class NamespacePatchParameters(msrest.serialization.Model): """Parameters supplied to the Patch Namespace operation. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku """ _attribute_map = { @@ -540,6 +696,12 @@ def __init__( self, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + """ super(NamespacePatchParameters, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) self.sku = kwargs.get('sku', None) @@ -556,45 +718,45 @@ class NamespaceResource(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku - :param name_properties_name: The name of the namespace. - :type name_properties_name: str - :param provisioning_state: Provisioning state of the Namespace. - :type provisioning_state: str - :param region: Specifies the targeted region in which the namespace should be created. It can - be any of the following values: Australia East, Australia Southeast, Central US, East US, East - US 2, West US, North Central US, South Central US, East Asia, Southeast Asia, Brazil South, - Japan East, Japan West, North Europe, West Europe. - :type region: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar name_properties_name: The name of the namespace. + :vartype name_properties_name: str + :ivar provisioning_state: Provisioning state of the Namespace. + :vartype provisioning_state: str + :ivar region: Specifies the targeted region in which the namespace should be created. It can be + any of the following values: Australia East, Australia Southeast, Central US, East US, East US + 2, West US, North Central US, South Central US, East Asia, Southeast Asia, Brazil South, Japan + East, Japan West, North Europe, West Europe. + :vartype region: str :ivar metric_id: Identifier for Azure Insights metrics. :vartype metric_id: str - :param status: Status of the namespace. It can be any of these values:1 = Created/Active2 = + :ivar status: Status of the namespace. It can be any of these values:1 = Created/Active2 = Creating3 = Suspended4 = Deleting. - :type status: str - :param created_at: The time the namespace was created. - :type created_at: ~datetime.datetime - :param updated_at: The time the namespace was updated. - :type updated_at: ~datetime.datetime - :param service_bus_endpoint: Endpoint you can use to perform NotificationHub operations. - :type service_bus_endpoint: str - :param subscription_id: The Id of the Azure subscription associated with the namespace. - :type subscription_id: str - :param scale_unit: ScaleUnit where the namespace gets created. - :type scale_unit: str - :param enabled: Whether or not the namespace is currently enabled. - :type enabled: bool - :param critical: Whether or not the namespace is set as Critical. - :type critical: bool - :param data_center: Data center for the namespace. - :type data_center: str - :param namespace_type: The namespace type. Possible values include: "Messaging", + :vartype status: str + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform NotificationHub operations. + :vartype service_bus_endpoint: str + :ivar subscription_id: The Id of the Azure subscription associated with the namespace. + :vartype subscription_id: str + :ivar scale_unit: ScaleUnit where the namespace gets created. + :vartype scale_unit: str + :ivar enabled: Whether or not the namespace is currently enabled. + :vartype enabled: bool + :ivar critical: Whether or not the namespace is set as Critical. + :vartype critical: bool + :ivar data_center: Data center for the namespace. + :vartype data_center: str + :ivar namespace_type: The namespace type. Possible values include: "Messaging", "NotificationHub". - :type namespace_type: str or ~azure.mgmt.notificationhubs.models.NamespaceType + :vartype namespace_type: str or ~azure.mgmt.notificationhubs.models.NamespaceType """ _validation = { @@ -631,6 +793,45 @@ def __init__( self, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + :keyword name_properties_name: The name of the namespace. + :paramtype name_properties_name: str + :keyword provisioning_state: Provisioning state of the Namespace. + :paramtype provisioning_state: str + :keyword region: Specifies the targeted region in which the namespace should be created. It can + be any of the following values: Australia East, Australia Southeast, Central US, East US, East + US 2, West US, North Central US, South Central US, East Asia, Southeast Asia, Brazil South, + Japan East, Japan West, North Europe, West Europe. + :paramtype region: str + :keyword status: Status of the namespace. It can be any of these values:1 = Created/Active2 = + Creating3 = Suspended4 = Deleting. + :paramtype status: str + :keyword created_at: The time the namespace was created. + :paramtype created_at: ~datetime.datetime + :keyword updated_at: The time the namespace was updated. + :paramtype updated_at: ~datetime.datetime + :keyword service_bus_endpoint: Endpoint you can use to perform NotificationHub operations. + :paramtype service_bus_endpoint: str + :keyword subscription_id: The Id of the Azure subscription associated with the namespace. + :paramtype subscription_id: str + :keyword scale_unit: ScaleUnit where the namespace gets created. + :paramtype scale_unit: str + :keyword enabled: Whether or not the namespace is currently enabled. + :paramtype enabled: bool + :keyword critical: Whether or not the namespace is set as Critical. + :paramtype critical: bool + :keyword data_center: Data center for the namespace. + :paramtype data_center: str + :keyword namespace_type: The namespace type. Possible values include: "Messaging", + "NotificationHub". + :paramtype namespace_type: str or ~azure.mgmt.notificationhubs.models.NamespaceType + """ super(NamespaceResource, self).__init__(**kwargs) self.name_properties_name = kwargs.get('name_properties_name', None) self.provisioning_state = kwargs.get('provisioning_state', None) @@ -659,31 +860,31 @@ class NotificationHubCreateOrUpdateParameters(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku - :param name_properties_name: The NotificationHub name. - :type name_properties_name: str - :param registration_ttl: The RegistrationTtl of the created NotificationHub. - :type registration_ttl: str - :param authorization_rules: The AuthorizationRules of the created NotificationHub. - :type authorization_rules: + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar name_properties_name: The NotificationHub name. + :vartype name_properties_name: str + :ivar registration_ttl: The RegistrationTtl of the created NotificationHub. + :vartype registration_ttl: str + :ivar authorization_rules: The AuthorizationRules of the created NotificationHub. + :vartype authorization_rules: list[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleProperties] - :param apns_credential: The ApnsCredential of the created NotificationHub. - :type apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential - :param wns_credential: The WnsCredential of the created NotificationHub. - :type wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential - :param gcm_credential: The GcmCredential of the created NotificationHub. - :type gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential - :param mpns_credential: The MpnsCredential of the created NotificationHub. - :type mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential - :param adm_credential: The AdmCredential of the created NotificationHub. - :type adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential - :param baidu_credential: The BaiduCredential of the created NotificationHub. - :type baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential + :ivar apns_credential: The ApnsCredential of the created NotificationHub. + :vartype apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential + :ivar wns_credential: The WnsCredential of the created NotificationHub. + :vartype wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential + :ivar gcm_credential: The GcmCredential of the created NotificationHub. + :vartype gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential + :ivar mpns_credential: The MpnsCredential of the created NotificationHub. + :vartype mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential + :ivar adm_credential: The AdmCredential of the created NotificationHub. + :vartype adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential + :ivar baidu_credential: The BaiduCredential of the created NotificationHub. + :vartype baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential """ _validation = { @@ -714,6 +915,33 @@ def __init__( self, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + :keyword name_properties_name: The NotificationHub name. + :paramtype name_properties_name: str + :keyword registration_ttl: The RegistrationTtl of the created NotificationHub. + :paramtype registration_ttl: str + :keyword authorization_rules: The AuthorizationRules of the created NotificationHub. + :paramtype authorization_rules: + list[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleProperties] + :keyword apns_credential: The ApnsCredential of the created NotificationHub. + :paramtype apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential + :keyword wns_credential: The WnsCredential of the created NotificationHub. + :paramtype wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential + :keyword gcm_credential: The GcmCredential of the created NotificationHub. + :paramtype gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential + :keyword mpns_credential: The MpnsCredential of the created NotificationHub. + :paramtype mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential + :keyword adm_credential: The AdmCredential of the created NotificationHub. + :paramtype adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential + :keyword baidu_credential: The BaiduCredential of the created NotificationHub. + :paramtype baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential + """ super(NotificationHubCreateOrUpdateParameters, self).__init__(**kwargs) self.name_properties_name = kwargs.get('name_properties_name', None) self.registration_ttl = kwargs.get('registration_ttl', None) @@ -729,11 +957,11 @@ def __init__( class NotificationHubListResult(msrest.serialization.Model): """The response of the List NotificationHub operation. - :param value: Result of the List NotificationHub operation. - :type value: list[~azure.mgmt.notificationhubs.models.NotificationHubResource] - :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + :ivar value: Result of the List NotificationHub operation. + :vartype value: list[~azure.mgmt.notificationhubs.models.NotificationHubResource] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of NotificationHub. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -745,6 +973,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Result of the List NotificationHub operation. + :paramtype value: list[~azure.mgmt.notificationhubs.models.NotificationHubResource] + :keyword next_link: Link to the next set of results. Not empty if Value contains incomplete + list of NotificationHub. + :paramtype next_link: str + """ super(NotificationHubListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -761,31 +996,31 @@ class NotificationHubPatchParameters(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku - :param name_properties_name: The NotificationHub name. - :type name_properties_name: str - :param registration_ttl: The RegistrationTtl of the created NotificationHub. - :type registration_ttl: str - :param authorization_rules: The AuthorizationRules of the created NotificationHub. - :type authorization_rules: + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar name_properties_name: The NotificationHub name. + :vartype name_properties_name: str + :ivar registration_ttl: The RegistrationTtl of the created NotificationHub. + :vartype registration_ttl: str + :ivar authorization_rules: The AuthorizationRules of the created NotificationHub. + :vartype authorization_rules: list[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleProperties] - :param apns_credential: The ApnsCredential of the created NotificationHub. - :type apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential - :param wns_credential: The WnsCredential of the created NotificationHub. - :type wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential - :param gcm_credential: The GcmCredential of the created NotificationHub. - :type gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential - :param mpns_credential: The MpnsCredential of the created NotificationHub. - :type mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential - :param adm_credential: The AdmCredential of the created NotificationHub. - :type adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential - :param baidu_credential: The BaiduCredential of the created NotificationHub. - :type baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential + :ivar apns_credential: The ApnsCredential of the created NotificationHub. + :vartype apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential + :ivar wns_credential: The WnsCredential of the created NotificationHub. + :vartype wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential + :ivar gcm_credential: The GcmCredential of the created NotificationHub. + :vartype gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential + :ivar mpns_credential: The MpnsCredential of the created NotificationHub. + :vartype mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential + :ivar adm_credential: The AdmCredential of the created NotificationHub. + :vartype adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential + :ivar baidu_credential: The BaiduCredential of the created NotificationHub. + :vartype baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential """ _validation = { @@ -816,6 +1051,33 @@ def __init__( self, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + :keyword name_properties_name: The NotificationHub name. + :paramtype name_properties_name: str + :keyword registration_ttl: The RegistrationTtl of the created NotificationHub. + :paramtype registration_ttl: str + :keyword authorization_rules: The AuthorizationRules of the created NotificationHub. + :paramtype authorization_rules: + list[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleProperties] + :keyword apns_credential: The ApnsCredential of the created NotificationHub. + :paramtype apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential + :keyword wns_credential: The WnsCredential of the created NotificationHub. + :paramtype wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential + :keyword gcm_credential: The GcmCredential of the created NotificationHub. + :paramtype gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential + :keyword mpns_credential: The MpnsCredential of the created NotificationHub. + :paramtype mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential + :keyword adm_credential: The AdmCredential of the created NotificationHub. + :paramtype adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential + :keyword baidu_credential: The BaiduCredential of the created NotificationHub. + :paramtype baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential + """ super(NotificationHubPatchParameters, self).__init__(**kwargs) self.name_properties_name = kwargs.get('name_properties_name', None) self.registration_ttl = kwargs.get('registration_ttl', None) @@ -839,31 +1101,31 @@ class NotificationHubResource(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku - :param name_properties_name: The NotificationHub name. - :type name_properties_name: str - :param registration_ttl: The RegistrationTtl of the created NotificationHub. - :type registration_ttl: str - :param authorization_rules: The AuthorizationRules of the created NotificationHub. - :type authorization_rules: + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar name_properties_name: The NotificationHub name. + :vartype name_properties_name: str + :ivar registration_ttl: The RegistrationTtl of the created NotificationHub. + :vartype registration_ttl: str + :ivar authorization_rules: The AuthorizationRules of the created NotificationHub. + :vartype authorization_rules: list[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleProperties] - :param apns_credential: The ApnsCredential of the created NotificationHub. - :type apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential - :param wns_credential: The WnsCredential of the created NotificationHub. - :type wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential - :param gcm_credential: The GcmCredential of the created NotificationHub. - :type gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential - :param mpns_credential: The MpnsCredential of the created NotificationHub. - :type mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential - :param adm_credential: The AdmCredential of the created NotificationHub. - :type adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential - :param baidu_credential: The BaiduCredential of the created NotificationHub. - :type baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential + :ivar apns_credential: The ApnsCredential of the created NotificationHub. + :vartype apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential + :ivar wns_credential: The WnsCredential of the created NotificationHub. + :vartype wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential + :ivar gcm_credential: The GcmCredential of the created NotificationHub. + :vartype gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential + :ivar mpns_credential: The MpnsCredential of the created NotificationHub. + :vartype mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential + :ivar adm_credential: The AdmCredential of the created NotificationHub. + :vartype adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential + :ivar baidu_credential: The BaiduCredential of the created NotificationHub. + :vartype baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential """ _validation = { @@ -894,6 +1156,33 @@ def __init__( self, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + :keyword name_properties_name: The NotificationHub name. + :paramtype name_properties_name: str + :keyword registration_ttl: The RegistrationTtl of the created NotificationHub. + :paramtype registration_ttl: str + :keyword authorization_rules: The AuthorizationRules of the created NotificationHub. + :paramtype authorization_rules: + list[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleProperties] + :keyword apns_credential: The ApnsCredential of the created NotificationHub. + :paramtype apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential + :keyword wns_credential: The WnsCredential of the created NotificationHub. + :paramtype wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential + :keyword gcm_credential: The GcmCredential of the created NotificationHub. + :paramtype gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential + :keyword mpns_credential: The MpnsCredential of the created NotificationHub. + :paramtype mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential + :keyword adm_credential: The AdmCredential of the created NotificationHub. + :paramtype adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential + :keyword baidu_credential: The BaiduCredential of the created NotificationHub. + :paramtype baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential + """ super(NotificationHubResource, self).__init__(**kwargs) self.name_properties_name = kwargs.get('name_properties_name', None) self.registration_ttl = kwargs.get('registration_ttl', None) @@ -913,8 +1202,8 @@ class Operation(msrest.serialization.Model): :ivar name: Operation name: {provider}/{resource}/{operation}. :vartype name: str - :param display: The object that represents the operation. - :type display: ~azure.mgmt.notificationhubs.models.OperationDisplay + :ivar display: The object that represents the operation. + :vartype display: ~azure.mgmt.notificationhubs.models.OperationDisplay """ _validation = { @@ -930,6 +1219,10 @@ def __init__( self, **kwargs ): + """ + :keyword display: The object that represents the operation. + :paramtype display: ~azure.mgmt.notificationhubs.models.OperationDisplay + """ super(Operation, self).__init__(**kwargs) self.name = None self.display = kwargs.get('display', None) @@ -964,6 +1257,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = None self.resource = None @@ -996,6 +1291,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1012,24 +1309,24 @@ class PnsCredentialsResource(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku - :param apns_credential: The ApnsCredential of the created NotificationHub. - :type apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential - :param wns_credential: The WnsCredential of the created NotificationHub. - :type wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential - :param gcm_credential: The GcmCredential of the created NotificationHub. - :type gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential - :param mpns_credential: The MpnsCredential of the created NotificationHub. - :type mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential - :param adm_credential: The AdmCredential of the created NotificationHub. - :type adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential - :param baidu_credential: The BaiduCredential of the created NotificationHub. - :type baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar apns_credential: The ApnsCredential of the created NotificationHub. + :vartype apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential + :ivar wns_credential: The WnsCredential of the created NotificationHub. + :vartype wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential + :ivar gcm_credential: The GcmCredential of the created NotificationHub. + :vartype gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential + :ivar mpns_credential: The MpnsCredential of the created NotificationHub. + :vartype mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential + :ivar adm_credential: The AdmCredential of the created NotificationHub. + :vartype adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential + :ivar baidu_credential: The BaiduCredential of the created NotificationHub. + :vartype baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential """ _validation = { @@ -1057,6 +1354,26 @@ def __init__( self, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + :keyword apns_credential: The ApnsCredential of the created NotificationHub. + :paramtype apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential + :keyword wns_credential: The WnsCredential of the created NotificationHub. + :paramtype wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential + :keyword gcm_credential: The GcmCredential of the created NotificationHub. + :paramtype gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential + :keyword mpns_credential: The MpnsCredential of the created NotificationHub. + :paramtype mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential + :keyword adm_credential: The AdmCredential of the created NotificationHub. + :paramtype adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential + :keyword baidu_credential: The BaiduCredential of the created NotificationHub. + :paramtype baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential + """ super(PnsCredentialsResource, self).__init__(**kwargs) self.apns_credential = kwargs.get('apns_credential', None) self.wns_credential = kwargs.get('wns_credential', None) @@ -1069,9 +1386,9 @@ def __init__( class PolicykeyResource(msrest.serialization.Model): """Namespace/NotificationHub Regenerate Keys. - :param policy_key: Name of the key that has to be regenerated for the Namespace/Notification - Hub Authorization Rule. The value can be Primary Key/Secondary Key. - :type policy_key: str + :ivar policy_key: Name of the key that has to be regenerated for the Namespace/Notification Hub + Authorization Rule. The value can be Primary Key/Secondary Key. + :vartype policy_key: str """ _attribute_map = { @@ -1082,6 +1399,11 @@ def __init__( self, **kwargs ): + """ + :keyword policy_key: Name of the key that has to be regenerated for the Namespace/Notification + Hub Authorization Rule. The value can be Primary Key/Secondary Key. + :paramtype policy_key: str + """ super(PolicykeyResource, self).__init__(**kwargs) self.policy_key = kwargs.get('policy_key', None) @@ -1089,16 +1411,16 @@ def __init__( class ResourceListKeys(msrest.serialization.Model): """Namespace/NotificationHub Connection String. - :param primary_connection_string: PrimaryConnectionString of the AuthorizationRule. - :type primary_connection_string: str - :param secondary_connection_string: SecondaryConnectionString of the created AuthorizationRule. - :type secondary_connection_string: str - :param primary_key: PrimaryKey of the created AuthorizationRule. - :type primary_key: str - :param secondary_key: SecondaryKey of the created AuthorizationRule. - :type secondary_key: str - :param key_name: KeyName of the created AuthorizationRule. - :type key_name: str + :ivar primary_connection_string: PrimaryConnectionString of the AuthorizationRule. + :vartype primary_connection_string: str + :ivar secondary_connection_string: SecondaryConnectionString of the created AuthorizationRule. + :vartype secondary_connection_string: str + :ivar primary_key: PrimaryKey of the created AuthorizationRule. + :vartype primary_key: str + :ivar secondary_key: SecondaryKey of the created AuthorizationRule. + :vartype secondary_key: str + :ivar key_name: KeyName of the created AuthorizationRule. + :vartype key_name: str """ _attribute_map = { @@ -1113,6 +1435,19 @@ def __init__( self, **kwargs ): + """ + :keyword primary_connection_string: PrimaryConnectionString of the AuthorizationRule. + :paramtype primary_connection_string: str + :keyword secondary_connection_string: SecondaryConnectionString of the created + AuthorizationRule. + :paramtype secondary_connection_string: str + :keyword primary_key: PrimaryKey of the created AuthorizationRule. + :paramtype primary_key: str + :keyword secondary_key: SecondaryKey of the created AuthorizationRule. + :paramtype secondary_key: str + :keyword key_name: KeyName of the created AuthorizationRule. + :paramtype key_name: str + """ super(ResourceListKeys, self).__init__(**kwargs) self.primary_connection_string = kwargs.get('primary_connection_string', None) self.secondary_connection_string = kwargs.get('secondary_connection_string', None) @@ -1126,8 +1461,9 @@ class SharedAccessAuthorizationRuleCreateOrUpdateParameters(msrest.serialization All required parameters must be populated in order to send to Azure. - :param properties: Required. Properties of the Namespace AuthorizationRules. - :type properties: ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleProperties + :ivar properties: Required. Properties of the Namespace AuthorizationRules. + :vartype properties: + ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleProperties """ _validation = { @@ -1142,6 +1478,11 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Required. Properties of the Namespace AuthorizationRules. + :paramtype properties: + ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleProperties + """ super(SharedAccessAuthorizationRuleCreateOrUpdateParameters, self).__init__(**kwargs) self.properties = kwargs['properties'] @@ -1149,11 +1490,11 @@ def __init__( class SharedAccessAuthorizationRuleListResult(msrest.serialization.Model): """The response of the List Namespace operation. - :param value: Result of the List AuthorizationRules operation. - :type value: list[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleResource] - :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + :ivar value: Result of the List AuthorizationRules operation. + :vartype value: list[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleResource] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of AuthorizationRules. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1165,6 +1506,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Result of the List AuthorizationRules operation. + :paramtype value: + list[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleResource] + :keyword next_link: Link to the next set of results. Not empty if Value contains incomplete + list of AuthorizationRules. + :paramtype next_link: str + """ super(SharedAccessAuthorizationRuleListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1175,8 +1524,8 @@ class SharedAccessAuthorizationRuleProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param rights: The rights associated with the rule. - :type rights: list[str or ~azure.mgmt.notificationhubs.models.AccessRights] + :ivar rights: The rights associated with the rule. + :vartype rights: list[str or ~azure.mgmt.notificationhubs.models.AccessRights] :ivar primary_key: A base64-encoded 256-bit primary key for signing and validating the SAS token. :vartype primary_key: str @@ -1224,6 +1573,10 @@ def __init__( self, **kwargs ): + """ + :keyword rights: The rights associated with the rule. + :paramtype rights: list[str or ~azure.mgmt.notificationhubs.models.AccessRights] + """ super(SharedAccessAuthorizationRuleProperties, self).__init__(**kwargs) self.rights = kwargs.get('rights', None) self.primary_key = None @@ -1247,14 +1600,14 @@ class SharedAccessAuthorizationRuleResource(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku - :param rights: The rights associated with the rule. - :type rights: list[str or ~azure.mgmt.notificationhubs.models.AccessRights] + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar rights: The rights associated with the rule. + :vartype rights: list[str or ~azure.mgmt.notificationhubs.models.AccessRights] :ivar primary_key: A base64-encoded 256-bit primary key for signing and validating the SAS token. :vartype primary_key: str @@ -1311,6 +1664,16 @@ def __init__( self, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + :keyword rights: The rights associated with the rule. + :paramtype rights: list[str or ~azure.mgmt.notificationhubs.models.AccessRights] + """ super(SharedAccessAuthorizationRuleResource, self).__init__(**kwargs) self.rights = kwargs.get('rights', None) self.primary_key = None @@ -1328,17 +1691,17 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the notification hub sku. Possible values include: "Free", + :ivar name: Required. Name of the notification hub sku. Possible values include: "Free", "Basic", "Standard". - :type name: str or ~azure.mgmt.notificationhubs.models.SkuName - :param tier: The tier of particular sku. - :type tier: str - :param size: The Sku size. - :type size: str - :param family: The Sku Family. - :type family: str - :param capacity: The capacity of the resource. - :type capacity: int + :vartype name: str or ~azure.mgmt.notificationhubs.models.SkuName + :ivar tier: The tier of particular sku. + :vartype tier: str + :ivar size: The Sku size. + :vartype size: str + :ivar family: The Sku Family. + :vartype family: str + :ivar capacity: The capacity of the resource. + :vartype capacity: int """ _validation = { @@ -1357,6 +1720,19 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. Name of the notification hub sku. Possible values include: "Free", + "Basic", "Standard". + :paramtype name: str or ~azure.mgmt.notificationhubs.models.SkuName + :keyword tier: The tier of particular sku. + :paramtype tier: str + :keyword size: The Sku size. + :paramtype size: str + :keyword family: The Sku Family. + :paramtype family: str + :keyword capacity: The capacity of the resource. + :paramtype capacity: int + """ super(Sku, self).__init__(**kwargs) self.name = kwargs['name'] self.tier = kwargs.get('tier', None) @@ -1368,8 +1744,8 @@ def __init__( class SubResource(msrest.serialization.Model): """SubResource. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -1380,6 +1756,10 @@ def __init__( self, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SubResource, self).__init__(**kwargs) self.id = kwargs.get('id', None) @@ -1387,12 +1767,12 @@ def __init__( class WnsCredential(msrest.serialization.Model): """Description of a NotificationHub WnsCredential. - :param package_sid: The package ID for this credential. - :type package_sid: str - :param secret_key: The secret key. - :type secret_key: str - :param windows_live_endpoint: The Windows Live endpoint. - :type windows_live_endpoint: str + :ivar package_sid: The package ID for this credential. + :vartype package_sid: str + :ivar secret_key: The secret key. + :vartype secret_key: str + :ivar windows_live_endpoint: The Windows Live endpoint. + :vartype windows_live_endpoint: str """ _attribute_map = { @@ -1405,6 +1785,14 @@ def __init__( self, **kwargs ): + """ + :keyword package_sid: The package ID for this credential. + :paramtype package_sid: str + :keyword secret_key: The secret key. + :paramtype secret_key: str + :keyword windows_live_endpoint: The Windows Live endpoint. + :paramtype windows_live_endpoint: str + """ super(WnsCredential, self).__init__(**kwargs) self.package_sid = kwargs.get('package_sid', None) self.secret_key = kwargs.get('secret_key', None) diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/_models_py3.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/_models_py3.py index d667ea0bf3db..2f7522eecaf3 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/_models_py3.py +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/_models_py3.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, Union from azure.core.exceptions import HttpResponseError import msrest.serialization @@ -18,12 +18,12 @@ class AdmCredential(msrest.serialization.Model): """Description of a NotificationHub AdmCredential. - :param client_id: The client identifier. - :type client_id: str - :param client_secret: The credential secret access key. - :type client_secret: str - :param auth_token_url: The URL of the authorization token. - :type auth_token_url: str + :ivar client_id: The client identifier. + :vartype client_id: str + :ivar client_secret: The credential secret access key. + :vartype client_secret: str + :ivar auth_token_url: The URL of the authorization token. + :vartype auth_token_url: str """ _attribute_map = { @@ -40,6 +40,14 @@ def __init__( auth_token_url: Optional[str] = None, **kwargs ): + """ + :keyword client_id: The client identifier. + :paramtype client_id: str + :keyword client_secret: The credential secret access key. + :paramtype client_secret: str + :keyword auth_token_url: The URL of the authorization token. + :paramtype auth_token_url: str + """ super(AdmCredential, self).__init__(**kwargs) self.client_id = client_id self.client_secret = client_secret @@ -49,32 +57,31 @@ def __init__( class ApnsCredential(msrest.serialization.Model): """Description of a NotificationHub ApnsCredential. - :param apns_certificate: The APNS certificate. Specify if using Certificate Authentication - Mode. - :type apns_certificate: str - :param certificate_key: The APNS certificate password if it exists. - :type certificate_key: str - :param endpoint: The APNS endpoint of this credential. If using Certificate Authentication Mode + :ivar apns_certificate: The APNS certificate. Specify if using Certificate Authentication Mode. + :vartype apns_certificate: str + :ivar certificate_key: The APNS certificate password if it exists. + :vartype certificate_key: str + :ivar endpoint: The APNS endpoint of this credential. If using Certificate Authentication Mode and Sandbox specify 'gateway.sandbox.push.apple.com'. If using Certificate Authentication Mode and Production specify 'gateway.push.apple.com'. If using Token Authentication Mode and Sandbox specify 'https://api.development.push.apple.com:443/3/device'. If using Token Authentication Mode and Production specify 'https://api.push.apple.com:443/3/device'. - :type endpoint: str - :param thumbprint: The APNS certificate thumbprint. Specify if using Certificate Authentication + :vartype endpoint: str + :ivar thumbprint: The APNS certificate thumbprint. Specify if using Certificate Authentication Mode. - :type thumbprint: str - :param key_id: A 10-character key identifier (kid) key, obtained from your developer account. + :vartype thumbprint: str + :ivar key_id: A 10-character key identifier (kid) key, obtained from your developer account. Specify if using Token Authentication Mode. - :type key_id: str - :param app_name: The name of the application or BundleId. Specify if using Token Authentication + :vartype key_id: str + :ivar app_name: The name of the application or BundleId. Specify if using Token Authentication Mode. - :type app_name: str - :param app_id: The issuer (iss) registered claim key. The value is a 10-character TeamId, + :vartype app_name: str + :ivar app_id: The issuer (iss) registered claim key. The value is a 10-character TeamId, obtained from your developer account. Specify if using Token Authentication Mode. - :type app_id: str - :param token: Provider Authentication Token, obtained through your developer account. Specify - if using Token Authentication Mode. - :type token: str + :vartype app_id: str + :ivar token: Provider Authentication Token, obtained through your developer account. Specify if + using Token Authentication Mode. + :vartype token: str """ _attribute_map = { @@ -101,6 +108,34 @@ def __init__( token: Optional[str] = None, **kwargs ): + """ + :keyword apns_certificate: The APNS certificate. Specify if using Certificate Authentication + Mode. + :paramtype apns_certificate: str + :keyword certificate_key: The APNS certificate password if it exists. + :paramtype certificate_key: str + :keyword endpoint: The APNS endpoint of this credential. If using Certificate Authentication + Mode and Sandbox specify 'gateway.sandbox.push.apple.com'. If using Certificate Authentication + Mode and Production specify 'gateway.push.apple.com'. If using Token Authentication Mode and + Sandbox specify 'https://api.development.push.apple.com:443/3/device'. If using Token + Authentication Mode and Production specify 'https://api.push.apple.com:443/3/device'. + :paramtype endpoint: str + :keyword thumbprint: The APNS certificate thumbprint. Specify if using Certificate + Authentication Mode. + :paramtype thumbprint: str + :keyword key_id: A 10-character key identifier (kid) key, obtained from your developer account. + Specify if using Token Authentication Mode. + :paramtype key_id: str + :keyword app_name: The name of the application or BundleId. Specify if using Token + Authentication Mode. + :paramtype app_name: str + :keyword app_id: The issuer (iss) registered claim key. The value is a 10-character TeamId, + obtained from your developer account. Specify if using Token Authentication Mode. + :paramtype app_id: str + :keyword token: Provider Authentication Token, obtained through your developer account. Specify + if using Token Authentication Mode. + :paramtype token: str + """ super(ApnsCredential, self).__init__(**kwargs) self.apns_certificate = apns_certificate self.certificate_key = certificate_key @@ -115,12 +150,12 @@ def __init__( class BaiduCredential(msrest.serialization.Model): """Description of a NotificationHub BaiduCredential. - :param baidu_api_key: Baidu Api Key. - :type baidu_api_key: str - :param baidu_end_point: Baidu Endpoint. - :type baidu_end_point: str - :param baidu_secret_key: Baidu Secret Key. - :type baidu_secret_key: str + :ivar baidu_api_key: Baidu Api Key. + :vartype baidu_api_key: str + :ivar baidu_end_point: Baidu Endpoint. + :vartype baidu_end_point: str + :ivar baidu_secret_key: Baidu Secret Key. + :vartype baidu_secret_key: str """ _attribute_map = { @@ -137,6 +172,14 @@ def __init__( baidu_secret_key: Optional[str] = None, **kwargs ): + """ + :keyword baidu_api_key: Baidu Api Key. + :paramtype baidu_api_key: str + :keyword baidu_end_point: Baidu Endpoint. + :paramtype baidu_end_point: str + :keyword baidu_secret_key: Baidu Secret Key. + :paramtype baidu_secret_key: str + """ super(BaiduCredential, self).__init__(**kwargs) self.baidu_api_key = baidu_api_key self.baidu_end_point = baidu_end_point @@ -152,19 +195,19 @@ class CheckAvailabilityParameters(msrest.serialization.Model): :ivar id: Resource Id. :vartype id: str - :param name: Required. Resource name. - :type name: str + :ivar name: Required. Resource name. + :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku - :param is_availiable: True if the name is available and can be used to create new + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar is_availiable: True if the name is available and can be used to create new Namespace/NotificationHub. Otherwise false. - :type is_availiable: bool + :vartype is_availiable: bool """ _validation = { @@ -193,6 +236,19 @@ def __init__( is_availiable: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Resource name. + :paramtype name: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + :keyword is_availiable: True if the name is available and can be used to create new + Namespace/NotificationHub. Otherwise false. + :paramtype is_availiable: bool + """ super(CheckAvailabilityParameters, self).__init__(**kwargs) self.id = None self.name = name @@ -214,12 +270,12 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku """ _validation = { @@ -245,6 +301,14 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -265,15 +329,15 @@ class CheckAvailabilityResult(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku - :param is_availiable: True if the name is available and can be used to create new + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar is_availiable: True if the name is available and can be used to create new Namespace/NotificationHub. Otherwise false. - :type is_availiable: bool + :vartype is_availiable: bool """ _validation = { @@ -301,6 +365,17 @@ def __init__( is_availiable: Optional[bool] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + :keyword is_availiable: True if the name is available and can be used to create new + Namespace/NotificationHub. Otherwise false. + :paramtype is_availiable: bool + """ super(CheckAvailabilityResult, self).__init__(location=location, tags=tags, sku=sku, **kwargs) self.is_availiable = is_availiable @@ -316,18 +391,18 @@ class DebugSendResponse(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku - :param success: successful send. - :type success: float - :param failure: send failure. - :type failure: float - :param results: actual failure description. - :type results: object + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar success: successful send. + :vartype success: float + :ivar failure: send failure. + :vartype failure: float + :ivar results: actual failure description. + :vartype results: any """ _validation = { @@ -356,9 +431,23 @@ def __init__( sku: Optional["Sku"] = None, success: Optional[float] = None, failure: Optional[float] = None, - results: Optional[object] = None, + results: Optional[Any] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + :keyword success: successful send. + :paramtype success: float + :keyword failure: send failure. + :paramtype failure: float + :keyword results: actual failure description. + :paramtype results: any + """ super(DebugSendResponse, self).__init__(location=location, tags=tags, sku=sku, **kwargs) self.success = success self.failure = failure @@ -368,10 +457,10 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Error response indicates NotificationHubs service is not able to process the incoming request. The reason is provided in the error message. - :param code: Error code. - :type code: str - :param message: Error message indicating why the operation failed. - :type message: str + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str """ _attribute_map = { @@ -386,6 +475,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: Error code. + :paramtype code: str + :keyword message: Error message indicating why the operation failed. + :paramtype message: str + """ super(ErrorResponse, self).__init__(**kwargs) self.code = code self.message = message @@ -394,11 +489,11 @@ def __init__( class GcmCredential(msrest.serialization.Model): """Description of a NotificationHub GcmCredential. - :param gcm_endpoint: The FCM legacy endpoint. Default value is + :ivar gcm_endpoint: The FCM legacy endpoint. Default value is 'https://fcm.googleapis.com/fcm/send'. - :type gcm_endpoint: str - :param google_api_key: The Google API key. - :type google_api_key: str + :vartype gcm_endpoint: str + :ivar google_api_key: The Google API key. + :vartype google_api_key: str """ _attribute_map = { @@ -413,6 +508,13 @@ def __init__( google_api_key: Optional[str] = None, **kwargs ): + """ + :keyword gcm_endpoint: The FCM legacy endpoint. Default value is + 'https://fcm.googleapis.com/fcm/send'. + :paramtype gcm_endpoint: str + :keyword google_api_key: The Google API key. + :paramtype google_api_key: str + """ super(GcmCredential, self).__init__(**kwargs) self.gcm_endpoint = gcm_endpoint self.google_api_key = google_api_key @@ -421,12 +523,12 @@ def __init__( class MpnsCredential(msrest.serialization.Model): """Description of a NotificationHub MpnsCredential. - :param mpns_certificate: The MPNS certificate. - :type mpns_certificate: str - :param certificate_key: The certificate key for this credential. - :type certificate_key: str - :param thumbprint: The MPNS certificate Thumbprint. - :type thumbprint: str + :ivar mpns_certificate: The MPNS certificate. + :vartype mpns_certificate: str + :ivar certificate_key: The certificate key for this credential. + :vartype certificate_key: str + :ivar thumbprint: The MPNS certificate Thumbprint. + :vartype thumbprint: str """ _attribute_map = { @@ -443,6 +545,14 @@ def __init__( thumbprint: Optional[str] = None, **kwargs ): + """ + :keyword mpns_certificate: The MPNS certificate. + :paramtype mpns_certificate: str + :keyword certificate_key: The certificate key for this credential. + :paramtype certificate_key: str + :keyword thumbprint: The MPNS certificate Thumbprint. + :paramtype thumbprint: str + """ super(MpnsCredential, self).__init__(**kwargs) self.mpns_certificate = mpns_certificate self.certificate_key = certificate_key @@ -460,45 +570,45 @@ class NamespaceCreateOrUpdateParameters(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku - :param name_properties_name: The name of the namespace. - :type name_properties_name: str - :param provisioning_state: Provisioning state of the Namespace. - :type provisioning_state: str - :param region: Specifies the targeted region in which the namespace should be created. It can - be any of the following values: Australia East, Australia Southeast, Central US, East US, East - US 2, West US, North Central US, South Central US, East Asia, Southeast Asia, Brazil South, - Japan East, Japan West, North Europe, West Europe. - :type region: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar name_properties_name: The name of the namespace. + :vartype name_properties_name: str + :ivar provisioning_state: Provisioning state of the Namespace. + :vartype provisioning_state: str + :ivar region: Specifies the targeted region in which the namespace should be created. It can be + any of the following values: Australia East, Australia Southeast, Central US, East US, East US + 2, West US, North Central US, South Central US, East Asia, Southeast Asia, Brazil South, Japan + East, Japan West, North Europe, West Europe. + :vartype region: str :ivar metric_id: Identifier for Azure Insights metrics. :vartype metric_id: str - :param status: Status of the namespace. It can be any of these values:1 = Created/Active2 = + :ivar status: Status of the namespace. It can be any of these values:1 = Created/Active2 = Creating3 = Suspended4 = Deleting. - :type status: str - :param created_at: The time the namespace was created. - :type created_at: ~datetime.datetime - :param updated_at: The time the namespace was updated. - :type updated_at: ~datetime.datetime - :param service_bus_endpoint: Endpoint you can use to perform NotificationHub operations. - :type service_bus_endpoint: str - :param subscription_id: The Id of the Azure subscription associated with the namespace. - :type subscription_id: str - :param scale_unit: ScaleUnit where the namespace gets created. - :type scale_unit: str - :param enabled: Whether or not the namespace is currently enabled. - :type enabled: bool - :param critical: Whether or not the namespace is set as Critical. - :type critical: bool - :param data_center: Data center for the namespace. - :type data_center: str - :param namespace_type: The namespace type. Possible values include: "Messaging", + :vartype status: str + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform NotificationHub operations. + :vartype service_bus_endpoint: str + :ivar subscription_id: The Id of the Azure subscription associated with the namespace. + :vartype subscription_id: str + :ivar scale_unit: ScaleUnit where the namespace gets created. + :vartype scale_unit: str + :ivar enabled: Whether or not the namespace is currently enabled. + :vartype enabled: bool + :ivar critical: Whether or not the namespace is set as Critical. + :vartype critical: bool + :ivar data_center: Data center for the namespace. + :vartype data_center: str + :ivar namespace_type: The namespace type. Possible values include: "Messaging", "NotificationHub". - :type namespace_type: str or ~azure.mgmt.notificationhubs.models.NamespaceType + :vartype namespace_type: str or ~azure.mgmt.notificationhubs.models.NamespaceType """ _validation = { @@ -552,6 +662,45 @@ def __init__( namespace_type: Optional[Union[str, "NamespaceType"]] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + :keyword name_properties_name: The name of the namespace. + :paramtype name_properties_name: str + :keyword provisioning_state: Provisioning state of the Namespace. + :paramtype provisioning_state: str + :keyword region: Specifies the targeted region in which the namespace should be created. It can + be any of the following values: Australia East, Australia Southeast, Central US, East US, East + US 2, West US, North Central US, South Central US, East Asia, Southeast Asia, Brazil South, + Japan East, Japan West, North Europe, West Europe. + :paramtype region: str + :keyword status: Status of the namespace. It can be any of these values:1 = Created/Active2 = + Creating3 = Suspended4 = Deleting. + :paramtype status: str + :keyword created_at: The time the namespace was created. + :paramtype created_at: ~datetime.datetime + :keyword updated_at: The time the namespace was updated. + :paramtype updated_at: ~datetime.datetime + :keyword service_bus_endpoint: Endpoint you can use to perform NotificationHub operations. + :paramtype service_bus_endpoint: str + :keyword subscription_id: The Id of the Azure subscription associated with the namespace. + :paramtype subscription_id: str + :keyword scale_unit: ScaleUnit where the namespace gets created. + :paramtype scale_unit: str + :keyword enabled: Whether or not the namespace is currently enabled. + :paramtype enabled: bool + :keyword critical: Whether or not the namespace is set as Critical. + :paramtype critical: bool + :keyword data_center: Data center for the namespace. + :paramtype data_center: str + :keyword namespace_type: The namespace type. Possible values include: "Messaging", + "NotificationHub". + :paramtype namespace_type: str or ~azure.mgmt.notificationhubs.models.NamespaceType + """ super(NamespaceCreateOrUpdateParameters, self).__init__(location=location, tags=tags, sku=sku, **kwargs) self.name_properties_name = name_properties_name self.provisioning_state = provisioning_state @@ -572,11 +721,11 @@ def __init__( class NamespaceListResult(msrest.serialization.Model): """The response of the List Namespace operation. - :param value: Result of the List Namespace operation. - :type value: list[~azure.mgmt.notificationhubs.models.NamespaceResource] - :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + :ivar value: Result of the List Namespace operation. + :vartype value: list[~azure.mgmt.notificationhubs.models.NamespaceResource] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of Namespaces. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -591,6 +740,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Result of the List Namespace operation. + :paramtype value: list[~azure.mgmt.notificationhubs.models.NamespaceResource] + :keyword next_link: Link to the next set of results. Not empty if Value contains incomplete + list of Namespaces. + :paramtype next_link: str + """ super(NamespaceListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -599,10 +755,10 @@ def __init__( class NamespacePatchParameters(msrest.serialization.Model): """Parameters supplied to the Patch Namespace operation. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku """ _attribute_map = { @@ -617,6 +773,12 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + """ super(NamespacePatchParameters, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -633,45 +795,45 @@ class NamespaceResource(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku - :param name_properties_name: The name of the namespace. - :type name_properties_name: str - :param provisioning_state: Provisioning state of the Namespace. - :type provisioning_state: str - :param region: Specifies the targeted region in which the namespace should be created. It can - be any of the following values: Australia East, Australia Southeast, Central US, East US, East - US 2, West US, North Central US, South Central US, East Asia, Southeast Asia, Brazil South, - Japan East, Japan West, North Europe, West Europe. - :type region: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar name_properties_name: The name of the namespace. + :vartype name_properties_name: str + :ivar provisioning_state: Provisioning state of the Namespace. + :vartype provisioning_state: str + :ivar region: Specifies the targeted region in which the namespace should be created. It can be + any of the following values: Australia East, Australia Southeast, Central US, East US, East US + 2, West US, North Central US, South Central US, East Asia, Southeast Asia, Brazil South, Japan + East, Japan West, North Europe, West Europe. + :vartype region: str :ivar metric_id: Identifier for Azure Insights metrics. :vartype metric_id: str - :param status: Status of the namespace. It can be any of these values:1 = Created/Active2 = + :ivar status: Status of the namespace. It can be any of these values:1 = Created/Active2 = Creating3 = Suspended4 = Deleting. - :type status: str - :param created_at: The time the namespace was created. - :type created_at: ~datetime.datetime - :param updated_at: The time the namespace was updated. - :type updated_at: ~datetime.datetime - :param service_bus_endpoint: Endpoint you can use to perform NotificationHub operations. - :type service_bus_endpoint: str - :param subscription_id: The Id of the Azure subscription associated with the namespace. - :type subscription_id: str - :param scale_unit: ScaleUnit where the namespace gets created. - :type scale_unit: str - :param enabled: Whether or not the namespace is currently enabled. - :type enabled: bool - :param critical: Whether or not the namespace is set as Critical. - :type critical: bool - :param data_center: Data center for the namespace. - :type data_center: str - :param namespace_type: The namespace type. Possible values include: "Messaging", + :vartype status: str + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform NotificationHub operations. + :vartype service_bus_endpoint: str + :ivar subscription_id: The Id of the Azure subscription associated with the namespace. + :vartype subscription_id: str + :ivar scale_unit: ScaleUnit where the namespace gets created. + :vartype scale_unit: str + :ivar enabled: Whether or not the namespace is currently enabled. + :vartype enabled: bool + :ivar critical: Whether or not the namespace is set as Critical. + :vartype critical: bool + :ivar data_center: Data center for the namespace. + :vartype data_center: str + :ivar namespace_type: The namespace type. Possible values include: "Messaging", "NotificationHub". - :type namespace_type: str or ~azure.mgmt.notificationhubs.models.NamespaceType + :vartype namespace_type: str or ~azure.mgmt.notificationhubs.models.NamespaceType """ _validation = { @@ -725,6 +887,45 @@ def __init__( namespace_type: Optional[Union[str, "NamespaceType"]] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + :keyword name_properties_name: The name of the namespace. + :paramtype name_properties_name: str + :keyword provisioning_state: Provisioning state of the Namespace. + :paramtype provisioning_state: str + :keyword region: Specifies the targeted region in which the namespace should be created. It can + be any of the following values: Australia East, Australia Southeast, Central US, East US, East + US 2, West US, North Central US, South Central US, East Asia, Southeast Asia, Brazil South, + Japan East, Japan West, North Europe, West Europe. + :paramtype region: str + :keyword status: Status of the namespace. It can be any of these values:1 = Created/Active2 = + Creating3 = Suspended4 = Deleting. + :paramtype status: str + :keyword created_at: The time the namespace was created. + :paramtype created_at: ~datetime.datetime + :keyword updated_at: The time the namespace was updated. + :paramtype updated_at: ~datetime.datetime + :keyword service_bus_endpoint: Endpoint you can use to perform NotificationHub operations. + :paramtype service_bus_endpoint: str + :keyword subscription_id: The Id of the Azure subscription associated with the namespace. + :paramtype subscription_id: str + :keyword scale_unit: ScaleUnit where the namespace gets created. + :paramtype scale_unit: str + :keyword enabled: Whether or not the namespace is currently enabled. + :paramtype enabled: bool + :keyword critical: Whether or not the namespace is set as Critical. + :paramtype critical: bool + :keyword data_center: Data center for the namespace. + :paramtype data_center: str + :keyword namespace_type: The namespace type. Possible values include: "Messaging", + "NotificationHub". + :paramtype namespace_type: str or ~azure.mgmt.notificationhubs.models.NamespaceType + """ super(NamespaceResource, self).__init__(location=location, tags=tags, sku=sku, **kwargs) self.name_properties_name = name_properties_name self.provisioning_state = provisioning_state @@ -753,31 +954,31 @@ class NotificationHubCreateOrUpdateParameters(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku - :param name_properties_name: The NotificationHub name. - :type name_properties_name: str - :param registration_ttl: The RegistrationTtl of the created NotificationHub. - :type registration_ttl: str - :param authorization_rules: The AuthorizationRules of the created NotificationHub. - :type authorization_rules: + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar name_properties_name: The NotificationHub name. + :vartype name_properties_name: str + :ivar registration_ttl: The RegistrationTtl of the created NotificationHub. + :vartype registration_ttl: str + :ivar authorization_rules: The AuthorizationRules of the created NotificationHub. + :vartype authorization_rules: list[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleProperties] - :param apns_credential: The ApnsCredential of the created NotificationHub. - :type apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential - :param wns_credential: The WnsCredential of the created NotificationHub. - :type wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential - :param gcm_credential: The GcmCredential of the created NotificationHub. - :type gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential - :param mpns_credential: The MpnsCredential of the created NotificationHub. - :type mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential - :param adm_credential: The AdmCredential of the created NotificationHub. - :type adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential - :param baidu_credential: The BaiduCredential of the created NotificationHub. - :type baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential + :ivar apns_credential: The ApnsCredential of the created NotificationHub. + :vartype apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential + :ivar wns_credential: The WnsCredential of the created NotificationHub. + :vartype wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential + :ivar gcm_credential: The GcmCredential of the created NotificationHub. + :vartype gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential + :ivar mpns_credential: The MpnsCredential of the created NotificationHub. + :vartype mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential + :ivar adm_credential: The AdmCredential of the created NotificationHub. + :vartype adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential + :ivar baidu_credential: The BaiduCredential of the created NotificationHub. + :vartype baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential """ _validation = { @@ -821,6 +1022,33 @@ def __init__( baidu_credential: Optional["BaiduCredential"] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + :keyword name_properties_name: The NotificationHub name. + :paramtype name_properties_name: str + :keyword registration_ttl: The RegistrationTtl of the created NotificationHub. + :paramtype registration_ttl: str + :keyword authorization_rules: The AuthorizationRules of the created NotificationHub. + :paramtype authorization_rules: + list[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleProperties] + :keyword apns_credential: The ApnsCredential of the created NotificationHub. + :paramtype apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential + :keyword wns_credential: The WnsCredential of the created NotificationHub. + :paramtype wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential + :keyword gcm_credential: The GcmCredential of the created NotificationHub. + :paramtype gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential + :keyword mpns_credential: The MpnsCredential of the created NotificationHub. + :paramtype mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential + :keyword adm_credential: The AdmCredential of the created NotificationHub. + :paramtype adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential + :keyword baidu_credential: The BaiduCredential of the created NotificationHub. + :paramtype baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential + """ super(NotificationHubCreateOrUpdateParameters, self).__init__(location=location, tags=tags, sku=sku, **kwargs) self.name_properties_name = name_properties_name self.registration_ttl = registration_ttl @@ -836,11 +1064,11 @@ def __init__( class NotificationHubListResult(msrest.serialization.Model): """The response of the List NotificationHub operation. - :param value: Result of the List NotificationHub operation. - :type value: list[~azure.mgmt.notificationhubs.models.NotificationHubResource] - :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + :ivar value: Result of the List NotificationHub operation. + :vartype value: list[~azure.mgmt.notificationhubs.models.NotificationHubResource] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of NotificationHub. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -855,6 +1083,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Result of the List NotificationHub operation. + :paramtype value: list[~azure.mgmt.notificationhubs.models.NotificationHubResource] + :keyword next_link: Link to the next set of results. Not empty if Value contains incomplete + list of NotificationHub. + :paramtype next_link: str + """ super(NotificationHubListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -871,31 +1106,31 @@ class NotificationHubPatchParameters(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku - :param name_properties_name: The NotificationHub name. - :type name_properties_name: str - :param registration_ttl: The RegistrationTtl of the created NotificationHub. - :type registration_ttl: str - :param authorization_rules: The AuthorizationRules of the created NotificationHub. - :type authorization_rules: + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar name_properties_name: The NotificationHub name. + :vartype name_properties_name: str + :ivar registration_ttl: The RegistrationTtl of the created NotificationHub. + :vartype registration_ttl: str + :ivar authorization_rules: The AuthorizationRules of the created NotificationHub. + :vartype authorization_rules: list[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleProperties] - :param apns_credential: The ApnsCredential of the created NotificationHub. - :type apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential - :param wns_credential: The WnsCredential of the created NotificationHub. - :type wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential - :param gcm_credential: The GcmCredential of the created NotificationHub. - :type gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential - :param mpns_credential: The MpnsCredential of the created NotificationHub. - :type mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential - :param adm_credential: The AdmCredential of the created NotificationHub. - :type adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential - :param baidu_credential: The BaiduCredential of the created NotificationHub. - :type baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential + :ivar apns_credential: The ApnsCredential of the created NotificationHub. + :vartype apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential + :ivar wns_credential: The WnsCredential of the created NotificationHub. + :vartype wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential + :ivar gcm_credential: The GcmCredential of the created NotificationHub. + :vartype gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential + :ivar mpns_credential: The MpnsCredential of the created NotificationHub. + :vartype mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential + :ivar adm_credential: The AdmCredential of the created NotificationHub. + :vartype adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential + :ivar baidu_credential: The BaiduCredential of the created NotificationHub. + :vartype baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential """ _validation = { @@ -939,6 +1174,33 @@ def __init__( baidu_credential: Optional["BaiduCredential"] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + :keyword name_properties_name: The NotificationHub name. + :paramtype name_properties_name: str + :keyword registration_ttl: The RegistrationTtl of the created NotificationHub. + :paramtype registration_ttl: str + :keyword authorization_rules: The AuthorizationRules of the created NotificationHub. + :paramtype authorization_rules: + list[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleProperties] + :keyword apns_credential: The ApnsCredential of the created NotificationHub. + :paramtype apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential + :keyword wns_credential: The WnsCredential of the created NotificationHub. + :paramtype wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential + :keyword gcm_credential: The GcmCredential of the created NotificationHub. + :paramtype gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential + :keyword mpns_credential: The MpnsCredential of the created NotificationHub. + :paramtype mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential + :keyword adm_credential: The AdmCredential of the created NotificationHub. + :paramtype adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential + :keyword baidu_credential: The BaiduCredential of the created NotificationHub. + :paramtype baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential + """ super(NotificationHubPatchParameters, self).__init__(location=location, tags=tags, sku=sku, **kwargs) self.name_properties_name = name_properties_name self.registration_ttl = registration_ttl @@ -962,31 +1224,31 @@ class NotificationHubResource(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku - :param name_properties_name: The NotificationHub name. - :type name_properties_name: str - :param registration_ttl: The RegistrationTtl of the created NotificationHub. - :type registration_ttl: str - :param authorization_rules: The AuthorizationRules of the created NotificationHub. - :type authorization_rules: + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar name_properties_name: The NotificationHub name. + :vartype name_properties_name: str + :ivar registration_ttl: The RegistrationTtl of the created NotificationHub. + :vartype registration_ttl: str + :ivar authorization_rules: The AuthorizationRules of the created NotificationHub. + :vartype authorization_rules: list[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleProperties] - :param apns_credential: The ApnsCredential of the created NotificationHub. - :type apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential - :param wns_credential: The WnsCredential of the created NotificationHub. - :type wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential - :param gcm_credential: The GcmCredential of the created NotificationHub. - :type gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential - :param mpns_credential: The MpnsCredential of the created NotificationHub. - :type mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential - :param adm_credential: The AdmCredential of the created NotificationHub. - :type adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential - :param baidu_credential: The BaiduCredential of the created NotificationHub. - :type baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential + :ivar apns_credential: The ApnsCredential of the created NotificationHub. + :vartype apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential + :ivar wns_credential: The WnsCredential of the created NotificationHub. + :vartype wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential + :ivar gcm_credential: The GcmCredential of the created NotificationHub. + :vartype gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential + :ivar mpns_credential: The MpnsCredential of the created NotificationHub. + :vartype mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential + :ivar adm_credential: The AdmCredential of the created NotificationHub. + :vartype adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential + :ivar baidu_credential: The BaiduCredential of the created NotificationHub. + :vartype baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential """ _validation = { @@ -1030,6 +1292,33 @@ def __init__( baidu_credential: Optional["BaiduCredential"] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + :keyword name_properties_name: The NotificationHub name. + :paramtype name_properties_name: str + :keyword registration_ttl: The RegistrationTtl of the created NotificationHub. + :paramtype registration_ttl: str + :keyword authorization_rules: The AuthorizationRules of the created NotificationHub. + :paramtype authorization_rules: + list[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleProperties] + :keyword apns_credential: The ApnsCredential of the created NotificationHub. + :paramtype apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential + :keyword wns_credential: The WnsCredential of the created NotificationHub. + :paramtype wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential + :keyword gcm_credential: The GcmCredential of the created NotificationHub. + :paramtype gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential + :keyword mpns_credential: The MpnsCredential of the created NotificationHub. + :paramtype mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential + :keyword adm_credential: The AdmCredential of the created NotificationHub. + :paramtype adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential + :keyword baidu_credential: The BaiduCredential of the created NotificationHub. + :paramtype baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential + """ super(NotificationHubResource, self).__init__(location=location, tags=tags, sku=sku, **kwargs) self.name_properties_name = name_properties_name self.registration_ttl = registration_ttl @@ -1049,8 +1338,8 @@ class Operation(msrest.serialization.Model): :ivar name: Operation name: {provider}/{resource}/{operation}. :vartype name: str - :param display: The object that represents the operation. - :type display: ~azure.mgmt.notificationhubs.models.OperationDisplay + :ivar display: The object that represents the operation. + :vartype display: ~azure.mgmt.notificationhubs.models.OperationDisplay """ _validation = { @@ -1068,6 +1357,10 @@ def __init__( display: Optional["OperationDisplay"] = None, **kwargs ): + """ + :keyword display: The object that represents the operation. + :paramtype display: ~azure.mgmt.notificationhubs.models.OperationDisplay + """ super(Operation, self).__init__(**kwargs) self.name = None self.display = display @@ -1102,6 +1395,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = None self.resource = None @@ -1134,6 +1429,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1150,24 +1447,24 @@ class PnsCredentialsResource(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku - :param apns_credential: The ApnsCredential of the created NotificationHub. - :type apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential - :param wns_credential: The WnsCredential of the created NotificationHub. - :type wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential - :param gcm_credential: The GcmCredential of the created NotificationHub. - :type gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential - :param mpns_credential: The MpnsCredential of the created NotificationHub. - :type mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential - :param adm_credential: The AdmCredential of the created NotificationHub. - :type adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential - :param baidu_credential: The BaiduCredential of the created NotificationHub. - :type baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar apns_credential: The ApnsCredential of the created NotificationHub. + :vartype apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential + :ivar wns_credential: The WnsCredential of the created NotificationHub. + :vartype wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential + :ivar gcm_credential: The GcmCredential of the created NotificationHub. + :vartype gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential + :ivar mpns_credential: The MpnsCredential of the created NotificationHub. + :vartype mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential + :ivar adm_credential: The AdmCredential of the created NotificationHub. + :vartype adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential + :ivar baidu_credential: The BaiduCredential of the created NotificationHub. + :vartype baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential """ _validation = { @@ -1205,6 +1502,26 @@ def __init__( baidu_credential: Optional["BaiduCredential"] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + :keyword apns_credential: The ApnsCredential of the created NotificationHub. + :paramtype apns_credential: ~azure.mgmt.notificationhubs.models.ApnsCredential + :keyword wns_credential: The WnsCredential of the created NotificationHub. + :paramtype wns_credential: ~azure.mgmt.notificationhubs.models.WnsCredential + :keyword gcm_credential: The GcmCredential of the created NotificationHub. + :paramtype gcm_credential: ~azure.mgmt.notificationhubs.models.GcmCredential + :keyword mpns_credential: The MpnsCredential of the created NotificationHub. + :paramtype mpns_credential: ~azure.mgmt.notificationhubs.models.MpnsCredential + :keyword adm_credential: The AdmCredential of the created NotificationHub. + :paramtype adm_credential: ~azure.mgmt.notificationhubs.models.AdmCredential + :keyword baidu_credential: The BaiduCredential of the created NotificationHub. + :paramtype baidu_credential: ~azure.mgmt.notificationhubs.models.BaiduCredential + """ super(PnsCredentialsResource, self).__init__(location=location, tags=tags, sku=sku, **kwargs) self.apns_credential = apns_credential self.wns_credential = wns_credential @@ -1217,9 +1534,9 @@ def __init__( class PolicykeyResource(msrest.serialization.Model): """Namespace/NotificationHub Regenerate Keys. - :param policy_key: Name of the key that has to be regenerated for the Namespace/Notification - Hub Authorization Rule. The value can be Primary Key/Secondary Key. - :type policy_key: str + :ivar policy_key: Name of the key that has to be regenerated for the Namespace/Notification Hub + Authorization Rule. The value can be Primary Key/Secondary Key. + :vartype policy_key: str """ _attribute_map = { @@ -1232,6 +1549,11 @@ def __init__( policy_key: Optional[str] = None, **kwargs ): + """ + :keyword policy_key: Name of the key that has to be regenerated for the Namespace/Notification + Hub Authorization Rule. The value can be Primary Key/Secondary Key. + :paramtype policy_key: str + """ super(PolicykeyResource, self).__init__(**kwargs) self.policy_key = policy_key @@ -1239,16 +1561,16 @@ def __init__( class ResourceListKeys(msrest.serialization.Model): """Namespace/NotificationHub Connection String. - :param primary_connection_string: PrimaryConnectionString of the AuthorizationRule. - :type primary_connection_string: str - :param secondary_connection_string: SecondaryConnectionString of the created AuthorizationRule. - :type secondary_connection_string: str - :param primary_key: PrimaryKey of the created AuthorizationRule. - :type primary_key: str - :param secondary_key: SecondaryKey of the created AuthorizationRule. - :type secondary_key: str - :param key_name: KeyName of the created AuthorizationRule. - :type key_name: str + :ivar primary_connection_string: PrimaryConnectionString of the AuthorizationRule. + :vartype primary_connection_string: str + :ivar secondary_connection_string: SecondaryConnectionString of the created AuthorizationRule. + :vartype secondary_connection_string: str + :ivar primary_key: PrimaryKey of the created AuthorizationRule. + :vartype primary_key: str + :ivar secondary_key: SecondaryKey of the created AuthorizationRule. + :vartype secondary_key: str + :ivar key_name: KeyName of the created AuthorizationRule. + :vartype key_name: str """ _attribute_map = { @@ -1269,6 +1591,19 @@ def __init__( key_name: Optional[str] = None, **kwargs ): + """ + :keyword primary_connection_string: PrimaryConnectionString of the AuthorizationRule. + :paramtype primary_connection_string: str + :keyword secondary_connection_string: SecondaryConnectionString of the created + AuthorizationRule. + :paramtype secondary_connection_string: str + :keyword primary_key: PrimaryKey of the created AuthorizationRule. + :paramtype primary_key: str + :keyword secondary_key: SecondaryKey of the created AuthorizationRule. + :paramtype secondary_key: str + :keyword key_name: KeyName of the created AuthorizationRule. + :paramtype key_name: str + """ super(ResourceListKeys, self).__init__(**kwargs) self.primary_connection_string = primary_connection_string self.secondary_connection_string = secondary_connection_string @@ -1282,8 +1617,9 @@ class SharedAccessAuthorizationRuleCreateOrUpdateParameters(msrest.serialization All required parameters must be populated in order to send to Azure. - :param properties: Required. Properties of the Namespace AuthorizationRules. - :type properties: ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleProperties + :ivar properties: Required. Properties of the Namespace AuthorizationRules. + :vartype properties: + ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleProperties """ _validation = { @@ -1300,6 +1636,11 @@ def __init__( properties: "SharedAccessAuthorizationRuleProperties", **kwargs ): + """ + :keyword properties: Required. Properties of the Namespace AuthorizationRules. + :paramtype properties: + ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleProperties + """ super(SharedAccessAuthorizationRuleCreateOrUpdateParameters, self).__init__(**kwargs) self.properties = properties @@ -1307,11 +1648,11 @@ def __init__( class SharedAccessAuthorizationRuleListResult(msrest.serialization.Model): """The response of the List Namespace operation. - :param value: Result of the List AuthorizationRules operation. - :type value: list[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleResource] - :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + :ivar value: Result of the List AuthorizationRules operation. + :vartype value: list[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleResource] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of AuthorizationRules. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1326,6 +1667,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Result of the List AuthorizationRules operation. + :paramtype value: + list[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleResource] + :keyword next_link: Link to the next set of results. Not empty if Value contains incomplete + list of AuthorizationRules. + :paramtype next_link: str + """ super(SharedAccessAuthorizationRuleListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1336,8 +1685,8 @@ class SharedAccessAuthorizationRuleProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param rights: The rights associated with the rule. - :type rights: list[str or ~azure.mgmt.notificationhubs.models.AccessRights] + :ivar rights: The rights associated with the rule. + :vartype rights: list[str or ~azure.mgmt.notificationhubs.models.AccessRights] :ivar primary_key: A base64-encoded 256-bit primary key for signing and validating the SAS token. :vartype primary_key: str @@ -1387,6 +1736,10 @@ def __init__( rights: Optional[List[Union[str, "AccessRights"]]] = None, **kwargs ): + """ + :keyword rights: The rights associated with the rule. + :paramtype rights: list[str or ~azure.mgmt.notificationhubs.models.AccessRights] + """ super(SharedAccessAuthorizationRuleProperties, self).__init__(**kwargs) self.rights = rights self.primary_key = None @@ -1410,14 +1763,14 @@ class SharedAccessAuthorizationRuleResource(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The sku of the created namespace. - :type sku: ~azure.mgmt.notificationhubs.models.Sku - :param rights: The rights associated with the rule. - :type rights: list[str or ~azure.mgmt.notificationhubs.models.AccessRights] + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The sku of the created namespace. + :vartype sku: ~azure.mgmt.notificationhubs.models.Sku + :ivar rights: The rights associated with the rule. + :vartype rights: list[str or ~azure.mgmt.notificationhubs.models.AccessRights] :ivar primary_key: A base64-encoded 256-bit primary key for signing and validating the SAS token. :vartype primary_key: str @@ -1479,6 +1832,16 @@ def __init__( rights: Optional[List[Union[str, "AccessRights"]]] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the created namespace. + :paramtype sku: ~azure.mgmt.notificationhubs.models.Sku + :keyword rights: The rights associated with the rule. + :paramtype rights: list[str or ~azure.mgmt.notificationhubs.models.AccessRights] + """ super(SharedAccessAuthorizationRuleResource, self).__init__(location=location, tags=tags, sku=sku, **kwargs) self.rights = rights self.primary_key = None @@ -1496,17 +1859,17 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the notification hub sku. Possible values include: "Free", + :ivar name: Required. Name of the notification hub sku. Possible values include: "Free", "Basic", "Standard". - :type name: str or ~azure.mgmt.notificationhubs.models.SkuName - :param tier: The tier of particular sku. - :type tier: str - :param size: The Sku size. - :type size: str - :param family: The Sku Family. - :type family: str - :param capacity: The capacity of the resource. - :type capacity: int + :vartype name: str or ~azure.mgmt.notificationhubs.models.SkuName + :ivar tier: The tier of particular sku. + :vartype tier: str + :ivar size: The Sku size. + :vartype size: str + :ivar family: The Sku Family. + :vartype family: str + :ivar capacity: The capacity of the resource. + :vartype capacity: int """ _validation = { @@ -1531,6 +1894,19 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: Required. Name of the notification hub sku. Possible values include: "Free", + "Basic", "Standard". + :paramtype name: str or ~azure.mgmt.notificationhubs.models.SkuName + :keyword tier: The tier of particular sku. + :paramtype tier: str + :keyword size: The Sku size. + :paramtype size: str + :keyword family: The Sku Family. + :paramtype family: str + :keyword capacity: The capacity of the resource. + :paramtype capacity: int + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -1542,8 +1918,8 @@ def __init__( class SubResource(msrest.serialization.Model): """SubResource. - :param id: Resource Id. - :type id: str + :ivar id: Resource Id. + :vartype id: str """ _attribute_map = { @@ -1556,6 +1932,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SubResource, self).__init__(**kwargs) self.id = id @@ -1563,12 +1943,12 @@ def __init__( class WnsCredential(msrest.serialization.Model): """Description of a NotificationHub WnsCredential. - :param package_sid: The package ID for this credential. - :type package_sid: str - :param secret_key: The secret key. - :type secret_key: str - :param windows_live_endpoint: The Windows Live endpoint. - :type windows_live_endpoint: str + :ivar package_sid: The package ID for this credential. + :vartype package_sid: str + :ivar secret_key: The secret key. + :vartype secret_key: str + :ivar windows_live_endpoint: The Windows Live endpoint. + :vartype windows_live_endpoint: str """ _attribute_map = { @@ -1585,6 +1965,14 @@ def __init__( windows_live_endpoint: Optional[str] = None, **kwargs ): + """ + :keyword package_sid: The package ID for this credential. + :paramtype package_sid: str + :keyword secret_key: The secret key. + :paramtype secret_key: str + :keyword windows_live_endpoint: The Windows Live endpoint. + :paramtype windows_live_endpoint: str + """ super(WnsCredential, self).__init__(**kwargs) self.package_sid = package_sid self.secret_key = secret_key diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/_notification_hubs_management_client_enums.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/_notification_hubs_management_client_enums.py index 07487c5d1327..312a59848261 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/_notification_hubs_management_client_enums.py +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/_notification_hubs_management_client_enums.py @@ -6,40 +6,25 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -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 AccessRights(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessRights(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGE = "Manage" SEND = "Send" LISTEN = "Listen" -class NamespaceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NamespaceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The namespace type. """ MESSAGING = "Messaging" NOTIFICATION_HUB = "NotificationHub" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Name of the notification hub sku """ diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/_namespaces_operations.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/_namespaces_operations.py index 14a636dfb360..ac20040f6f57 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/_namespaces_operations.py +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/_namespaces_operations.py @@ -5,26 +5,510 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_check_availability_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/checkNamespaceAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + namespace_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_patch_request( + resource_group_name, # type: str + namespace_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name, # type: str + namespace_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2017-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + namespace_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_authorization_rule_request( + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_authorization_rule_request( + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2017-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_authorization_rule_request( + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_all_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/namespaces') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_authorization_rules_request( + resource_group_name, # type: str + namespace_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_keys_request( + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_keys_request( + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class NamespacesOperations(object): """NamespacesOperations operations. @@ -47,6 +531,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_availability( self, parameters, # type: "_models.CheckAvailabilityParameters" @@ -68,30 +553,20 @@ def check_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_availability.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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'CheckAvailabilityParameters') + + request = build_check_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CheckAvailabilityParameters') - 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 @@ -105,8 +580,11 @@ def check_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/checkNamespaceAvailability'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -134,32 +612,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'NamespaceCreateOrUpdateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NamespaceCreateOrUpdateParameters') - 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 @@ -177,8 +645,11 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}'} # type: ignore + + @distributed_trace def patch( self, resource_group_name, # type: str @@ -205,32 +676,22 @@ def patch( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'NamespacePatchParameters') + + request = build_patch_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NamespacePatchParameters') - 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 @@ -244,8 +705,10 @@ def patch( return cls(pipeline_response, deserialized, {}) return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}'} # type: ignore + def _delete_initial( self, resource_group_name, # type: str @@ -258,25 +721,17 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, '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] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -289,6 +744,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -305,15 +762,17 @@ def begin_delete( :type namespace_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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in 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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -327,21 +786,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -353,8 +805,10 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}'} # type: ignore + @distributed_trace def get( self, resource_group_name, # type: str @@ -378,27 +832,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -412,8 +856,11 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}'} # type: ignore + + @distributed_trace def create_or_update_authorization_rule( self, resource_group_name, # type: str @@ -432,7 +879,8 @@ def create_or_update_authorization_rule( :param authorization_rule_name: Authorization Rule Name. :type authorization_rule_name: str :param parameters: The shared access authorization rule. - :type parameters: ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + :type parameters: + ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) :rtype: ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleResource @@ -443,33 +891,23 @@ def create_or_update_authorization_rule( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + + request = build_create_or_update_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update_authorization_rule.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') - 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 @@ -483,8 +921,11 @@ def create_or_update_authorization_rule( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + @distributed_trace def delete_authorization_rule( self, resource_group_name, # type: str @@ -511,26 +952,18 @@ def delete_authorization_rule( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - - # Construct URL - url = self.delete_authorization_rule.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, '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] + + request = build_delete_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + template_url=self.delete_authorization_rule.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -543,6 +976,8 @@ def delete_authorization_rule( delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + @distributed_trace def get_authorization_rule( self, resource_group_name, # type: str @@ -569,28 +1004,18 @@ def get_authorization_rule( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - accept = "application/json" - - # Construct URL - url = self.get_authorization_rule.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + template_url=self.get_authorization_rule.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -604,8 +1029,11 @@ def get_authorization_rule( return cls(pipeline_response, deserialized, {}) return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name, # type: str @@ -627,35 +1055,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('NamespaceListResult', pipeline_response) + deserialized = self._deserialize("NamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -673,11 +1097,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces'} # type: ignore + @distributed_trace def list_all( self, **kwargs # type: Any @@ -695,34 +1121,29 @@ def list_all( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - 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_all.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) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('NamespaceListResult', pipeline_response) + deserialized = self._deserialize("NamespaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -740,11 +1161,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/namespaces'} # type: ignore + @distributed_trace def list_authorization_rules( self, resource_group_name, # type: str @@ -759,8 +1182,10 @@ def list_authorization_rules( :param namespace_name: The namespace name. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleListResult] + :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleListResult"] @@ -768,36 +1193,33 @@ def list_authorization_rules( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - 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_authorization_rules.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, '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) + + request = build_list_authorization_rules_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + template_url=self.list_authorization_rules.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_authorization_rules_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SharedAccessAuthorizationRuleListResult', pipeline_response) + deserialized = self._deserialize("SharedAccessAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -815,11 +1237,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules'} # type: ignore + @distributed_trace def list_keys( self, resource_group_name, # type: str @@ -827,7 +1251,7 @@ def list_keys( authorization_rule_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.SharedAccessAuthorizationRuleListResult" + # type: (...) -> "_models.ResourceListKeys" """Gets the Primary and Secondary ConnectionStrings to the namespace. :param resource_group_name: The name of the resource group. @@ -838,37 +1262,27 @@ def list_keys( authorizationRule. :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SharedAccessAuthorizationRuleListResult, or the result of cls(response) - :rtype: ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleListResult + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.notificationhubs.models.ResourceListKeys :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -876,14 +1290,17 @@ def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SharedAccessAuthorizationRuleListResult', pipeline_response) + deserialized = self._deserialize('ResourceListKeys', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys'} # type: ignore + + @distributed_trace def regenerate_keys( self, resource_group_name, # type: str @@ -914,33 +1331,23 @@ def regenerate_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'PolicykeyResource') + + request = build_regenerate_keys_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PolicykeyResource') - 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 @@ -954,4 +1361,6 @@ def regenerate_keys( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/_notification_hubs_operations.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/_notification_hubs_operations.py index 8c0f5068e04d..f11cb4c776bb 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/_notification_hubs_operations.py +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/_notification_hubs_operations.py @@ -5,24 +5,582 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_check_notification_hub_availability_request( + resource_group_name, # type: str + namespace_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/checkNotificationHubAvailability') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + namespace_name, # type: str + notification_hub_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "notificationHubName": _SERIALIZER.url("notification_hub_name", notification_hub_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_patch_request( + resource_group_name, # type: str + namespace_name, # type: str + notification_hub_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "notificationHubName": _SERIALIZER.url("notification_hub_name", notification_hub_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + namespace_name, # type: str + notification_hub_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2017-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "notificationHubName": _SERIALIZER.url("notification_hub_name", notification_hub_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + namespace_name, # type: str + notification_hub_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "notificationHubName": _SERIALIZER.url("notification_hub_name", notification_hub_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_debug_send_request( + resource_group_name, # type: str + namespace_name, # type: str + notification_hub_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/debugsend') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "notificationHubName": _SERIALIZER.url("notification_hub_name", notification_hub_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_authorization_rule_request( + resource_group_name, # type: str + namespace_name, # type: str + notification_hub_name, # type: str + authorization_rule_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "notificationHubName": _SERIALIZER.url("notification_hub_name", notification_hub_name, 'str'), + "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_authorization_rule_request( + resource_group_name, # type: str + namespace_name, # type: str + notification_hub_name, # type: str + authorization_rule_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2017-04-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "notificationHubName": _SERIALIZER.url("notification_hub_name", notification_hub_name, 'str'), + "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_authorization_rule_request( + resource_group_name, # type: str + namespace_name, # type: str + notification_hub_name, # type: str + authorization_rule_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "notificationHubName": _SERIALIZER.url("notification_hub_name", notification_hub_name, 'str'), + "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name, # type: str + namespace_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_authorization_rules_request( + resource_group_name, # type: str + namespace_name, # type: str + notification_hub_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "notificationHubName": _SERIALIZER.url("notification_hub_name", notification_hub_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_keys_request( + resource_group_name, # type: str + namespace_name, # type: str + notification_hub_name, # type: str + authorization_rule_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/listKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "notificationHubName": _SERIALIZER.url("notification_hub_name", notification_hub_name, 'str'), + "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_keys_request( + resource_group_name, # type: str + namespace_name, # type: str + notification_hub_name, # type: str + authorization_rule_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "notificationHubName": _SERIALIZER.url("notification_hub_name", notification_hub_name, 'str'), + "authorizationRuleName": _SERIALIZER.url("authorization_rule_name", authorization_rule_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_pns_credentials_request( + resource_group_name, # type: str + namespace_name, # type: str + notification_hub_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/pnsCredentials') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "namespaceName": _SERIALIZER.url("namespace_name", namespace_name, 'str'), + "notificationHubName": _SERIALIZER.url("notification_hub_name", notification_hub_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class NotificationHubsOperations(object): """NotificationHubsOperations operations. @@ -45,6 +603,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_notification_hub_availability( self, resource_group_name, # type: str @@ -71,32 +630,22 @@ def check_notification_hub_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_notification_hub_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'CheckAvailabilityParameters') + + request = build_check_notification_hub_availability_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_notification_hub_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CheckAvailabilityParameters') - 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 @@ -110,8 +659,11 @@ def check_notification_hub_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_notification_hub_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/checkNotificationHubAvailability'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -141,33 +693,23 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'NotificationHubCreateOrUpdateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NotificationHubCreateOrUpdateParameters') - 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 @@ -185,8 +727,11 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}'} # type: ignore + + @distributed_trace def patch( self, resource_group_name, # type: str @@ -216,36 +761,26 @@ def patch( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'NotificationHubPatchParameters') + _json = self._serialize.body(parameters, 'NotificationHubPatchParameters') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_patch_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -259,8 +794,11 @@ def patch( return cls(pipeline_response, deserialized, {}) return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -287,26 +825,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, '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] + + request = build_delete_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -319,6 +849,8 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -345,28 +877,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -380,14 +902,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}'} # type: ignore + + @distributed_trace def debug_send( self, resource_group_name, # type: str namespace_name, # type: str notification_hub_name, # type: str - parameters=None, # type: Optional[object] + parameters=None, # type: Any **kwargs # type: Any ): # type: (...) -> "_models.DebugSendResponse" @@ -400,7 +925,7 @@ def debug_send( :param notification_hub_name: The notification hub name. :type notification_hub_name: str :param parameters: Debug send parameters. - :type parameters: object + :type parameters: any :keyword callable cls: A custom type or function that will be passed the direct response :return: DebugSendResponse, or the result of cls(response) :rtype: ~azure.mgmt.notificationhubs.models.DebugSendResponse @@ -411,36 +936,26 @@ def debug_send( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.debug_send.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'object') + _json = self._serialize.body(parameters, 'object') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_debug_send_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.debug_send.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -454,8 +969,11 @@ def debug_send( return cls(pipeline_response, deserialized, {}) return deserialized + debug_send.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/debugsend'} # type: ignore + + @distributed_trace def create_or_update_authorization_rule( self, resource_group_name, # type: str @@ -477,7 +995,8 @@ def create_or_update_authorization_rule( :param authorization_rule_name: Authorization Rule Name. :type authorization_rule_name: str :param parameters: The shared access authorization rule. - :type parameters: ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + :type parameters: + ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) :rtype: ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleResource @@ -488,34 +1007,24 @@ def create_or_update_authorization_rule( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, 'str'), - 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + + request = build_create_or_update_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update_authorization_rule.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') - 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 @@ -529,8 +1038,11 @@ def create_or_update_authorization_rule( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + @distributed_trace def delete_authorization_rule( self, resource_group_name, # type: str @@ -560,27 +1072,19 @@ def delete_authorization_rule( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - - # Construct URL - url = self.delete_authorization_rule.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, 'str'), - 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, '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] + + request = build_delete_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + template_url=self.delete_authorization_rule.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -593,6 +1097,8 @@ def delete_authorization_rule( delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + @distributed_trace def get_authorization_rule( self, resource_group_name, # type: str @@ -622,29 +1128,19 @@ def get_authorization_rule( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - accept = "application/json" - - # Construct URL - url = self.get_authorization_rule.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, 'str'), - 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_authorization_rule_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + template_url=self.get_authorization_rule.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -658,8 +1154,11 @@ def get_authorization_rule( return cls(pipeline_response, deserialized, {}) return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name, # type: str @@ -674,8 +1173,10 @@ def list( :param namespace_name: The namespace name. :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NotificationHubListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.notificationhubs.models.NotificationHubListResult] + :return: An iterator like instance of either NotificationHubListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.notificationhubs.models.NotificationHubListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NotificationHubListResult"] @@ -683,36 +1184,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, '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) + + request = build_list_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('NotificationHubListResult', pipeline_response) + deserialized = self._deserialize("NotificationHubListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -730,11 +1228,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs'} # type: ignore + @distributed_trace def list_authorization_rules( self, resource_group_name, # type: str @@ -752,8 +1252,10 @@ def list_authorization_rules( :param notification_hub_name: The notification hub name. :type notification_hub_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleListResult] + :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleListResult"] @@ -761,37 +1263,35 @@ def list_authorization_rules( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - 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_authorization_rules.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, '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) + + request = build_list_authorization_rules_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + subscription_id=self._config.subscription_id, + template_url=self.list_authorization_rules.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_authorization_rules_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SharedAccessAuthorizationRuleListResult', pipeline_response) + deserialized = self._deserialize("SharedAccessAuthorizationRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -809,11 +1309,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules'} # type: ignore + @distributed_trace def list_keys( self, resource_group_name, # type: str @@ -844,29 +1346,19 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, 'str'), - 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -880,8 +1372,11 @@ def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/listKeys'} # type: ignore + + @distributed_trace def regenerate_keys( self, resource_group_name, # type: str @@ -916,34 +1411,24 @@ def regenerate_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, 'str'), - 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'PolicykeyResource') + + request = build_regenerate_keys_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + authorization_rule_name=authorization_rule_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PolicykeyResource') - 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 @@ -957,8 +1442,11 @@ def regenerate_keys( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + @distributed_trace def get_pns_credentials( self, resource_group_name, # type: str @@ -985,28 +1473,18 @@ def get_pns_credentials( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - accept = "application/json" - - # Construct URL - url = self.get_pns_credentials.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), - 'notificationHubName': self._serialize.url("notification_hub_name", notification_hub_name, '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_pns_credentials_request( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + notification_hub_name=notification_hub_name, + subscription_id=self._config.subscription_id, + template_url=self.get_pns_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1020,4 +1498,6 @@ def get_pns_credentials( return cls(pipeline_response, deserialized, {}) return deserialized + get_pns_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/pnsCredentials'} # type: ignore + diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/_operations.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/_operations.py index 64a374690925..19376e9908da 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/_operations.py +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/_operations.py @@ -5,24 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2017-04-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.NotificationHubs/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -62,30 +97,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" - 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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,12 +130,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/dev_requirements.txt b/sdk/notificationhubs/azure-mgmt-notificationhubs/dev_requirements.txt index 1a1c8d8fc379..00bff4da2800 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/dev_requirements.txt +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/dev_requirements.txt @@ -1,2 +1,3 @@ -e ../../../tools/azure-sdk-tools --e ../../../tools/azure-devtools \ No newline at end of file +-e ../../../tools/azure-devtools +../../identity/azure-identity \ No newline at end of file diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/setup.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/setup.py index f7e5651f4189..eeb2ec32a09d 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/setup.py +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/setup.py @@ -83,7 +83,7 @@ install_requires=[ 'msrest>=0.6.21', 'azure-common~=1.1', - 'azure-mgmt-core>=1.2.0,<2.0.0', + 'azure-mgmt-core>=1.3.0,<2.0.0', ], extras_require={ ":python_version<'3.0'": ['azure-mgmt-nspkg'], diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/tests/recordings/test_mgmt_notificationhubs.test_namespaces.yaml b/sdk/notificationhubs/azure-mgmt-notificationhubs/tests/recordings/test_mgmt_notificationhubs.test_namespaces.yaml index e5930c3fdaa8..93b6c2a66b6f 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/tests/recordings/test_mgmt_notificationhubs.test_namespaces.yaml +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/tests/recordings/test_mgmt_notificationhubs.test_namespaces.yaml @@ -13,44 +13,44 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-mgmt-notificationhubs/7.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-notificationhubs/8.0.0 Python/3.6.9 (Linux-5.10.60.1-microsoft-standard-WSL2-x86_64-with-Ubuntu-18.04-bionic) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_namespaces77d6115a/providers/Microsoft.NotificationHubs/namespaces/namespacexxx?api-version=2017-04-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_namespaces77d6115a/providers/Microsoft.NotificationHubs/namespaces/namespacexxx","name":"namespacexxx","type":"Microsoft.NotificationHubs/namespaces","location":"East - US","kind":"NotificationHub","tags":{},"properties":{"provisioningState":"Unknown","enabled":false,"namespaceType":"NotificationHub"}}' + string: '{"properties":{"provisioningState":"Unknown","enabled":false,"zoneRedundant":false},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_namespaces77d6115a/providers/Microsoft.NotificationHubs/namespaces/namespacexxx","name":"namespacexxx","type":"Microsoft.NotificationHubs/namespaces"}' headers: + api-supported-versions: + - 2014-09-01, 2016-03-01, 2017-04-01, 2020-01-01-preview + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_namespaces77d6115a/providers/Microsoft.NotificationHubs/namespaces/namespacexxx/operations/Q3JlYXRlTmFtZXNwYWNlLTBiMWY2NDcxLTFiZjAtNGRkYS1hZWMzLWNiOTI3MmYwOTU5MC1uYW1lc3BhY2V4eHg7bmhwcm9kYmwyMDAxLTItZmFicmlj?api-version=2017-04-01 cache-control: - no-cache content-length: - - '407' + - '344' content-type: - application/json; charset=utf-8 date: - - Tue, 22 Dec 2020 06:06:39 GMT + - Mon, 20 Dec 2021 04:58:30 GMT expires: - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_namespaces77d6115a/providers/Microsoft.NotificationHubs/namespaces/namespacexxx?api-version=2017-04-01 pragma: - no-cache server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 + - Kestrel strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding + trackingid: + - 280804f7-b25d-4521-9748-03df63401f02 x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - '1199' status: - code: 200 - message: OK + code: 201 + message: Created - request: body: null headers: @@ -61,79 +61,34 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-notificationhubs/7.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-notificationhubs/8.0.0 Python/3.6.9 (Linux-5.10.60.1-microsoft-standard-WSL2-x86_64-with-Ubuntu-18.04-bionic) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_namespaces77d6115a/providers/Microsoft.NotificationHubs/namespaces/namespacexxx?api-version=2017-04-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_namespaces77d6115a/providers/Microsoft.NotificationHubs/namespaces/namespacexxx","name":"namespacexxx","type":"Microsoft.NotificationHubs/namespaces","location":"East - US","kind":"NotificationHub","sku":{"name":"Free"},"tags":{},"properties":{"provisioningState":"Activating","status":"Created","createdAt":"2020-12-22T06:06:37.387Z","serviceBusEndpoint":"https://namespacexxx.servicebus.windows.net:443/","enabled":true,"critical":false,"updatedAt":"2020-12-22T06:06:37.387Z","namespaceType":"NotificationHub"}}' + string: '{"sku":{"name":"Free"},"properties":{"provisioningState":"Succeeded","status":"Active","createdAt":"2021-12-20T04:58:30.1900000Z","updatedAt":"2021-12-20T04:58:30.1970000Z","serviceBusEndpoint":"https://namespacexxx.servicebus.windows.net:443/","enabled":true,"critical":false,"zoneRedundant":false},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_namespaces77d6115a/providers/Microsoft.NotificationHubs/namespaces/namespacexxx","name":"namespacexxx","type":"Microsoft.NotificationHubs/namespaces","location":"East + US","tags":{}}' headers: + api-supported-versions: + - 2014-09-01, 2016-03-01, 2017-04-01, 2020-01-01-preview cache-control: - no-cache content-length: - - '617' + - '591' content-type: - application/json; charset=utf-8 date: - - Tue, 22 Dec 2020 06:06:39 GMT + - Mon, 20 Dec 2021 04:58:31 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-notificationhubs/7.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_namespaces77d6115a/providers/Microsoft.NotificationHubs/namespaces/namespacexxx?api-version=2017-04-01 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_namespaces77d6115a/providers/Microsoft.NotificationHubs/namespaces/namespacexxx","name":"namespacexxx","type":"Microsoft.NotificationHubs/namespaces","location":"East - US","kind":"NotificationHub","sku":{"name":"Free"},"tags":{},"properties":{"provisioningState":"Succeeded","status":"Active","createdAt":"2020-12-22T06:06:37.387Z","serviceBusEndpoint":"https://namespacexxx.servicebus.windows.net:443/","enabled":true,"critical":false,"updatedAt":"2020-12-22T06:07:01.66Z","namespaceType":"NotificationHub"}}' - headers: - cache-control: - - no-cache - content-length: - - '614' - content-type: - - application/json; charset=utf-8 - date: - - Tue, 22 Dec 2020 06:07:11 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 + - Kestrel strict-transport-security: - max-age=31536000; includeSubDomains + trackingid: + - cc190c3a-6639-41e1-98f8-0299321c52d8 transfer-encoding: - chunked vary: @@ -157,32 +112,34 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-mgmt-notificationhubs/7.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-notificationhubs/8.0.0 Python/3.6.9 (Linux-5.10.60.1-microsoft-standard-WSL2-x86_64-with-Ubuntu-18.04-bionic) method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_namespaces77d6115a/providers/Microsoft.NotificationHubs/namespaces/namespacexxx?api-version=2017-04-01 response: body: - string: '{"properties":{"status":"Active","createdAt":"2020-12-22T06:06:37.387Z","serviceBusEndpoint":"https://namespacexxx.servicebus.windows.net:443/","enabled":true,"critical":false,"updatedAt":"2020-12-22T06:07:01.66Z","namespaceType":"NotificationHub","messagingSku":1,"messagingSkuPlan":{"sku":1,"selectedEventHubUnit":1}}}' + string: '{"sku":{"name":"Free"},"properties":{"status":"Active","createdAt":"2021-12-20T04:58:30.1900000Z","updatedAt":"2021-12-20T04:58:30.1970000Z","serviceBusEndpoint":"https://namespacexxx.servicebus.windows.net:443/","enabled":true,"critical":false,"zoneRedundant":false},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_namespaces77d6115a/providers/Microsoft.NotificationHubs/namespaces/namespacexxx","name":"namespacexxx","type":"Microsoft.NotificationHubs/namespaces","location":"East + US"}' headers: + api-supported-versions: + - 2014-09-01, 2016-03-01, 2017-04-01, 2020-01-01-preview cache-control: - no-cache content-length: - - '320' + - '549' content-type: - application/json; charset=utf-8 date: - - Tue, 22 Dec 2020 06:07:11 GMT + - Mon, 20 Dec 2021 04:58:32 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 + - Kestrel strict-transport-security: - max-age=31536000; includeSubDomains + trackingid: + - 62ca047f-3b18-4984-b3d0-4f12a27f62c3 transfer-encoding: - chunked vary: @@ -206,82 +163,34 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-mgmt-notificationhubs/7.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-notificationhubs/8.0.0 Python/3.6.9 (Linux-5.10.60.1-microsoft-standard-WSL2-x86_64-with-Ubuntu-18.04-bionic) method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_namespaces77d6115a/providers/Microsoft.NotificationHubs/namespaces/namespacexxx?api-version=2017-04-01 response: body: string: '' headers: + api-supported-versions: + - 2014-09-01, 2016-03-01, 2017-04-01, 2020-01-01-preview cache-control: - no-cache - content-length: - - '0' date: - - Tue, 22 Dec 2020 06:07:12 GMT + - Mon, 20 Dec 2021 04:58:35 GMT expires: - '-1' - location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.NotificationHubs/operationresults/namespacexxx?api-version=2017-04-01 pragma: - no-cache server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 + - Kestrel strict-transport-security: - max-age=31536000; includeSubDomains + trackingid: + - a7606b19-1336-4f0b-8417-e86dab9910ea x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-deletes: - '14999' status: - code: 202 - message: Accepted -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-notificationhubs/7.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.NotificationHubs/operationresults/namespacexxx?api-version=2017-04-01 - response: - body: - string: '{"id":"subscriptions/92f95d8f3c67412491c78cf07cdbf241/operationsStatus/namespacexxx","name":"namespacexxx","status":"Completed"}' - headers: - cache-control: - - no-cache - content-length: - - '128' - content-type: - - application/json; charset=utf-8 - date: - - Tue, 22 Dec 2020 06:07:42 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK + code: 204 + message: No Content version: 1 diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/tests/recordings/test_mgmt_notificationhubs.test_notification_hubs.yaml b/sdk/notificationhubs/azure-mgmt-notificationhubs/tests/recordings/test_mgmt_notificationhubs.test_notification_hubs.yaml index aa2707562197..e40199299a84 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/tests/recordings/test_mgmt_notificationhubs.test_notification_hubs.yaml +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/tests/recordings/test_mgmt_notificationhubs.test_notification_hubs.yaml @@ -13,90 +13,44 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-mgmt-notificationhubs/7.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-notificationhubs/8.0.0 Python/3.6.9 (Linux-5.10.60.1-microsoft-standard-WSL2-x86_64-with-Ubuntu-18.04-bionic) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_notification_hubsfdb71452/providers/Microsoft.NotificationHubs/namespaces/namespacexxz?api-version=2017-04-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_notification_hubsfdb71452/providers/Microsoft.NotificationHubs/namespaces/namespacexxz","name":"namespacexxz","type":"Microsoft.NotificationHubs/namespaces","location":"East - US","kind":"NotificationHub","tags":{},"properties":{"provisioningState":"Unknown","enabled":false,"namespaceType":"NotificationHub"}}' + string: '{"properties":{"provisioningState":"Unknown","enabled":false,"zoneRedundant":false},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_notification_hubsfdb71452/providers/Microsoft.NotificationHubs/namespaces/namespacexxz","name":"namespacexxz","type":"Microsoft.NotificationHubs/namespaces"}' headers: + api-supported-versions: + - 2014-09-01, 2016-03-01, 2017-04-01, 2020-01-01-preview + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_notification_hubsfdb71452/providers/Microsoft.NotificationHubs/namespaces/namespacexxz/operations/Q3JlYXRlTmFtZXNwYWNlLTBiMWY2NDcxLTFiZjAtNGRkYS1hZWMzLWNiOTI3MmYwOTU5MC1uYW1lc3BhY2V4eHo7bmhwcm9kYmwyMDAxLTItZmFicmlj?api-version=2017-04-01 cache-control: - no-cache content-length: - - '414' + - '351' content-type: - application/json; charset=utf-8 date: - - Tue, 22 Dec 2020 06:08:01 GMT + - Mon, 20 Dec 2021 04:58:48 GMT expires: - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_notification_hubsfdb71452/providers/Microsoft.NotificationHubs/namespaces/namespacexxz?api-version=2017-04-01 pragma: - no-cache server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 + - Kestrel strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding + trackingid: + - 61c08b4f-0702-4d5f-a250-35e3d935b39a x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1197' status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-notificationhubs/7.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_notification_hubsfdb71452/providers/Microsoft.NotificationHubs/namespaces/namespacexxz?api-version=2017-04-01 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_notification_hubsfdb71452/providers/Microsoft.NotificationHubs/namespaces/namespacexxz","name":"namespacexxz","type":"Microsoft.NotificationHubs/namespaces","location":"East - US","kind":"NotificationHub","sku":{"name":"Free"},"tags":{},"properties":{"provisioningState":"Activating","status":"Created","createdAt":"2020-12-22T06:08:00.397Z","serviceBusEndpoint":"https://namespacexxz.servicebus.windows.net:443/","enabled":true,"critical":false,"updatedAt":"2020-12-22T06:08:00.397Z","namespaceType":"NotificationHub"}}' - headers: - cache-control: - - no-cache - content-length: - - '624' - content-type: - - application/json; charset=utf-8 - date: - - Tue, 22 Dec 2020 06:08:02 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK + code: 201 + message: Created - request: body: null headers: @@ -107,33 +61,34 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-notificationhubs/7.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-notificationhubs/8.0.0 Python/3.6.9 (Linux-5.10.60.1-microsoft-standard-WSL2-x86_64-with-Ubuntu-18.04-bionic) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_notification_hubsfdb71452/providers/Microsoft.NotificationHubs/namespaces/namespacexxz?api-version=2017-04-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_notification_hubsfdb71452/providers/Microsoft.NotificationHubs/namespaces/namespacexxz","name":"namespacexxz","type":"Microsoft.NotificationHubs/namespaces","location":"East - US","kind":"NotificationHub","sku":{"name":"Free"},"tags":{},"properties":{"provisioningState":"Succeeded","status":"Active","createdAt":"2020-12-22T06:08:00.397Z","serviceBusEndpoint":"https://namespacexxz.servicebus.windows.net:443/","enabled":true,"critical":false,"updatedAt":"2020-12-22T06:08:23.973Z","namespaceType":"NotificationHub"}}' + string: '{"sku":{"name":"Free"},"properties":{"provisioningState":"Succeeded","status":"Active","createdAt":"2021-12-20T04:58:49.1470000Z","updatedAt":"2021-12-20T04:58:49.1600000Z","serviceBusEndpoint":"https://namespacexxz.servicebus.windows.net:443/","enabled":true,"critical":false,"zoneRedundant":false},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_notification_hubsfdb71452/providers/Microsoft.NotificationHubs/namespaces/namespacexxz","name":"namespacexxz","type":"Microsoft.NotificationHubs/namespaces","location":"East + US","tags":{}}' headers: + api-supported-versions: + - 2014-09-01, 2016-03-01, 2017-04-01, 2020-01-01-preview cache-control: - no-cache content-length: - - '622' + - '598' content-type: - application/json; charset=utf-8 date: - - Tue, 22 Dec 2020 06:08:33 GMT + - Mon, 20 Dec 2021 04:58:48 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 + - Kestrel strict-transport-security: - max-age=31536000; includeSubDomains + trackingid: + - 268281eb-bafa-4677-9902-55aaf403ef00 transfer-encoding: - chunked vary: @@ -157,37 +112,38 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-mgmt-notificationhubs/7.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-notificationhubs/8.0.0 Python/3.6.9 (Linux-5.10.60.1-microsoft-standard-WSL2-x86_64-with-Ubuntu-18.04-bionic) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_notification_hubsfdb71452/providers/Microsoft.NotificationHubs/namespaces/namespacexxz/notificationHubs/notificationhubxxzx?api-version=2017-04-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_notification_hubsfdb71452/providers/Microsoft.NotificationHubs/namespaces/namespacexxz/notificationHubs/notificationhubxxzx","name":"notificationhubxxzx","type":"Microsoft.NotificationHubs/namespaces/notificationHubs","location":"East - US","properties":{"registrationTtl":"10675199.02:48:05.4775807"}}' + string: '{"properties":{"registrationTtl":"10675199.02:48:05.4775807","dailyMaxActiveDevices":0},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_notification_hubsfdb71452/providers/Microsoft.NotificationHubs/namespaces/namespacexxz/NotificationHubs/notificationhubxxzx","name":"notificationhubxxzx","type":"Microsoft.NotificationHubs/namespaces/notificationHubs","location":"East + US"}' headers: + api-supported-versions: + - 2014-09-01, 2016-03-01, 2017-04-01, 2020-01-01-preview cache-control: - no-cache content-length: - - '406' + - '437' content-type: - application/json; charset=utf-8 date: - - Tue, 22 Dec 2020 06:08:40 GMT + - Mon, 20 Dec 2021 04:58:53 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 + - Kestrel strict-transport-security: - max-age=31536000; includeSubDomains + trackingid: + - 7051bc01-fa72-4ca2-bd32-8b87db8af518 x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1196' status: code: 201 message: Created @@ -201,33 +157,34 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-notificationhubs/7.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-notificationhubs/8.0.0 Python/3.6.9 (Linux-5.10.60.1-microsoft-standard-WSL2-x86_64-with-Ubuntu-18.04-bionic) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_notification_hubsfdb71452/providers/Microsoft.NotificationHubs/namespaces/namespacexxz/notificationHubs/notificationhubxxzx?api-version=2017-04-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_notification_hubsfdb71452/providers/Microsoft.NotificationHubs/namespaces/namespacexxz/notificationHubs/notificationhubxxzx","name":"notificationhubxxzx","type":"Microsoft.NotificationHubs/namespaces/notificationHubs","location":"East - US","tags":{},"properties":{"registrationTtl":"10675199.02:48:05.4775807","authorizationRules":[]}}' + string: '{"properties":{"registrationTtl":"10675199.02:48:05.4775807","authorizationRules":[],"dailyMaxActiveDevices":0},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_notification_hubsfdb71452/providers/Microsoft.NotificationHubs/namespaces/namespacexxz/NotificationHubs/notificationhubxxzx","name":"notificationhubxxzx","type":"Microsoft.NotificationHubs/namespaces/notificationHubs","location":"East + US"}' headers: + api-supported-versions: + - 2014-09-01, 2016-03-01, 2017-04-01, 2020-01-01-preview cache-control: - no-cache content-length: - - '440' + - '461' content-type: - application/json; charset=utf-8 date: - - Tue, 22 Dec 2020 06:08:40 GMT + - Mon, 20 Dec 2021 04:58:53 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 + - Kestrel strict-transport-security: - max-age=31536000; includeSubDomains + trackingid: + - 9fb7ffe6-17e9-46f7-ae2c-bb47a604b637 transfer-encoding: - chunked vary: @@ -249,34 +206,35 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-mgmt-notificationhubs/7.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-notificationhubs/8.0.0 Python/3.6.9 (Linux-5.10.60.1-microsoft-standard-WSL2-x86_64-with-Ubuntu-18.04-bionic) method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_notificationhubs_test_notification_hubsfdb71452/providers/Microsoft.NotificationHubs/namespaces/namespacexxz/notificationHubs/notificationhubxxzx?api-version=2017-04-01 response: body: string: '' headers: + api-supported-versions: + - 2014-09-01, 2016-03-01, 2017-04-01, 2020-01-01-preview cache-control: - no-cache content-length: - '0' date: - - Tue, 22 Dec 2020 06:08:44 GMT + - Mon, 20 Dec 2021 04:58:57 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 + - Kestrel strict-transport-security: - max-age=31536000; includeSubDomains + trackingid: + - 30b4852f-04ac-4cda-9850-e83fda655268 x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-deletes: - - '14999' + - '14998' status: code: 200 message: OK diff --git a/shared_requirements.txt b/shared_requirements.txt index c4b3cb4171fa..c212781ae411 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -232,6 +232,8 @@ opentelemetry-sdk<2.0.0,>=1.5.0,!=1.10a0 #override azure-mgmt-desktopvirtualization msrest>=0.6.21 #override azure-mgmt-monitor msrest>=0.6.21 #override azure-mgmt-applicationinsights msrest>=0.6.21 +#override azure-mgmt-notificationhubs msrest>=0.6.21 +#override azure-mgmt-notificationhubs azure-mgmt-core>=1.3.0,<2.0.0 #override azure-mgmt-redis msrest>=0.6.21 #override azure-mgmt-redis azure-mgmt-core>=1.3.0,<2.0.0 #override azure-mgmt-recoveryservicesbackup msrest>=0.6.21