Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -93,6 +95,7 @@
from .service_bus_management_client_enums import (
SkuName,
SkuTier,
NameSpaceType,
AccessRights,
KeyType,
EntityStatus,
Expand All @@ -111,6 +114,7 @@
'SBSku',
'SBNamespace',
'SBNamespaceUpdateParameters',
'SBNamespaceMigrate',
'SBAuthorizationRule',
'AuthorizationRuleProperties',
'AccessKeys',
Expand Down Expand Up @@ -153,6 +157,7 @@
'EventhubPaged',
'SkuName',
'SkuTier',
'NameSpaceType',
'AccessRights',
'KeyType',
'EntityStatus',
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<msrest:optionsforoperations>`.
:return: None or ClientRawResponse if raw=true
:rtype: None or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.servicebus.models.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.
Expand Down