diff --git a/azure-mgmt-servicebus/azure/mgmt/servicebus/models/__init__.py b/azure-mgmt-servicebus/azure/mgmt/servicebus/models/__init__.py index 5d211fbf8244..2aab74f95055 100644 --- a/azure-mgmt-servicebus/azure/mgmt/servicebus/models/__init__.py +++ b/azure-mgmt-servicebus/azure/mgmt/servicebus/models/__init__.py @@ -16,6 +16,7 @@ from .sb_sku_py3 import SBSku from .sb_namespace_py3 import SBNamespace from .sb_namespace_update_parameters_py3 import SBNamespaceUpdateParameters + from .sb_namespace_migrate_py3 import SBNamespaceMigrate from .sb_authorization_rule_py3 import SBAuthorizationRule from .authorization_rule_properties_py3 import AuthorizationRuleProperties from .access_keys_py3 import AccessKeys @@ -50,6 +51,7 @@ from .sb_sku import SBSku from .sb_namespace import SBNamespace from .sb_namespace_update_parameters import SBNamespaceUpdateParameters + from .sb_namespace_migrate import SBNamespaceMigrate from .sb_authorization_rule import SBAuthorizationRule from .authorization_rule_properties import AuthorizationRuleProperties from .access_keys import AccessKeys @@ -93,6 +95,7 @@ from .service_bus_management_client_enums import ( SkuName, SkuTier, + NameSpaceType, AccessRights, KeyType, EntityStatus, @@ -111,6 +114,7 @@ 'SBSku', 'SBNamespace', 'SBNamespaceUpdateParameters', + 'SBNamespaceMigrate', 'SBAuthorizationRule', 'AuthorizationRuleProperties', 'AccessKeys', @@ -153,6 +157,7 @@ 'EventhubPaged', 'SkuName', 'SkuTier', + 'NameSpaceType', 'AccessRights', 'KeyType', 'EntityStatus', diff --git a/azure-mgmt-servicebus/azure/mgmt/servicebus/models/sb_namespace_migrate.py b/azure-mgmt-servicebus/azure/mgmt/servicebus/models/sb_namespace_migrate.py new file mode 100644 index 000000000000..a428dd686e41 --- /dev/null +++ b/azure-mgmt-servicebus/azure/mgmt/servicebus/models/sb_namespace_migrate.py @@ -0,0 +1,37 @@ +# 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 + + +class SBNamespaceMigrate(Model): + """Namespace Migrate Object. + + All required parameters must be populated in order to send to Azure. + + :param target_namespace_type: Required. Type of namespaces. Possible + values include: 'Messaging', 'NotificationHub', 'Mixed', 'EventHub', + 'Relay' + :type target_namespace_type: str or + ~azure.mgmt.servicebus.models.NameSpaceType + """ + + _validation = { + 'target_namespace_type': {'required': True}, + } + + _attribute_map = { + 'target_namespace_type': {'key': 'targetNamespaceType', 'type': 'NameSpaceType'}, + } + + def __init__(self, **kwargs): + super(SBNamespaceMigrate, self).__init__(**kwargs) + self.target_namespace_type = kwargs.get('target_namespace_type', None) diff --git a/azure-mgmt-servicebus/azure/mgmt/servicebus/models/sb_namespace_migrate_py3.py b/azure-mgmt-servicebus/azure/mgmt/servicebus/models/sb_namespace_migrate_py3.py new file mode 100644 index 000000000000..52e28dbea884 --- /dev/null +++ b/azure-mgmt-servicebus/azure/mgmt/servicebus/models/sb_namespace_migrate_py3.py @@ -0,0 +1,37 @@ +# 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 + + +class SBNamespaceMigrate(Model): + """Namespace Migrate Object. + + All required parameters must be populated in order to send to Azure. + + :param target_namespace_type: Required. Type of namespaces. Possible + values include: 'Messaging', 'NotificationHub', 'Mixed', 'EventHub', + 'Relay' + :type target_namespace_type: str or + ~azure.mgmt.servicebus.models.NameSpaceType + """ + + _validation = { + 'target_namespace_type': {'required': True}, + } + + _attribute_map = { + 'target_namespace_type': {'key': 'targetNamespaceType', 'type': 'NameSpaceType'}, + } + + def __init__(self, *, target_namespace_type, **kwargs) -> None: + super(SBNamespaceMigrate, self).__init__(**kwargs) + self.target_namespace_type = target_namespace_type diff --git a/azure-mgmt-servicebus/azure/mgmt/servicebus/models/service_bus_management_client_enums.py b/azure-mgmt-servicebus/azure/mgmt/servicebus/models/service_bus_management_client_enums.py index 53552468acd9..f5dbf7311524 100644 --- a/azure-mgmt-servicebus/azure/mgmt/servicebus/models/service_bus_management_client_enums.py +++ b/azure-mgmt-servicebus/azure/mgmt/servicebus/models/service_bus_management_client_enums.py @@ -26,6 +26,15 @@ class SkuTier(str, Enum): premium = "Premium" +class NameSpaceType(str, Enum): + + messaging = "Messaging" + notification_hub = "NotificationHub" + mixed = "Mixed" + event_hub = "EventHub" + relay = "Relay" + + class AccessRights(str, Enum): manage = "Manage" diff --git a/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/namespaces_operations.py b/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/namespaces_operations.py index 7768f6856311..401f5c2202d5 100644 --- a/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/namespaces_operations.py +++ b/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/namespaces_operations.py @@ -959,6 +959,69 @@ def regenerate_keys( return deserialized regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'} + def migrate( + self, resource_group_name, namespace_name, target_namespace_type, custom_headers=None, raw=False, **operation_config): + """This operation Migrate the given namespace to provided name type. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name + :type namespace_name: str + :param target_namespace_type: Type of namespaces. Possible values + include: 'Messaging', 'NotificationHub', 'Mixed', 'EventHub', 'Relay' + :type target_namespace_type: str or + ~azure.mgmt.servicebus.models.NameSpaceType + :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:`ErrorResponseException` + """ + parameters = models.SBNamespaceMigrate(target_namespace_type=target_namespace_type) + + # Construct URL + url = self.migrate.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + '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, 'SBNamespaceMigrate') + + # 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]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + migrate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrate'} + def list_ip_filter_rules( self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): """Gets a list of IP Filter rules for a Namespace.