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 370910c1e9bf..4b6ca30ef612 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/__init__.py +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/__init__.py @@ -9,10 +9,11 @@ # regenerated. # -------------------------------------------------------------------------- -from .notification_hubs_management_client import NotificationHubsManagementClient -from .version import VERSION +from ._configuration import NotificationHubsManagementClientConfiguration +from ._notification_hubs_management_client import NotificationHubsManagementClient +__all__ = ['NotificationHubsManagementClient', 'NotificationHubsManagementClientConfiguration'] -__all__ = ['NotificationHubsManagementClient'] +from .version import VERSION __version__ = VERSION diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_configuration.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_configuration.py new file mode 100644 index 000000000000..636d7656abcb --- /dev/null +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_configuration.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from msrestazure import AzureConfiguration + +from .version import VERSION + + +class NotificationHubsManagementClientConfiguration(AzureConfiguration): + """Configuration for NotificationHubsManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :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 + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(NotificationHubsManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-notificationhubs/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id 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 new file mode 100644 index 000000000000..bf1e4ad5b7b9 --- /dev/null +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/_notification_hubs_management_client.py @@ -0,0 +1,61 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import NotificationHubsManagementClientConfiguration +from .operations import Operations +from .operations import NamespacesOperations +from .operations import NotificationHubsOperations +from . import models + + +class NotificationHubsManagementClient(SDKClient): + """Azure NotificationHub client + + :ivar config: Configuration for client. + :vartype config: NotificationHubsManagementClientConfiguration + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.notificationhubs.operations.Operations + :ivar namespaces: Namespaces operations + :vartype namespaces: azure.mgmt.notificationhubs.operations.NamespacesOperations + :ivar notification_hubs: NotificationHubs operations + :vartype notification_hubs: azure.mgmt.notificationhubs.operations.NotificationHubsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :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 + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = NotificationHubsManagementClientConfiguration(credentials, subscription_id, base_url) + super(NotificationHubsManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2017-04-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + 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) diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/__init__.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/__init__.py index 6e7e9ee3b381..e6d1630d5ed4 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/__init__.py +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/__init__.py @@ -10,102 +10,102 @@ # -------------------------------------------------------------------------- try: - from .operation_display_py3 import OperationDisplay - from .operation_py3 import Operation - from .error_response_py3 import ErrorResponse, ErrorResponseException - from .sku_py3 import Sku - from .check_availability_parameters_py3 import CheckAvailabilityParameters - from .check_availability_result_py3 import CheckAvailabilityResult - from .namespace_create_or_update_parameters_py3 import NamespaceCreateOrUpdateParameters - from .namespace_patch_parameters_py3 import NamespacePatchParameters - from .namespace_resource_py3 import NamespaceResource - from .shared_access_authorization_rule_properties_py3 import SharedAccessAuthorizationRuleProperties - from .shared_access_authorization_rule_create_or_update_parameters_py3 import SharedAccessAuthorizationRuleCreateOrUpdateParameters - from .shared_access_authorization_rule_resource_py3 import SharedAccessAuthorizationRuleResource - from .shared_access_authorization_rule_list_result_py3 import SharedAccessAuthorizationRuleListResult - from .resource_list_keys_py3 import ResourceListKeys - from .policykey_resource_py3 import PolicykeyResource - from .apns_credential_py3 import ApnsCredential - from .wns_credential_py3 import WnsCredential - from .gcm_credential_py3 import GcmCredential - from .mpns_credential_py3 import MpnsCredential - from .adm_credential_py3 import AdmCredential - from .baidu_credential_py3 import BaiduCredential - from .notification_hub_create_or_update_parameters_py3 import NotificationHubCreateOrUpdateParameters - from .notification_hub_patch_parameters_py3 import NotificationHubPatchParameters - from .notification_hub_resource_py3 import NotificationHubResource - from .debug_send_response_py3 import DebugSendResponse - from .pns_credentials_resource_py3 import PnsCredentialsResource - from .resource_py3 import Resource - from .sub_resource_py3 import SubResource + from ._models_py3 import AdmCredential + from ._models_py3 import ApnsCredential + from ._models_py3 import BaiduCredential + from ._models_py3 import CheckAvailabilityParameters + from ._models_py3 import CheckAvailabilityResult + from ._models_py3 import DebugSendResponse + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import GcmCredential + from ._models_py3 import MpnsCredential + from ._models_py3 import NamespaceCreateOrUpdateParameters + from ._models_py3 import NamespacePatchParameters + from ._models_py3 import NamespaceResource + from ._models_py3 import NotificationHubCreateOrUpdateParameters + from ._models_py3 import NotificationHubPatchParameters + from ._models_py3 import NotificationHubResource + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import PnsCredentialsResource + from ._models_py3 import PolicykeyResource + from ._models_py3 import Resource + from ._models_py3 import ResourceListKeys + from ._models_py3 import SharedAccessAuthorizationRuleCreateOrUpdateParameters + from ._models_py3 import SharedAccessAuthorizationRuleListResult + from ._models_py3 import SharedAccessAuthorizationRuleProperties + from ._models_py3 import SharedAccessAuthorizationRuleResource + from ._models_py3 import Sku + from ._models_py3 import SubResource + from ._models_py3 import WnsCredential except (SyntaxError, ImportError): - from .operation_display import OperationDisplay - from .operation import Operation - from .error_response import ErrorResponse, ErrorResponseException - from .sku import Sku - from .check_availability_parameters import CheckAvailabilityParameters - from .check_availability_result import CheckAvailabilityResult - from .namespace_create_or_update_parameters import NamespaceCreateOrUpdateParameters - from .namespace_patch_parameters import NamespacePatchParameters - from .namespace_resource import NamespaceResource - from .shared_access_authorization_rule_properties import SharedAccessAuthorizationRuleProperties - from .shared_access_authorization_rule_create_or_update_parameters import SharedAccessAuthorizationRuleCreateOrUpdateParameters - from .shared_access_authorization_rule_resource import SharedAccessAuthorizationRuleResource - from .shared_access_authorization_rule_list_result import SharedAccessAuthorizationRuleListResult - from .resource_list_keys import ResourceListKeys - from .policykey_resource import PolicykeyResource - from .apns_credential import ApnsCredential - from .wns_credential import WnsCredential - from .gcm_credential import GcmCredential - from .mpns_credential import MpnsCredential - from .adm_credential import AdmCredential - from .baidu_credential import BaiduCredential - from .notification_hub_create_or_update_parameters import NotificationHubCreateOrUpdateParameters - from .notification_hub_patch_parameters import NotificationHubPatchParameters - from .notification_hub_resource import NotificationHubResource - from .debug_send_response import DebugSendResponse - from .pns_credentials_resource import PnsCredentialsResource - from .resource import Resource - from .sub_resource import SubResource -from .operation_paged import OperationPaged -from .namespace_resource_paged import NamespaceResourcePaged -from .shared_access_authorization_rule_resource_paged import SharedAccessAuthorizationRuleResourcePaged -from .notification_hub_resource_paged import NotificationHubResourcePaged -from .notification_hubs_management_client_enums import ( + from ._models import AdmCredential + from ._models import ApnsCredential + from ._models import BaiduCredential + from ._models import CheckAvailabilityParameters + from ._models import CheckAvailabilityResult + from ._models import DebugSendResponse + from ._models import ErrorResponse, ErrorResponseException + from ._models import GcmCredential + from ._models import MpnsCredential + from ._models import NamespaceCreateOrUpdateParameters + from ._models import NamespacePatchParameters + from ._models import NamespaceResource + from ._models import NotificationHubCreateOrUpdateParameters + from ._models import NotificationHubPatchParameters + from ._models import NotificationHubResource + from ._models import Operation + from ._models import OperationDisplay + from ._models import PnsCredentialsResource + from ._models import PolicykeyResource + from ._models import Resource + from ._models import ResourceListKeys + from ._models import SharedAccessAuthorizationRuleCreateOrUpdateParameters + from ._models import SharedAccessAuthorizationRuleListResult + from ._models import SharedAccessAuthorizationRuleProperties + from ._models import SharedAccessAuthorizationRuleResource + from ._models import Sku + from ._models import SubResource + from ._models import WnsCredential +from ._paged_models import NamespaceResourcePaged +from ._paged_models import NotificationHubResourcePaged +from ._paged_models import OperationPaged +from ._paged_models import SharedAccessAuthorizationRuleResourcePaged +from ._notification_hubs_management_client_enums import ( SkuName, NamespaceType, AccessRights, ) __all__ = [ - 'OperationDisplay', - 'Operation', - 'ErrorResponse', 'ErrorResponseException', - 'Sku', + 'AdmCredential', + 'ApnsCredential', + 'BaiduCredential', 'CheckAvailabilityParameters', 'CheckAvailabilityResult', + 'DebugSendResponse', + 'ErrorResponse', 'ErrorResponseException', + 'GcmCredential', + 'MpnsCredential', 'NamespaceCreateOrUpdateParameters', 'NamespacePatchParameters', 'NamespaceResource', - 'SharedAccessAuthorizationRuleProperties', - 'SharedAccessAuthorizationRuleCreateOrUpdateParameters', - 'SharedAccessAuthorizationRuleResource', - 'SharedAccessAuthorizationRuleListResult', - 'ResourceListKeys', - 'PolicykeyResource', - 'ApnsCredential', - 'WnsCredential', - 'GcmCredential', - 'MpnsCredential', - 'AdmCredential', - 'BaiduCredential', 'NotificationHubCreateOrUpdateParameters', 'NotificationHubPatchParameters', 'NotificationHubResource', - 'DebugSendResponse', + 'Operation', + 'OperationDisplay', 'PnsCredentialsResource', + 'PolicykeyResource', 'Resource', + 'ResourceListKeys', + 'SharedAccessAuthorizationRuleCreateOrUpdateParameters', + 'SharedAccessAuthorizationRuleListResult', + 'SharedAccessAuthorizationRuleProperties', + 'SharedAccessAuthorizationRuleResource', + 'Sku', 'SubResource', + 'WnsCredential', 'OperationPaged', 'NamespaceResourcePaged', 'SharedAccessAuthorizationRuleResourcePaged', 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 new file mode 100644 index 000000000000..0f87e68b54a4 --- /dev/null +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/_models.py @@ -0,0 +1,1324 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class AdmCredential(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 + """ + + _attribute_map = { + 'client_id': {'key': 'properties.clientId', 'type': 'str'}, + 'client_secret': {'key': 'properties.clientSecret', 'type': 'str'}, + 'auth_token_url': {'key': 'properties.authTokenUrl', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AdmCredential, self).__init__(**kwargs) + self.client_id = kwargs.get('client_id', None) + self.client_secret = kwargs.get('client_secret', None) + self.auth_token_url = kwargs.get('auth_token_url', None) + + +class ApnsCredential(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 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 Mode. + :type thumbprint: str + :param 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 Mode. + :type app_name: str + :param 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 + """ + + _attribute_map = { + 'apns_certificate': {'key': 'properties.apnsCertificate', 'type': 'str'}, + 'certificate_key': {'key': 'properties.certificateKey', 'type': 'str'}, + 'endpoint': {'key': 'properties.endpoint', 'type': 'str'}, + 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, + 'key_id': {'key': 'properties.keyId', 'type': 'str'}, + 'app_name': {'key': 'properties.appName', 'type': 'str'}, + 'app_id': {'key': 'properties.appId', 'type': 'str'}, + 'token': {'key': 'properties.token', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ApnsCredential, self).__init__(**kwargs) + self.apns_certificate = kwargs.get('apns_certificate', None) + self.certificate_key = kwargs.get('certificate_key', None) + self.endpoint = kwargs.get('endpoint', None) + self.thumbprint = kwargs.get('thumbprint', None) + self.key_id = kwargs.get('key_id', None) + self.app_name = kwargs.get('app_name', None) + self.app_id = kwargs.get('app_id', None) + self.token = kwargs.get('token', None) + + +class BaiduCredential(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 + """ + + _attribute_map = { + 'baidu_api_key': {'key': 'properties.baiduApiKey', 'type': 'str'}, + 'baidu_end_point': {'key': 'properties.baiduEndPoint', 'type': 'str'}, + 'baidu_secret_key': {'key': 'properties.baiduSecretKey', 'type': 'str'}, + } + + def __init__(self, **kwargs): + 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) + self.baidu_secret_key = kwargs.get('baidu_secret_key', None) + + +class CheckAvailabilityParameters(Model): + """Parameters supplied to the Check Name Availability for Namespace and + NotificationHubs. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id + :vartype id: str + :param name: Required. Resource name + :type name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param 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 Namespace/NotificationHub. Otherwise false. + :type is_availiable: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'required': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'is_availiable': {'key': 'isAvailiable', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(CheckAvailabilityParameters, self).__init__(**kwargs) + self.id = None + self.name = kwargs.get('name', None) + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + self.sku = kwargs.get('sku', None) + self.is_availiable = kwargs.get('is_availiable', None) + + +class Resource(Model): + """Resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param sku: The sku of the created namespace + :type sku: ~azure.mgmt.notificationhubs.models.Sku + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + self.sku = kwargs.get('sku', None) + + +class CheckAvailabilityResult(Resource): + """Description of a CheckAvailability resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param 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 Namespace/NotificationHub. Otherwise false. + :type is_availiable: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'is_availiable': {'key': 'isAvailiable', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(CheckAvailabilityResult, self).__init__(**kwargs) + self.is_availiable = kwargs.get('is_availiable', None) + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class DebugSendResponse(Resource): + """Description of a NotificationHub Resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param 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 + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'success': {'key': 'properties.success', 'type': 'float'}, + 'failure': {'key': 'properties.failure', 'type': 'float'}, + 'results': {'key': 'properties.results', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(DebugSendResponse, self).__init__(**kwargs) + self.success = kwargs.get('success', None) + self.failure = kwargs.get('failure', None) + self.results = kwargs.get('results', None) + + +class ErrorResponse(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 + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class GcmCredential(Model): + """Description of a NotificationHub GcmCredential. + + :param 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 + """ + + _attribute_map = { + 'gcm_endpoint': {'key': 'properties.gcmEndpoint', 'type': 'str'}, + 'google_api_key': {'key': 'properties.googleApiKey', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(GcmCredential, self).__init__(**kwargs) + self.gcm_endpoint = kwargs.get('gcm_endpoint', None) + self.google_api_key = kwargs.get('google_api_key', None) + + +class MpnsCredential(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 + """ + + _attribute_map = { + 'mpns_certificate': {'key': 'properties.mpnsCertificate', 'type': 'str'}, + 'certificate_key': {'key': 'properties.certificateKey', 'type': 'str'}, + 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MpnsCredential, self).__init__(**kwargs) + self.mpns_certificate = kwargs.get('mpns_certificate', None) + self.certificate_key = kwargs.get('certificate_key', None) + self.thumbprint = kwargs.get('thumbprint', None) + + +class NamespaceCreateOrUpdateParameters(Resource): + """Parameters supplied to the CreateOrUpdate Namespace operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param sku: The sku of the created namespace + :type sku: ~azure.mgmt.notificationhubs.models.Sku + :param namespace_create_or_update_parameters_name: The name of the + namespace. + :type namespace_create_or_update_parameters_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 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 = Creating3 = Suspended4 = Deleting + :type status: str + :param created_at: The time the namespace was created. + :type created_at: datetime + :param updated_at: The time the namespace was updated. + :type updated_at: 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', 'NotificationHub' + :type namespace_type: str or + ~azure.mgmt.notificationhubs.models.NamespaceType + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'metric_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'namespace_create_or_update_parameters_name': {'key': 'properties.name', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'region': {'key': 'properties.region', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'subscription_id': {'key': 'properties.subscriptionId', 'type': 'str'}, + 'scale_unit': {'key': 'properties.scaleUnit', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'critical': {'key': 'properties.critical', 'type': 'bool'}, + 'data_center': {'key': 'properties.dataCenter', 'type': 'str'}, + 'namespace_type': {'key': 'properties.namespaceType', 'type': 'NamespaceType'}, + } + + def __init__(self, **kwargs): + super(NamespaceCreateOrUpdateParameters, self).__init__(**kwargs) + self.namespace_create_or_update_parameters_name = kwargs.get('namespace_create_or_update_parameters_name', None) + self.provisioning_state = kwargs.get('provisioning_state', None) + self.region = kwargs.get('region', None) + self.metric_id = None + self.status = kwargs.get('status', None) + self.created_at = kwargs.get('created_at', None) + self.updated_at = kwargs.get('updated_at', None) + self.service_bus_endpoint = kwargs.get('service_bus_endpoint', None) + self.subscription_id = kwargs.get('subscription_id', None) + self.scale_unit = kwargs.get('scale_unit', None) + self.enabled = kwargs.get('enabled', None) + self.critical = kwargs.get('critical', None) + self.data_center = kwargs.get('data_center', None) + self.namespace_type = kwargs.get('namespace_type', None) + + +class NamespacePatchParameters(Model): + """Parameters supplied to the Patch Namespace operation. + + :param tags: Resource tags + :type tags: dict[str, str] + :param sku: The sku of the created namespace + :type sku: ~azure.mgmt.notificationhubs.models.Sku + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__(self, **kwargs): + super(NamespacePatchParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.sku = kwargs.get('sku', None) + + +class NamespaceResource(Resource): + """Description of a Namespace resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param sku: The sku of the created namespace + :type sku: ~azure.mgmt.notificationhubs.models.Sku + :param namespace_resource_name: The name of the namespace. + :type namespace_resource_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 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 = Creating3 = Suspended4 = Deleting + :type status: str + :param created_at: The time the namespace was created. + :type created_at: datetime + :param updated_at: The time the namespace was updated. + :type updated_at: 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', 'NotificationHub' + :type namespace_type: str or + ~azure.mgmt.notificationhubs.models.NamespaceType + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'metric_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'namespace_resource_name': {'key': 'properties.name', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'region': {'key': 'properties.region', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'subscription_id': {'key': 'properties.subscriptionId', 'type': 'str'}, + 'scale_unit': {'key': 'properties.scaleUnit', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'critical': {'key': 'properties.critical', 'type': 'bool'}, + 'data_center': {'key': 'properties.dataCenter', 'type': 'str'}, + 'namespace_type': {'key': 'properties.namespaceType', 'type': 'NamespaceType'}, + } + + def __init__(self, **kwargs): + super(NamespaceResource, self).__init__(**kwargs) + self.namespace_resource_name = kwargs.get('namespace_resource_name', None) + self.provisioning_state = kwargs.get('provisioning_state', None) + self.region = kwargs.get('region', None) + self.metric_id = None + self.status = kwargs.get('status', None) + self.created_at = kwargs.get('created_at', None) + self.updated_at = kwargs.get('updated_at', None) + self.service_bus_endpoint = kwargs.get('service_bus_endpoint', None) + self.subscription_id = kwargs.get('subscription_id', None) + self.scale_unit = kwargs.get('scale_unit', None) + self.enabled = kwargs.get('enabled', None) + self.critical = kwargs.get('critical', None) + self.data_center = kwargs.get('data_center', None) + self.namespace_type = kwargs.get('namespace_type', None) + + +class NotificationHubCreateOrUpdateParameters(Resource): + """Parameters supplied to the CreateOrUpdate NotificationHub operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param sku: The sku of the created namespace + :type sku: ~azure.mgmt.notificationhubs.models.Sku + :param notification_hub_create_or_update_parameters_name: The + NotificationHub name. + :type notification_hub_create_or_update_parameters_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: + 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 + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'notification_hub_create_or_update_parameters_name': {'key': 'properties.name', 'type': 'str'}, + 'registration_ttl': {'key': 'properties.registrationTtl', 'type': 'str'}, + 'authorization_rules': {'key': 'properties.authorizationRules', 'type': '[SharedAccessAuthorizationRuleProperties]'}, + 'apns_credential': {'key': 'properties.apnsCredential', 'type': 'ApnsCredential'}, + 'wns_credential': {'key': 'properties.wnsCredential', 'type': 'WnsCredential'}, + 'gcm_credential': {'key': 'properties.gcmCredential', 'type': 'GcmCredential'}, + 'mpns_credential': {'key': 'properties.mpnsCredential', 'type': 'MpnsCredential'}, + 'adm_credential': {'key': 'properties.admCredential', 'type': 'AdmCredential'}, + 'baidu_credential': {'key': 'properties.baiduCredential', 'type': 'BaiduCredential'}, + } + + def __init__(self, **kwargs): + super(NotificationHubCreateOrUpdateParameters, self).__init__(**kwargs) + self.notification_hub_create_or_update_parameters_name = kwargs.get('notification_hub_create_or_update_parameters_name', None) + self.registration_ttl = kwargs.get('registration_ttl', None) + self.authorization_rules = kwargs.get('authorization_rules', None) + self.apns_credential = kwargs.get('apns_credential', None) + self.wns_credential = kwargs.get('wns_credential', None) + self.gcm_credential = kwargs.get('gcm_credential', None) + self.mpns_credential = kwargs.get('mpns_credential', None) + self.adm_credential = kwargs.get('adm_credential', None) + self.baidu_credential = kwargs.get('baidu_credential', None) + + +class NotificationHubPatchParameters(Resource): + """Parameters supplied to the patch NotificationHub operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param sku: The sku of the created namespace + :type sku: ~azure.mgmt.notificationhubs.models.Sku + :param notification_hub_patch_parameters_name: The NotificationHub name. + :type notification_hub_patch_parameters_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: + 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 + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'notification_hub_patch_parameters_name': {'key': 'properties.name', 'type': 'str'}, + 'registration_ttl': {'key': 'properties.registrationTtl', 'type': 'str'}, + 'authorization_rules': {'key': 'properties.authorizationRules', 'type': '[SharedAccessAuthorizationRuleProperties]'}, + 'apns_credential': {'key': 'properties.apnsCredential', 'type': 'ApnsCredential'}, + 'wns_credential': {'key': 'properties.wnsCredential', 'type': 'WnsCredential'}, + 'gcm_credential': {'key': 'properties.gcmCredential', 'type': 'GcmCredential'}, + 'mpns_credential': {'key': 'properties.mpnsCredential', 'type': 'MpnsCredential'}, + 'adm_credential': {'key': 'properties.admCredential', 'type': 'AdmCredential'}, + 'baidu_credential': {'key': 'properties.baiduCredential', 'type': 'BaiduCredential'}, + } + + def __init__(self, **kwargs): + super(NotificationHubPatchParameters, self).__init__(**kwargs) + self.notification_hub_patch_parameters_name = kwargs.get('notification_hub_patch_parameters_name', None) + self.registration_ttl = kwargs.get('registration_ttl', None) + self.authorization_rules = kwargs.get('authorization_rules', None) + self.apns_credential = kwargs.get('apns_credential', None) + self.wns_credential = kwargs.get('wns_credential', None) + self.gcm_credential = kwargs.get('gcm_credential', None) + self.mpns_credential = kwargs.get('mpns_credential', None) + self.adm_credential = kwargs.get('adm_credential', None) + self.baidu_credential = kwargs.get('baidu_credential', None) + + +class NotificationHubResource(Resource): + """Description of a NotificationHub Resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param sku: The sku of the created namespace + :type sku: ~azure.mgmt.notificationhubs.models.Sku + :param notification_hub_resource_name: The NotificationHub name. + :type notification_hub_resource_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: + 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 + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'notification_hub_resource_name': {'key': 'properties.name', 'type': 'str'}, + 'registration_ttl': {'key': 'properties.registrationTtl', 'type': 'str'}, + 'authorization_rules': {'key': 'properties.authorizationRules', 'type': '[SharedAccessAuthorizationRuleProperties]'}, + 'apns_credential': {'key': 'properties.apnsCredential', 'type': 'ApnsCredential'}, + 'wns_credential': {'key': 'properties.wnsCredential', 'type': 'WnsCredential'}, + 'gcm_credential': {'key': 'properties.gcmCredential', 'type': 'GcmCredential'}, + 'mpns_credential': {'key': 'properties.mpnsCredential', 'type': 'MpnsCredential'}, + 'adm_credential': {'key': 'properties.admCredential', 'type': 'AdmCredential'}, + 'baidu_credential': {'key': 'properties.baiduCredential', 'type': 'BaiduCredential'}, + } + + def __init__(self, **kwargs): + super(NotificationHubResource, self).__init__(**kwargs) + self.notification_hub_resource_name = kwargs.get('notification_hub_resource_name', None) + self.registration_ttl = kwargs.get('registration_ttl', None) + self.authorization_rules = kwargs.get('authorization_rules', None) + self.apns_credential = kwargs.get('apns_credential', None) + self.wns_credential = kwargs.get('wns_credential', None) + self.gcm_credential = kwargs.get('gcm_credential', None) + self.mpns_credential = kwargs.get('mpns_credential', None) + self.adm_credential = kwargs.get('adm_credential', None) + self.baidu_credential = kwargs.get('baidu_credential', None) + + +class Operation(Model): + """A NotificationHubs REST API operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation} + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.notificationhubs.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = kwargs.get('display', None) + + +class OperationDisplay(Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provider: Service provider: Microsoft.NotificationHubs + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Invoice, + etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + + +class PnsCredentialsResource(Resource): + """Description of a NotificationHub PNS Credentials. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param 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 + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'apns_credential': {'key': 'properties.apnsCredential', 'type': 'ApnsCredential'}, + 'wns_credential': {'key': 'properties.wnsCredential', 'type': 'WnsCredential'}, + 'gcm_credential': {'key': 'properties.gcmCredential', 'type': 'GcmCredential'}, + 'mpns_credential': {'key': 'properties.mpnsCredential', 'type': 'MpnsCredential'}, + 'adm_credential': {'key': 'properties.admCredential', 'type': 'AdmCredential'}, + 'baidu_credential': {'key': 'properties.baiduCredential', 'type': 'BaiduCredential'}, + } + + def __init__(self, **kwargs): + super(PnsCredentialsResource, self).__init__(**kwargs) + self.apns_credential = kwargs.get('apns_credential', None) + self.wns_credential = kwargs.get('wns_credential', None) + self.gcm_credential = kwargs.get('gcm_credential', None) + self.mpns_credential = kwargs.get('mpns_credential', None) + self.adm_credential = kwargs.get('adm_credential', None) + self.baidu_credential = kwargs.get('baidu_credential', None) + + +class PolicykeyResource(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 + """ + + _attribute_map = { + 'policy_key': {'key': 'policyKey', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PolicykeyResource, self).__init__(**kwargs) + self.policy_key = kwargs.get('policy_key', None) + + +class ResourceListKeys(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 + """ + + _attribute_map = { + 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, + 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'key_name': {'key': 'keyName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + 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) + self.primary_key = kwargs.get('primary_key', None) + self.secondary_key = kwargs.get('secondary_key', None) + self.key_name = kwargs.get('key_name', None) + + +class SharedAccessAuthorizationRuleCreateOrUpdateParameters(Model): + """Parameters supplied to the CreateOrUpdate Namespace AuthorizationRules. + + 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 + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'SharedAccessAuthorizationRuleProperties'}, + } + + def __init__(self, **kwargs): + super(SharedAccessAuthorizationRuleCreateOrUpdateParameters, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class SharedAccessAuthorizationRuleListResult(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 of AuthorizationRules + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedAccessAuthorizationRuleResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SharedAccessAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SharedAccessAuthorizationRuleProperties(Model): + """SharedAccessAuthorizationRule properties. + + 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 primary_key: A base64-encoded 256-bit primary key for signing and + validating the SAS token. + :vartype primary_key: str + :ivar secondary_key: A base64-encoded 256-bit primary key for signing and + validating the SAS token. + :vartype secondary_key: str + :ivar key_name: A string that describes the authorization rule. + :vartype key_name: str + :ivar claim_type: A string that describes the claim type + :vartype claim_type: str + :ivar claim_value: A string that describes the claim value + :vartype claim_value: str + :ivar modified_time: The last modified time for this rule + :vartype modified_time: str + :ivar created_time: The created time for this rule + :vartype created_time: str + :ivar revision: The revision number for the rule + :vartype revision: int + """ + + _validation = { + 'primary_key': {'readonly': True}, + 'secondary_key': {'readonly': True}, + 'key_name': {'readonly': True}, + 'claim_type': {'readonly': True}, + 'claim_value': {'readonly': True}, + 'modified_time': {'readonly': True}, + 'created_time': {'readonly': True}, + 'revision': {'readonly': True}, + } + + _attribute_map = { + 'rights': {'key': 'rights', 'type': '[AccessRights]'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'claim_type': {'key': 'claimType', 'type': 'str'}, + 'claim_value': {'key': 'claimValue', 'type': 'str'}, + 'modified_time': {'key': 'modifiedTime', 'type': 'str'}, + 'created_time': {'key': 'createdTime', 'type': 'str'}, + 'revision': {'key': 'revision', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(SharedAccessAuthorizationRuleProperties, self).__init__(**kwargs) + self.rights = kwargs.get('rights', None) + self.primary_key = None + self.secondary_key = None + self.key_name = None + self.claim_type = None + self.claim_value = None + self.modified_time = None + self.created_time = None + self.revision = None + + +class SharedAccessAuthorizationRuleResource(Resource): + """Description of a Namespace AuthorizationRules. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param 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 primary_key: A base64-encoded 256-bit primary key for signing and + validating the SAS token. + :vartype primary_key: str + :ivar secondary_key: A base64-encoded 256-bit primary key for signing and + validating the SAS token. + :vartype secondary_key: str + :ivar key_name: A string that describes the authorization rule. + :vartype key_name: str + :ivar claim_type: A string that describes the claim type + :vartype claim_type: str + :ivar claim_value: A string that describes the claim value + :vartype claim_value: str + :ivar modified_time: The last modified time for this rule + :vartype modified_time: str + :ivar created_time: The created time for this rule + :vartype created_time: str + :ivar revision: The revision number for the rule + :vartype revision: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'primary_key': {'readonly': True}, + 'secondary_key': {'readonly': True}, + 'key_name': {'readonly': True}, + 'claim_type': {'readonly': True}, + 'claim_value': {'readonly': True}, + 'modified_time': {'readonly': True}, + 'created_time': {'readonly': True}, + 'revision': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'rights': {'key': 'properties.rights', 'type': '[AccessRights]'}, + 'primary_key': {'key': 'properties.primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'properties.secondaryKey', 'type': 'str'}, + 'key_name': {'key': 'properties.keyName', 'type': 'str'}, + 'claim_type': {'key': 'properties.claimType', 'type': 'str'}, + 'claim_value': {'key': 'properties.claimValue', 'type': 'str'}, + 'modified_time': {'key': 'properties.modifiedTime', 'type': 'str'}, + 'created_time': {'key': 'properties.createdTime', 'type': 'str'}, + 'revision': {'key': 'properties.revision', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(SharedAccessAuthorizationRuleResource, self).__init__(**kwargs) + self.rights = kwargs.get('rights', None) + self.primary_key = None + self.secondary_key = None + self.key_name = None + self.claim_type = None + self.claim_value = None + self.modified_time = None + self.created_time = None + self.revision = None + + +class Sku(Model): + """The Sku description for a namespace. + + 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', '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 + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(Sku, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.tier = kwargs.get('tier', None) + self.size = kwargs.get('size', None) + self.family = kwargs.get('family', None) + self.capacity = kwargs.get('capacity', None) + + +class SubResource(Model): + """SubResource. + + :param id: Resource Id + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SubResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class WnsCredential(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 + """ + + _attribute_map = { + 'package_sid': {'key': 'properties.packageSid', 'type': 'str'}, + 'secret_key': {'key': 'properties.secretKey', 'type': 'str'}, + 'windows_live_endpoint': {'key': 'properties.windowsLiveEndpoint', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(WnsCredential, self).__init__(**kwargs) + self.package_sid = kwargs.get('package_sid', None) + self.secret_key = kwargs.get('secret_key', None) + self.windows_live_endpoint = kwargs.get('windows_live_endpoint', 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 new file mode 100644 index 000000000000..fed4ad81dc30 --- /dev/null +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/_models_py3.py @@ -0,0 +1,1324 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class AdmCredential(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 + """ + + _attribute_map = { + 'client_id': {'key': 'properties.clientId', 'type': 'str'}, + 'client_secret': {'key': 'properties.clientSecret', 'type': 'str'}, + 'auth_token_url': {'key': 'properties.authTokenUrl', 'type': 'str'}, + } + + def __init__(self, *, client_id: str=None, client_secret: str=None, auth_token_url: str=None, **kwargs) -> None: + super(AdmCredential, self).__init__(**kwargs) + self.client_id = client_id + self.client_secret = client_secret + self.auth_token_url = auth_token_url + + +class ApnsCredential(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 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 Mode. + :type thumbprint: str + :param 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 Mode. + :type app_name: str + :param 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 + """ + + _attribute_map = { + 'apns_certificate': {'key': 'properties.apnsCertificate', 'type': 'str'}, + 'certificate_key': {'key': 'properties.certificateKey', 'type': 'str'}, + 'endpoint': {'key': 'properties.endpoint', 'type': 'str'}, + 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, + 'key_id': {'key': 'properties.keyId', 'type': 'str'}, + 'app_name': {'key': 'properties.appName', 'type': 'str'}, + 'app_id': {'key': 'properties.appId', 'type': 'str'}, + 'token': {'key': 'properties.token', 'type': 'str'}, + } + + def __init__(self, *, apns_certificate: str=None, certificate_key: str=None, endpoint: str=None, thumbprint: str=None, key_id: str=None, app_name: str=None, app_id: str=None, token: str=None, **kwargs) -> None: + super(ApnsCredential, self).__init__(**kwargs) + self.apns_certificate = apns_certificate + self.certificate_key = certificate_key + self.endpoint = endpoint + self.thumbprint = thumbprint + self.key_id = key_id + self.app_name = app_name + self.app_id = app_id + self.token = token + + +class BaiduCredential(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 + """ + + _attribute_map = { + 'baidu_api_key': {'key': 'properties.baiduApiKey', 'type': 'str'}, + 'baidu_end_point': {'key': 'properties.baiduEndPoint', 'type': 'str'}, + 'baidu_secret_key': {'key': 'properties.baiduSecretKey', 'type': 'str'}, + } + + def __init__(self, *, baidu_api_key: str=None, baidu_end_point: str=None, baidu_secret_key: str=None, **kwargs) -> None: + super(BaiduCredential, self).__init__(**kwargs) + self.baidu_api_key = baidu_api_key + self.baidu_end_point = baidu_end_point + self.baidu_secret_key = baidu_secret_key + + +class CheckAvailabilityParameters(Model): + """Parameters supplied to the Check Name Availability for Namespace and + NotificationHubs. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id + :vartype id: str + :param name: Required. Resource name + :type name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param 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 Namespace/NotificationHub. Otherwise false. + :type is_availiable: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'required': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'is_availiable': {'key': 'isAvailiable', 'type': 'bool'}, + } + + def __init__(self, *, name: str, location: str=None, tags=None, sku=None, is_availiable: bool=None, **kwargs) -> None: + super(CheckAvailabilityParameters, self).__init__(**kwargs) + self.id = None + self.name = name + self.type = None + self.location = location + self.tags = tags + self.sku = sku + self.is_availiable = is_availiable + + +class Resource(Model): + """Resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param sku: The sku of the created namespace + :type sku: ~azure.mgmt.notificationhubs.models.Sku + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__(self, *, location: str=None, tags=None, sku=None, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + self.sku = sku + + +class CheckAvailabilityResult(Resource): + """Description of a CheckAvailability resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param 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 Namespace/NotificationHub. Otherwise false. + :type is_availiable: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'is_availiable': {'key': 'isAvailiable', 'type': 'bool'}, + } + + def __init__(self, *, location: str=None, tags=None, sku=None, is_availiable: bool=None, **kwargs) -> None: + super(CheckAvailabilityResult, self).__init__(location=location, tags=tags, sku=sku, **kwargs) + self.is_availiable = is_availiable + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class DebugSendResponse(Resource): + """Description of a NotificationHub Resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param 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 + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'success': {'key': 'properties.success', 'type': 'float'}, + 'failure': {'key': 'properties.failure', 'type': 'float'}, + 'results': {'key': 'properties.results', 'type': 'object'}, + } + + def __init__(self, *, location: str=None, tags=None, sku=None, success: float=None, failure: float=None, results=None, **kwargs) -> None: + super(DebugSendResponse, self).__init__(location=location, tags=tags, sku=sku, **kwargs) + self.success = success + self.failure = failure + self.results = results + + +class ErrorResponse(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 + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class GcmCredential(Model): + """Description of a NotificationHub GcmCredential. + + :param 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 + """ + + _attribute_map = { + 'gcm_endpoint': {'key': 'properties.gcmEndpoint', 'type': 'str'}, + 'google_api_key': {'key': 'properties.googleApiKey', 'type': 'str'}, + } + + def __init__(self, *, gcm_endpoint: str=None, google_api_key: str=None, **kwargs) -> None: + super(GcmCredential, self).__init__(**kwargs) + self.gcm_endpoint = gcm_endpoint + self.google_api_key = google_api_key + + +class MpnsCredential(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 + """ + + _attribute_map = { + 'mpns_certificate': {'key': 'properties.mpnsCertificate', 'type': 'str'}, + 'certificate_key': {'key': 'properties.certificateKey', 'type': 'str'}, + 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, + } + + def __init__(self, *, mpns_certificate: str=None, certificate_key: str=None, thumbprint: str=None, **kwargs) -> None: + super(MpnsCredential, self).__init__(**kwargs) + self.mpns_certificate = mpns_certificate + self.certificate_key = certificate_key + self.thumbprint = thumbprint + + +class NamespaceCreateOrUpdateParameters(Resource): + """Parameters supplied to the CreateOrUpdate Namespace operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param sku: The sku of the created namespace + :type sku: ~azure.mgmt.notificationhubs.models.Sku + :param namespace_create_or_update_parameters_name: The name of the + namespace. + :type namespace_create_or_update_parameters_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 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 = Creating3 = Suspended4 = Deleting + :type status: str + :param created_at: The time the namespace was created. + :type created_at: datetime + :param updated_at: The time the namespace was updated. + :type updated_at: 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', 'NotificationHub' + :type namespace_type: str or + ~azure.mgmt.notificationhubs.models.NamespaceType + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'metric_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'namespace_create_or_update_parameters_name': {'key': 'properties.name', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'region': {'key': 'properties.region', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'subscription_id': {'key': 'properties.subscriptionId', 'type': 'str'}, + 'scale_unit': {'key': 'properties.scaleUnit', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'critical': {'key': 'properties.critical', 'type': 'bool'}, + 'data_center': {'key': 'properties.dataCenter', 'type': 'str'}, + 'namespace_type': {'key': 'properties.namespaceType', 'type': 'NamespaceType'}, + } + + def __init__(self, *, location: str=None, tags=None, sku=None, namespace_create_or_update_parameters_name: str=None, provisioning_state: str=None, region: str=None, status: str=None, created_at=None, updated_at=None, service_bus_endpoint: str=None, subscription_id: str=None, scale_unit: str=None, enabled: bool=None, critical: bool=None, data_center: str=None, namespace_type=None, **kwargs) -> None: + super(NamespaceCreateOrUpdateParameters, self).__init__(location=location, tags=tags, sku=sku, **kwargs) + self.namespace_create_or_update_parameters_name = namespace_create_or_update_parameters_name + self.provisioning_state = provisioning_state + self.region = region + self.metric_id = None + self.status = status + self.created_at = created_at + self.updated_at = updated_at + self.service_bus_endpoint = service_bus_endpoint + self.subscription_id = subscription_id + self.scale_unit = scale_unit + self.enabled = enabled + self.critical = critical + self.data_center = data_center + self.namespace_type = namespace_type + + +class NamespacePatchParameters(Model): + """Parameters supplied to the Patch Namespace operation. + + :param tags: Resource tags + :type tags: dict[str, str] + :param sku: The sku of the created namespace + :type sku: ~azure.mgmt.notificationhubs.models.Sku + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__(self, *, tags=None, sku=None, **kwargs) -> None: + super(NamespacePatchParameters, self).__init__(**kwargs) + self.tags = tags + self.sku = sku + + +class NamespaceResource(Resource): + """Description of a Namespace resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param sku: The sku of the created namespace + :type sku: ~azure.mgmt.notificationhubs.models.Sku + :param namespace_resource_name: The name of the namespace. + :type namespace_resource_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 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 = Creating3 = Suspended4 = Deleting + :type status: str + :param created_at: The time the namespace was created. + :type created_at: datetime + :param updated_at: The time the namespace was updated. + :type updated_at: 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', 'NotificationHub' + :type namespace_type: str or + ~azure.mgmt.notificationhubs.models.NamespaceType + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'metric_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'namespace_resource_name': {'key': 'properties.name', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'region': {'key': 'properties.region', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'subscription_id': {'key': 'properties.subscriptionId', 'type': 'str'}, + 'scale_unit': {'key': 'properties.scaleUnit', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'critical': {'key': 'properties.critical', 'type': 'bool'}, + 'data_center': {'key': 'properties.dataCenter', 'type': 'str'}, + 'namespace_type': {'key': 'properties.namespaceType', 'type': 'NamespaceType'}, + } + + def __init__(self, *, location: str=None, tags=None, sku=None, namespace_resource_name: str=None, provisioning_state: str=None, region: str=None, status: str=None, created_at=None, updated_at=None, service_bus_endpoint: str=None, subscription_id: str=None, scale_unit: str=None, enabled: bool=None, critical: bool=None, data_center: str=None, namespace_type=None, **kwargs) -> None: + super(NamespaceResource, self).__init__(location=location, tags=tags, sku=sku, **kwargs) + self.namespace_resource_name = namespace_resource_name + self.provisioning_state = provisioning_state + self.region = region + self.metric_id = None + self.status = status + self.created_at = created_at + self.updated_at = updated_at + self.service_bus_endpoint = service_bus_endpoint + self.subscription_id = subscription_id + self.scale_unit = scale_unit + self.enabled = enabled + self.critical = critical + self.data_center = data_center + self.namespace_type = namespace_type + + +class NotificationHubCreateOrUpdateParameters(Resource): + """Parameters supplied to the CreateOrUpdate NotificationHub operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param sku: The sku of the created namespace + :type sku: ~azure.mgmt.notificationhubs.models.Sku + :param notification_hub_create_or_update_parameters_name: The + NotificationHub name. + :type notification_hub_create_or_update_parameters_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: + 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 + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'notification_hub_create_or_update_parameters_name': {'key': 'properties.name', 'type': 'str'}, + 'registration_ttl': {'key': 'properties.registrationTtl', 'type': 'str'}, + 'authorization_rules': {'key': 'properties.authorizationRules', 'type': '[SharedAccessAuthorizationRuleProperties]'}, + 'apns_credential': {'key': 'properties.apnsCredential', 'type': 'ApnsCredential'}, + 'wns_credential': {'key': 'properties.wnsCredential', 'type': 'WnsCredential'}, + 'gcm_credential': {'key': 'properties.gcmCredential', 'type': 'GcmCredential'}, + 'mpns_credential': {'key': 'properties.mpnsCredential', 'type': 'MpnsCredential'}, + 'adm_credential': {'key': 'properties.admCredential', 'type': 'AdmCredential'}, + 'baidu_credential': {'key': 'properties.baiduCredential', 'type': 'BaiduCredential'}, + } + + def __init__(self, *, location: str=None, tags=None, sku=None, notification_hub_create_or_update_parameters_name: str=None, registration_ttl: str=None, authorization_rules=None, apns_credential=None, wns_credential=None, gcm_credential=None, mpns_credential=None, adm_credential=None, baidu_credential=None, **kwargs) -> None: + super(NotificationHubCreateOrUpdateParameters, self).__init__(location=location, tags=tags, sku=sku, **kwargs) + self.notification_hub_create_or_update_parameters_name = notification_hub_create_or_update_parameters_name + self.registration_ttl = registration_ttl + self.authorization_rules = authorization_rules + self.apns_credential = apns_credential + self.wns_credential = wns_credential + self.gcm_credential = gcm_credential + self.mpns_credential = mpns_credential + self.adm_credential = adm_credential + self.baidu_credential = baidu_credential + + +class NotificationHubPatchParameters(Resource): + """Parameters supplied to the patch NotificationHub operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param sku: The sku of the created namespace + :type sku: ~azure.mgmt.notificationhubs.models.Sku + :param notification_hub_patch_parameters_name: The NotificationHub name. + :type notification_hub_patch_parameters_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: + 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 + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'notification_hub_patch_parameters_name': {'key': 'properties.name', 'type': 'str'}, + 'registration_ttl': {'key': 'properties.registrationTtl', 'type': 'str'}, + 'authorization_rules': {'key': 'properties.authorizationRules', 'type': '[SharedAccessAuthorizationRuleProperties]'}, + 'apns_credential': {'key': 'properties.apnsCredential', 'type': 'ApnsCredential'}, + 'wns_credential': {'key': 'properties.wnsCredential', 'type': 'WnsCredential'}, + 'gcm_credential': {'key': 'properties.gcmCredential', 'type': 'GcmCredential'}, + 'mpns_credential': {'key': 'properties.mpnsCredential', 'type': 'MpnsCredential'}, + 'adm_credential': {'key': 'properties.admCredential', 'type': 'AdmCredential'}, + 'baidu_credential': {'key': 'properties.baiduCredential', 'type': 'BaiduCredential'}, + } + + def __init__(self, *, location: str=None, tags=None, sku=None, notification_hub_patch_parameters_name: str=None, registration_ttl: str=None, authorization_rules=None, apns_credential=None, wns_credential=None, gcm_credential=None, mpns_credential=None, adm_credential=None, baidu_credential=None, **kwargs) -> None: + super(NotificationHubPatchParameters, self).__init__(location=location, tags=tags, sku=sku, **kwargs) + self.notification_hub_patch_parameters_name = notification_hub_patch_parameters_name + self.registration_ttl = registration_ttl + self.authorization_rules = authorization_rules + self.apns_credential = apns_credential + self.wns_credential = wns_credential + self.gcm_credential = gcm_credential + self.mpns_credential = mpns_credential + self.adm_credential = adm_credential + self.baidu_credential = baidu_credential + + +class NotificationHubResource(Resource): + """Description of a NotificationHub Resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param sku: The sku of the created namespace + :type sku: ~azure.mgmt.notificationhubs.models.Sku + :param notification_hub_resource_name: The NotificationHub name. + :type notification_hub_resource_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: + 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 + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'notification_hub_resource_name': {'key': 'properties.name', 'type': 'str'}, + 'registration_ttl': {'key': 'properties.registrationTtl', 'type': 'str'}, + 'authorization_rules': {'key': 'properties.authorizationRules', 'type': '[SharedAccessAuthorizationRuleProperties]'}, + 'apns_credential': {'key': 'properties.apnsCredential', 'type': 'ApnsCredential'}, + 'wns_credential': {'key': 'properties.wnsCredential', 'type': 'WnsCredential'}, + 'gcm_credential': {'key': 'properties.gcmCredential', 'type': 'GcmCredential'}, + 'mpns_credential': {'key': 'properties.mpnsCredential', 'type': 'MpnsCredential'}, + 'adm_credential': {'key': 'properties.admCredential', 'type': 'AdmCredential'}, + 'baidu_credential': {'key': 'properties.baiduCredential', 'type': 'BaiduCredential'}, + } + + def __init__(self, *, location: str=None, tags=None, sku=None, notification_hub_resource_name: str=None, registration_ttl: str=None, authorization_rules=None, apns_credential=None, wns_credential=None, gcm_credential=None, mpns_credential=None, adm_credential=None, baidu_credential=None, **kwargs) -> None: + super(NotificationHubResource, self).__init__(location=location, tags=tags, sku=sku, **kwargs) + self.notification_hub_resource_name = notification_hub_resource_name + self.registration_ttl = registration_ttl + self.authorization_rules = authorization_rules + self.apns_credential = apns_credential + self.wns_credential = wns_credential + self.gcm_credential = gcm_credential + self.mpns_credential = mpns_credential + self.adm_credential = adm_credential + self.baidu_credential = baidu_credential + + +class Operation(Model): + """A NotificationHubs REST API operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation} + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.notificationhubs.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, *, display=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = display + + +class OperationDisplay(Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provider: Service provider: Microsoft.NotificationHubs + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Invoice, + etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + + +class PnsCredentialsResource(Resource): + """Description of a NotificationHub PNS Credentials. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param 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 + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'apns_credential': {'key': 'properties.apnsCredential', 'type': 'ApnsCredential'}, + 'wns_credential': {'key': 'properties.wnsCredential', 'type': 'WnsCredential'}, + 'gcm_credential': {'key': 'properties.gcmCredential', 'type': 'GcmCredential'}, + 'mpns_credential': {'key': 'properties.mpnsCredential', 'type': 'MpnsCredential'}, + 'adm_credential': {'key': 'properties.admCredential', 'type': 'AdmCredential'}, + 'baidu_credential': {'key': 'properties.baiduCredential', 'type': 'BaiduCredential'}, + } + + def __init__(self, *, location: str=None, tags=None, sku=None, apns_credential=None, wns_credential=None, gcm_credential=None, mpns_credential=None, adm_credential=None, baidu_credential=None, **kwargs) -> None: + super(PnsCredentialsResource, self).__init__(location=location, tags=tags, sku=sku, **kwargs) + self.apns_credential = apns_credential + self.wns_credential = wns_credential + self.gcm_credential = gcm_credential + self.mpns_credential = mpns_credential + self.adm_credential = adm_credential + self.baidu_credential = baidu_credential + + +class PolicykeyResource(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 + """ + + _attribute_map = { + 'policy_key': {'key': 'policyKey', 'type': 'str'}, + } + + def __init__(self, *, policy_key: str=None, **kwargs) -> None: + super(PolicykeyResource, self).__init__(**kwargs) + self.policy_key = policy_key + + +class ResourceListKeys(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 + """ + + _attribute_map = { + 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, + 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'key_name': {'key': 'keyName', 'type': 'str'}, + } + + def __init__(self, *, primary_connection_string: str=None, secondary_connection_string: str=None, primary_key: str=None, secondary_key: str=None, key_name: str=None, **kwargs) -> None: + super(ResourceListKeys, self).__init__(**kwargs) + self.primary_connection_string = primary_connection_string + self.secondary_connection_string = secondary_connection_string + self.primary_key = primary_key + self.secondary_key = secondary_key + self.key_name = key_name + + +class SharedAccessAuthorizationRuleCreateOrUpdateParameters(Model): + """Parameters supplied to the CreateOrUpdate Namespace AuthorizationRules. + + 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 + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'SharedAccessAuthorizationRuleProperties'}, + } + + def __init__(self, *, properties, **kwargs) -> None: + super(SharedAccessAuthorizationRuleCreateOrUpdateParameters, self).__init__(**kwargs) + self.properties = properties + + +class SharedAccessAuthorizationRuleListResult(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 of AuthorizationRules + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedAccessAuthorizationRuleResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, *, value=None, next_link: str=None, **kwargs) -> None: + super(SharedAccessAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SharedAccessAuthorizationRuleProperties(Model): + """SharedAccessAuthorizationRule properties. + + 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 primary_key: A base64-encoded 256-bit primary key for signing and + validating the SAS token. + :vartype primary_key: str + :ivar secondary_key: A base64-encoded 256-bit primary key for signing and + validating the SAS token. + :vartype secondary_key: str + :ivar key_name: A string that describes the authorization rule. + :vartype key_name: str + :ivar claim_type: A string that describes the claim type + :vartype claim_type: str + :ivar claim_value: A string that describes the claim value + :vartype claim_value: str + :ivar modified_time: The last modified time for this rule + :vartype modified_time: str + :ivar created_time: The created time for this rule + :vartype created_time: str + :ivar revision: The revision number for the rule + :vartype revision: int + """ + + _validation = { + 'primary_key': {'readonly': True}, + 'secondary_key': {'readonly': True}, + 'key_name': {'readonly': True}, + 'claim_type': {'readonly': True}, + 'claim_value': {'readonly': True}, + 'modified_time': {'readonly': True}, + 'created_time': {'readonly': True}, + 'revision': {'readonly': True}, + } + + _attribute_map = { + 'rights': {'key': 'rights', 'type': '[AccessRights]'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'claim_type': {'key': 'claimType', 'type': 'str'}, + 'claim_value': {'key': 'claimValue', 'type': 'str'}, + 'modified_time': {'key': 'modifiedTime', 'type': 'str'}, + 'created_time': {'key': 'createdTime', 'type': 'str'}, + 'revision': {'key': 'revision', 'type': 'int'}, + } + + def __init__(self, *, rights=None, **kwargs) -> None: + super(SharedAccessAuthorizationRuleProperties, self).__init__(**kwargs) + self.rights = rights + self.primary_key = None + self.secondary_key = None + self.key_name = None + self.claim_type = None + self.claim_value = None + self.modified_time = None + self.created_time = None + self.revision = None + + +class SharedAccessAuthorizationRuleResource(Resource): + """Description of a Namespace AuthorizationRules. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param 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 primary_key: A base64-encoded 256-bit primary key for signing and + validating the SAS token. + :vartype primary_key: str + :ivar secondary_key: A base64-encoded 256-bit primary key for signing and + validating the SAS token. + :vartype secondary_key: str + :ivar key_name: A string that describes the authorization rule. + :vartype key_name: str + :ivar claim_type: A string that describes the claim type + :vartype claim_type: str + :ivar claim_value: A string that describes the claim value + :vartype claim_value: str + :ivar modified_time: The last modified time for this rule + :vartype modified_time: str + :ivar created_time: The created time for this rule + :vartype created_time: str + :ivar revision: The revision number for the rule + :vartype revision: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'primary_key': {'readonly': True}, + 'secondary_key': {'readonly': True}, + 'key_name': {'readonly': True}, + 'claim_type': {'readonly': True}, + 'claim_value': {'readonly': True}, + 'modified_time': {'readonly': True}, + 'created_time': {'readonly': True}, + 'revision': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'rights': {'key': 'properties.rights', 'type': '[AccessRights]'}, + 'primary_key': {'key': 'properties.primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'properties.secondaryKey', 'type': 'str'}, + 'key_name': {'key': 'properties.keyName', 'type': 'str'}, + 'claim_type': {'key': 'properties.claimType', 'type': 'str'}, + 'claim_value': {'key': 'properties.claimValue', 'type': 'str'}, + 'modified_time': {'key': 'properties.modifiedTime', 'type': 'str'}, + 'created_time': {'key': 'properties.createdTime', 'type': 'str'}, + 'revision': {'key': 'properties.revision', 'type': 'int'}, + } + + def __init__(self, *, location: str=None, tags=None, sku=None, rights=None, **kwargs) -> None: + super(SharedAccessAuthorizationRuleResource, self).__init__(location=location, tags=tags, sku=sku, **kwargs) + self.rights = rights + self.primary_key = None + self.secondary_key = None + self.key_name = None + self.claim_type = None + self.claim_value = None + self.modified_time = None + self.created_time = None + self.revision = None + + +class Sku(Model): + """The Sku description for a namespace. + + 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', '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 + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__(self, *, name, tier: str=None, size: str=None, family: str=None, capacity: int=None, **kwargs) -> None: + super(Sku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.size = size + self.family = family + self.capacity = capacity + + +class SubResource(Model): + """SubResource. + + :param id: Resource Id + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str=None, **kwargs) -> None: + super(SubResource, self).__init__(**kwargs) + self.id = id + + +class WnsCredential(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 + """ + + _attribute_map = { + 'package_sid': {'key': 'properties.packageSid', 'type': 'str'}, + 'secret_key': {'key': 'properties.secretKey', 'type': 'str'}, + 'windows_live_endpoint': {'key': 'properties.windowsLiveEndpoint', 'type': 'str'}, + } + + def __init__(self, *, package_sid: str=None, secret_key: str=None, windows_live_endpoint: str=None, **kwargs) -> None: + super(WnsCredential, self).__init__(**kwargs) + self.package_sid = package_sid + self.secret_key = secret_key + self.windows_live_endpoint = windows_live_endpoint 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 new file mode 100644 index 000000000000..f97b28ab81f5 --- /dev/null +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/_notification_hubs_management_client_enums.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class SkuName(str, Enum): + + free = "Free" + basic = "Basic" + standard = "Standard" + + +class NamespaceType(str, Enum): + + messaging = "Messaging" + notification_hub = "NotificationHub" + + +class AccessRights(str, Enum): + + manage = "Manage" + send = "Send" + listen = "Listen" diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/_paged_models.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/_paged_models.py new file mode 100644 index 000000000000..fa772102412a --- /dev/null +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/_paged_models.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class OperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Operation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Operation]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationPaged, self).__init__(*args, **kwargs) +class NamespaceResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`NamespaceResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[NamespaceResource]'} + } + + def __init__(self, *args, **kwargs): + + super(NamespaceResourcePaged, self).__init__(*args, **kwargs) +class SharedAccessAuthorizationRuleResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`SharedAccessAuthorizationRuleResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SharedAccessAuthorizationRuleResource]'} + } + + def __init__(self, *args, **kwargs): + + super(SharedAccessAuthorizationRuleResourcePaged, self).__init__(*args, **kwargs) +class NotificationHubResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`NotificationHubResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[NotificationHubResource]'} + } + + def __init__(self, *args, **kwargs): + + super(NotificationHubResourcePaged, self).__init__(*args, **kwargs) diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/__init__.py b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/__init__.py index a81c5ff50e13..03a7feb35675 100644 --- a/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/__init__.py +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/__init__.py @@ -9,9 +9,9 @@ # regenerated. # -------------------------------------------------------------------------- -from .operations import Operations -from .namespaces_operations import NamespacesOperations -from .notification_hubs_operations import NotificationHubsOperations +from ._operations import Operations +from ._namespaces_operations import NamespacesOperations +from ._notification_hubs_operations import NotificationHubsOperations __all__ = [ 'Operations', 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 new file mode 100644 index 000000000000..5e958c30e5df --- /dev/null +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/_namespaces_operations.py @@ -0,0 +1,940 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class NamespacesOperations(object): + """NamespacesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2017-04-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-04-01" + + self.config = config + + def check_availability( + self, parameters, custom_headers=None, raw=False, **operation_config): + """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. + + :param parameters: The namespace name. + :type parameters: + ~azure.mgmt.notificationhubs.models.CheckAvailabilityParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: CheckAvailabilityResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.notificationhubs.models.CheckAvailabilityResult or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.check_availability.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'CheckAvailabilityParameters') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CheckAvailabilityResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + check_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/checkNamespaceAvailability'} + + def create_or_update( + self, resource_group_name, namespace_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates/Updates a service namespace. Once created, this namespace's + resource manifest is immutable. This operation is idempotent. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: Parameters supplied to create a Namespace Resource. + :type parameters: + ~azure.mgmt.notificationhubs.models.NamespaceCreateOrUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: NamespaceResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.notificationhubs.models.NamespaceResource or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'NamespaceCreateOrUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NamespaceResource', response) + if response.status_code == 201: + deserialized = self._deserialize('NamespaceResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}'} + + def patch( + self, resource_group_name, namespace_name, tags=None, sku=None, custom_headers=None, raw=False, **operation_config): + """Patches the existing namespace. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param tags: Resource tags + :type tags: dict[str, str] + :param sku: The sku of the created namespace + :type sku: ~azure.mgmt.notificationhubs.models.Sku + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: NamespaceResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.notificationhubs.models.NamespaceResource or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.NamespacePatchParameters(tags=tags, sku=sku) + + # Construct URL + url = self.patch.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'NamespacePatchParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NamespaceResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}'} + + + def _delete_initial( + self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, namespace_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an existing namespace. This operation also removes all + associated notificationHubs under the namespace. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}'} + + def get( + self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): + """Returns the description for the specified namespace. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: NamespaceResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.notificationhubs.models.NamespaceResource or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NamespaceResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}'} + + def create_or_update_authorization_rule( + self, resource_group_name, namespace_name, authorization_rule_name, properties, custom_headers=None, raw=False, **operation_config): + """Creates an authorization rule for a namespace. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: Authorization Rule Name. + :type authorization_rule_name: str + :param properties: Properties of the Namespace AuthorizationRules. + :type properties: + ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleProperties + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: SharedAccessAuthorizationRuleResource or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleResource + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.SharedAccessAuthorizationRuleCreateOrUpdateParameters(properties=properties) + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} + + def delete_authorization_rule( + self, resource_group_name, namespace_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes a namespace authorization rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: Authorization Rule Name. + :type authorization_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete_authorization_rule.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} + + def get_authorization_rule( + self, resource_group_name, namespace_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Gets an authorization rule for a namespace by name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param authorization_rule_name: Authorization rule name. + :type authorization_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: SharedAccessAuthorizationRuleResource or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleResource + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_authorization_rule.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} + + def list( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Lists the available namespaces within a resourceGroup. + + :param resource_group_name: The name of the resource group. If + resourceGroupName value is null the method lists all the namespaces + within subscription + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of NamespaceResource + :rtype: + ~azure.mgmt.notificationhubs.models.NamespaceResourcePaged[~azure.mgmt.notificationhubs.models.NamespaceResource] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.NamespaceResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces'} + + def list_all( + self, custom_headers=None, raw=False, **operation_config): + """Lists all the available namespaces within the subscription irrespective + of the resourceGroups. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of NamespaceResource + :rtype: + ~azure.mgmt.notificationhubs.models.NamespaceResourcePaged[~azure.mgmt.notificationhubs.models.NamespaceResource] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_all.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.NamespaceResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/namespaces'} + + def list_authorization_rules( + self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): + """Gets the authorization rules for a namespace. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of + SharedAccessAuthorizationRuleResource + :rtype: + ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleResourcePaged[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleResource] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.SharedAccessAuthorizationRuleResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules'} + + def list_keys( + self, resource_group_name, namespace_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Gets the Primary and Secondary ConnectionStrings to the namespace . + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The connection string of the namespace + for the specified authorizationRule. + :type authorization_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: SharedAccessAuthorizationRuleListResult or ClientRawResponse + if raw=true + :rtype: + ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleListResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list_keys.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SharedAccessAuthorizationRuleListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys'} + + def regenerate_keys( + self, resource_group_name, namespace_name, authorization_rule_name, policy_key=None, custom_headers=None, raw=False, **operation_config): + """Regenerates the Primary/Secondary Keys to the Namespace Authorization + Rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The connection string of the namespace + for the specified authorizationRule. + :type authorization_rule_name: str + :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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ResourceListKeys or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.notificationhubs.models.ResourceListKeys or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.PolicykeyResource(policy_key=policy_key) + + # Construct URL + url = self.regenerate_keys.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'PolicykeyResource') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ResourceListKeys', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'} 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 new file mode 100644 index 000000000000..d15f134967f9 --- /dev/null +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/_notification_hubs_operations.py @@ -0,0 +1,1016 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class NotificationHubsOperations(object): + """NotificationHubsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2017-04-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-04-01" + + self.config = config + + def check_notification_hub_availability( + self, resource_group_name, namespace_name, parameters, custom_headers=None, raw=False, **operation_config): + """Checks the availability of the given notificationHub in a namespace. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: The notificationHub name. + :type parameters: + ~azure.mgmt.notificationhubs.models.CheckAvailabilityParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: CheckAvailabilityResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.notificationhubs.models.CheckAvailabilityResult or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.check_notification_hub_availability.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'CheckAvailabilityParameters') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CheckAvailabilityResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + check_notification_hub_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/checkNotificationHubAvailability'} + + def create_or_update( + self, resource_group_name, namespace_name, notification_hub_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates/Update a NotificationHub in a namespace. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param notification_hub_name: The notification hub name. + :type notification_hub_name: str + :param parameters: Parameters supplied to the create/update a + NotificationHub Resource. + :type parameters: + ~azure.mgmt.notificationhubs.models.NotificationHubCreateOrUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: NotificationHubResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.notificationhubs.models.NotificationHubResource or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'NotificationHubCreateOrUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NotificationHubResource', response) + if response.status_code == 201: + deserialized = self._deserialize('NotificationHubResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}'} + + def patch( + self, resource_group_name, namespace_name, notification_hub_name, parameters=None, custom_headers=None, raw=False, **operation_config): + """Patch a NotificationHub in a namespace. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param notification_hub_name: The notification hub name. + :type notification_hub_name: str + :param parameters: Parameters supplied to patch a NotificationHub + Resource. + :type parameters: + ~azure.mgmt.notificationhubs.models.NotificationHubPatchParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: NotificationHubResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.notificationhubs.models.NotificationHubResource or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.patch.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + if parameters is not None: + body_content = self._serialize.body(parameters, 'NotificationHubPatchParameters') + else: + body_content = None + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NotificationHubResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}'} + + def delete( + self, resource_group_name, namespace_name, notification_hub_name, custom_headers=None, raw=False, **operation_config): + """Deletes a notification hub associated with a namespace. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param notification_hub_name: The notification hub name. + :type notification_hub_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}'} + + def get( + self, resource_group_name, namespace_name, notification_hub_name, custom_headers=None, raw=False, **operation_config): + """Lists the notification hubs associated with a namespace. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param notification_hub_name: The notification hub name. + :type notification_hub_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: NotificationHubResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.notificationhubs.models.NotificationHubResource or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NotificationHubResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}'} + + def debug_send( + self, resource_group_name, namespace_name, notification_hub_name, parameters=None, custom_headers=None, raw=False, **operation_config): + """test send a push notification. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param notification_hub_name: The notification hub name. + :type notification_hub_name: str + :param parameters: Debug send parameters + :type parameters: object + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DebugSendResponse or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.notificationhubs.models.DebugSendResponse or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.debug_send.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + if parameters is not None: + body_content = self._serialize.body(parameters, 'object') + else: + body_content = None + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 201: + deserialized = self._deserialize('DebugSendResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + debug_send.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/debugsend'} + + def create_or_update_authorization_rule( + self, resource_group_name, namespace_name, notification_hub_name, authorization_rule_name, properties, custom_headers=None, raw=False, **operation_config): + """Creates/Updates an authorization rule for a NotificationHub. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param notification_hub_name: The notification hub name. + :type notification_hub_name: str + :param authorization_rule_name: Authorization Rule Name. + :type authorization_rule_name: str + :param properties: Properties of the Namespace AuthorizationRules. + :type properties: + ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleProperties + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: SharedAccessAuthorizationRuleResource or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleResource + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.SharedAccessAuthorizationRuleCreateOrUpdateParameters(properties=properties) + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}'} + + def delete_authorization_rule( + self, resource_group_name, namespace_name, notification_hub_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes a notificationHub authorization rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param notification_hub_name: The notification hub name. + :type notification_hub_name: str + :param authorization_rule_name: Authorization Rule Name. + :type authorization_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete_authorization_rule.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}'} + + def get_authorization_rule( + self, resource_group_name, namespace_name, notification_hub_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Gets an authorization rule for a NotificationHub by name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param notification_hub_name: The notification hub name. + :type notification_hub_name: str + :param authorization_rule_name: authorization rule name. + :type authorization_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: SharedAccessAuthorizationRuleResource or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleResource + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_authorization_rule.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}'} + + def list( + self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): + """Lists the notification hubs associated with a namespace. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of NotificationHubResource + :rtype: + ~azure.mgmt.notificationhubs.models.NotificationHubResourcePaged[~azure.mgmt.notificationhubs.models.NotificationHubResource] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.NotificationHubResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs'} + + def list_authorization_rules( + self, resource_group_name, namespace_name, notification_hub_name, custom_headers=None, raw=False, **operation_config): + """Gets the authorization rules for a NotificationHub. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param notification_hub_name: The notification hub name. + :type notification_hub_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of + SharedAccessAuthorizationRuleResource + :rtype: + ~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleResourcePaged[~azure.mgmt.notificationhubs.models.SharedAccessAuthorizationRuleResource] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.SharedAccessAuthorizationRuleResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules'} + + def list_keys( + self, resource_group_name, namespace_name, notification_hub_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Gets the Primary and Secondary ConnectionStrings to the NotificationHub + . + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param notification_hub_name: The notification hub name. + :type notification_hub_name: str + :param authorization_rule_name: The connection string of the + NotificationHub for the specified authorizationRule. + :type authorization_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ResourceListKeys or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.notificationhubs.models.ResourceListKeys or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list_keys.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ResourceListKeys', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/listKeys'} + + def regenerate_keys( + self, resource_group_name, namespace_name, notification_hub_name, authorization_rule_name, policy_key=None, custom_headers=None, raw=False, **operation_config): + """Regenerates the Primary/Secondary Keys to the NotificationHub + Authorization Rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param notification_hub_name: The notification hub name. + :type notification_hub_name: str + :param authorization_rule_name: The connection string of the + NotificationHub for the specified authorizationRule. + :type authorization_rule_name: str + :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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ResourceListKeys or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.notificationhubs.models.ResourceListKeys or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.PolicykeyResource(policy_key=policy_key) + + # Construct URL + url = self.regenerate_keys.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'PolicykeyResource') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ResourceListKeys', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'} + + def get_pns_credentials( + self, resource_group_name, namespace_name, notification_hub_name, custom_headers=None, raw=False, **operation_config): + """Lists the PNS Credentials associated with a notification hub . + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param notification_hub_name: The notification hub name. + :type notification_hub_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PnsCredentialsResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.notificationhubs.models.PnsCredentialsResource or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_pns_credentials.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PnsCredentialsResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_pns_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/pnsCredentials'} 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 new file mode 100644 index 000000000000..37450593c079 --- /dev/null +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/_operations.py @@ -0,0 +1,100 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class Operations(object): + """Operations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2017-04-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-04-01" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all of the available NotificationHubs REST API operations. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Operation + :rtype: + ~azure.mgmt.notificationhubs.models.OperationPaged[~azure.mgmt.notificationhubs.models.Operation] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.NotificationHubs/operations'}