From fb01a829d26cd9089bd65516ab58fb8cd2bc3921 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 12 Jun 2018 00:50:55 +0000 Subject: [PATCH 1/7] Generated from 01edec5fd7a2a02c2d9855146656bfef4c7f423f Add debugsend and NH patch operation --- .../mgmt/notificationhubs/models/__init__.py | 3 + .../models/check_availability_parameters.py | 3 +- .../check_availability_parameters_py3.py | 5 +- .../notification_hub_patch_parameters.py | 92 ++++++++++++ .../notification_hub_patch_parameters_py3.py | 92 ++++++++++++ .../notification_hubs_operations.py | 142 ++++++++++++++++++ .../azure/mgmt/notificationhubs/version.py | 2 +- 7 files changed, 333 insertions(+), 6 deletions(-) create mode 100644 azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/notification_hub_patch_parameters.py create mode 100644 azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/notification_hub_patch_parameters_py3.py diff --git a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/__init__.py b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/__init__.py index fa659d0d218c..59f5718d00e6 100644 --- a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/__init__.py +++ b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/__init__.py @@ -32,6 +32,7 @@ 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 .pns_credentials_resource_py3 import PnsCredentialsResource from .resource_py3 import Resource @@ -59,6 +60,7 @@ 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 .pns_credentials_resource import PnsCredentialsResource from .resource import Resource @@ -96,6 +98,7 @@ 'AdmCredential', 'BaiduCredential', 'NotificationHubCreateOrUpdateParameters', + 'NotificationHubPatchParameters', 'NotificationHubResource', 'PnsCredentialsResource', 'Resource', diff --git a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/check_availability_parameters.py b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/check_availability_parameters.py index 3ed36a8e0bf3..58a09e27f799 100644 --- a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/check_availability_parameters.py +++ b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/check_availability_parameters.py @@ -27,7 +27,7 @@ class CheckAvailabilityParameters(Model): :type name: str :ivar type: Resource type :vartype type: str - :param location: Required. Resource location + :param location: Resource location :type location: str :param tags: Resource tags :type tags: dict[str, str] @@ -42,7 +42,6 @@ class CheckAvailabilityParameters(Model): 'id': {'readonly': True}, 'name': {'required': True}, 'type': {'readonly': True}, - 'location': {'required': True}, } _attribute_map = { diff --git a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/check_availability_parameters_py3.py b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/check_availability_parameters_py3.py index 9913fc3c1b0b..2160e9778ec3 100644 --- a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/check_availability_parameters_py3.py +++ b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/check_availability_parameters_py3.py @@ -27,7 +27,7 @@ class CheckAvailabilityParameters(Model): :type name: str :ivar type: Resource type :vartype type: str - :param location: Required. Resource location + :param location: Resource location :type location: str :param tags: Resource tags :type tags: dict[str, str] @@ -42,7 +42,6 @@ class CheckAvailabilityParameters(Model): 'id': {'readonly': True}, 'name': {'required': True}, 'type': {'readonly': True}, - 'location': {'required': True}, } _attribute_map = { @@ -55,7 +54,7 @@ class CheckAvailabilityParameters(Model): 'is_availiable': {'key': 'isAvailiable', 'type': 'bool'}, } - def __init__(self, *, name: str, location: str, tags=None, sku=None, is_availiable: bool=None, **kwargs) -> None: + 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 diff --git a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/notification_hub_patch_parameters.py b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/notification_hub_patch_parameters.py new file mode 100644 index 000000000000..9906c1f182f4 --- /dev/null +++ b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/notification_hub_patch_parameters.py @@ -0,0 +1,92 @@ +# 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 .resource import Resource + + +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) diff --git a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/notification_hub_patch_parameters_py3.py b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/notification_hub_patch_parameters_py3.py new file mode 100644 index 000000000000..5743571caa10 --- /dev/null +++ b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/notification_hub_patch_parameters_py3.py @@ -0,0 +1,92 @@ +# 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 .resource_py3 import Resource + + +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 diff --git a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py index d81cee2faf2e..fe071f0166df 100644 --- a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py +++ b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py @@ -181,6 +181,79 @@ def create_or_update( 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, 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['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, 'NotificationHubPatchParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, 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. @@ -303,6 +376,75 @@ def get( 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, 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: The shared access authorization rule. + :type parameters: 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.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') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + 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, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, 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('NotificationHubResource', 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. diff --git a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/version.py b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/version.py index 53c4c7ea05e8..5c2dbfde66c5 100644 --- a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/version.py +++ b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "2017-04-01" From 1d0d8d0ce93458822f96386ac11f00680f970556 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 12 Jun 2018 21:22:05 +0000 Subject: [PATCH 2/7] Generated from 0238c4239dec40fef6679fd36f8498b82c6157c8 Fix build error due to missing parameterId --- .../operations/notification_hubs_operations.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py index fe071f0166df..cd9040f994a8 100644 --- a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py +++ b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py @@ -403,12 +403,14 @@ def debug_send( 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') + '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 = {} From 203ef3344b4281fc109615ce154a81bf91de3aec Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 12 Jun 2018 22:39:45 +0000 Subject: [PATCH 3/7] Generated from 2f2ca999f5033c50ea6ad7ce9a493b9d1bd5c993 Fix more errors --- .../operations/notification_hubs_operations.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py index cd9040f994a8..c859b250073a 100644 --- a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py +++ b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py @@ -182,7 +182,7 @@ def create_or_update( 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, custom_headers=None, raw=False, **operation_config): + 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. @@ -230,7 +230,10 @@ def patch( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'NotificationHubPatchParameters') + 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) From dedbd1cce868755478513174f01c148cb33eae84 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 12 Jun 2018 22:48:15 +0000 Subject: [PATCH 4/7] Generated from 3b57f480cb371a58ae1c0feb24e6a0270c671acd Fix build errors due to mismatch parameters --- .../mgmt/notificationhubs/models/__init__.py | 3 + .../models/debug_send_response.py | 63 +++++++++++++++++++ .../models/debug_send_response_py3.py | 63 +++++++++++++++++++ .../notification_hubs_operations.py | 6 +- 4 files changed, 132 insertions(+), 3 deletions(-) create mode 100644 azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/debug_send_response.py create mode 100644 azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/debug_send_response_py3.py diff --git a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/__init__.py b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/__init__.py index 59f5718d00e6..6e7e9ee3b381 100644 --- a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/__init__.py +++ b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/__init__.py @@ -34,6 +34,7 @@ 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 @@ -62,6 +63,7 @@ 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 @@ -100,6 +102,7 @@ 'NotificationHubCreateOrUpdateParameters', 'NotificationHubPatchParameters', 'NotificationHubResource', + 'DebugSendResponse', 'PnsCredentialsResource', 'Resource', 'SubResource', diff --git a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/debug_send_response.py b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/debug_send_response.py new file mode 100644 index 000000000000..91e1a96a441d --- /dev/null +++ b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/debug_send_response.py @@ -0,0 +1,63 @@ +# 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 .resource import Resource + + +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: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'success': {'key': 'properties.success', 'type': 'float'}, + 'failure': {'key': 'properties.failure', 'type': 'float'}, + 'results': {'key': 'properties.results', 'type': 'str'}, + } + + 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) diff --git a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/debug_send_response_py3.py b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/debug_send_response_py3.py new file mode 100644 index 000000000000..5832636e914c --- /dev/null +++ b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/debug_send_response_py3.py @@ -0,0 +1,63 @@ +# 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 .resource_py3 import Resource + + +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: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'success': {'key': 'properties.success', 'type': 'float'}, + 'failure': {'key': 'properties.failure', 'type': 'float'}, + 'results': {'key': 'properties.results', 'type': 'str'}, + } + + def __init__(self, *, location: str=None, tags=None, sku=None, success: float=None, failure: float=None, results: str=None, **kwargs) -> None: + super(DebugSendResponse, self).__init__(location=location, tags=tags, sku=sku, **kwargs) + self.success = success + self.failure = failure + self.results = results diff --git a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py index c859b250073a..1317eda722a5 100644 --- a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py +++ b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py @@ -396,8 +396,8 @@ def debug_send( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: NotificationHubResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.notificationhubs.models.NotificationHubResource or + :return: DebugSendResponse or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.notificationhubs.models.DebugSendResponse or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ @@ -441,7 +441,7 @@ def debug_send( deserialized = None if response.status_code == 201: - deserialized = self._deserialize('NotificationHubResource', response) + deserialized = self._deserialize('DebugSendResponse', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) From dab581b949ab6e2b0051f6b1fa1446d5be3f9e53 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 12 Jun 2018 23:17:00 +0000 Subject: [PATCH 5/7] Generated from edb81a4b9052ef17263836b0b079b7204c6a33ce Fix error with missing parameters value for DebugSend --- .../operations/notification_hubs_operations.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py index 1317eda722a5..da4347e6e911 100644 --- a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py +++ b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py @@ -380,7 +380,7 @@ def get( 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, custom_headers=None, raw=False, **operation_config): + 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. @@ -389,7 +389,7 @@ def debug_send( :type namespace_name: str :param notification_hub_name: The notification hub name. :type notification_hub_name: str - :param parameters: The shared access authorization rule. + :param parameters: Debug send message payload :type parameters: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the @@ -426,7 +426,10 @@ def debug_send( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'str') + if parameters is not None: + body_content = self._serialize.body(parameters, 'str') + else: + body_content = None # Construct and send request request = self._client.post(url, query_parameters) From 019ead05b9203b0e6f03262de38a766787d571d7 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 12 Jun 2018 23:41:53 +0000 Subject: [PATCH 6/7] Generated from 3e947825fd1f50e39862de452aa599a4e4bc74b1 Change DebugSendResult from string to object --- .../mgmt/notificationhubs/models/debug_send_response.py | 4 ++-- .../mgmt/notificationhubs/models/debug_send_response_py3.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/debug_send_response.py b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/debug_send_response.py index 91e1a96a441d..c6b273e88cdf 100644 --- a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/debug_send_response.py +++ b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/debug_send_response.py @@ -35,7 +35,7 @@ class DebugSendResponse(Resource): :param failure: send failure :type failure: float :param results: actual failure description - :type results: str + :type results: object """ _validation = { @@ -53,7 +53,7 @@ class DebugSendResponse(Resource): 'sku': {'key': 'sku', 'type': 'Sku'}, 'success': {'key': 'properties.success', 'type': 'float'}, 'failure': {'key': 'properties.failure', 'type': 'float'}, - 'results': {'key': 'properties.results', 'type': 'str'}, + 'results': {'key': 'properties.results', 'type': 'object'}, } def __init__(self, **kwargs): diff --git a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/debug_send_response_py3.py b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/debug_send_response_py3.py index 5832636e914c..117573ecdc7c 100644 --- a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/debug_send_response_py3.py +++ b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/debug_send_response_py3.py @@ -35,7 +35,7 @@ class DebugSendResponse(Resource): :param failure: send failure :type failure: float :param results: actual failure description - :type results: str + :type results: object """ _validation = { @@ -53,10 +53,10 @@ class DebugSendResponse(Resource): 'sku': {'key': 'sku', 'type': 'Sku'}, 'success': {'key': 'properties.success', 'type': 'float'}, 'failure': {'key': 'properties.failure', 'type': 'float'}, - 'results': {'key': 'properties.results', 'type': 'str'}, + 'results': {'key': 'properties.results', 'type': 'object'}, } - def __init__(self, *, location: str=None, tags=None, sku=None, success: float=None, failure: float=None, results: str=None, **kwargs) -> None: + 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 From 5b024344221276ea960a57977b1efeafabf0356e Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 13 Jun 2018 00:26:18 +0000 Subject: [PATCH 7/7] Generated from 65b541d42b26f877d8ec658d93e103417c2db181 Fix DebugSend build errors --- .../operations/notification_hubs_operations.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py index da4347e6e911..559cf5381677 100644 --- a/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py +++ b/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/notification_hubs_operations.py @@ -389,8 +389,8 @@ def debug_send( :type namespace_name: str :param notification_hub_name: The notification hub name. :type notification_hub_name: str - :param parameters: Debug send message payload - :type parameters: 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 @@ -427,7 +427,7 @@ def debug_send( # Construct body if parameters is not None: - body_content = self._serialize.body(parameters, 'str') + body_content = self._serialize.body(parameters, 'object') else: body_content = None