diff --git a/azure-mgmt-servicebus/MANIFEST.in b/azure-mgmt-servicebus/MANIFEST.in index bb37a2723dae..6ceb27f7a96e 100644 --- a/azure-mgmt-servicebus/MANIFEST.in +++ b/azure-mgmt-servicebus/MANIFEST.in @@ -1 +1,4 @@ include *.rst +include azure/__init__.py +include azure/mgmt/__init__.py + diff --git a/azure-mgmt-servicebus/azure/mgmt/servicebus/models/__init__.py b/azure-mgmt-servicebus/azure/mgmt/servicebus/models/__init__.py index 28d9624d67c0..5d211fbf8244 100644 --- a/azure-mgmt-servicebus/azure/mgmt/servicebus/models/__init__.py +++ b/azure-mgmt-servicebus/azure/mgmt/servicebus/models/__init__.py @@ -41,6 +41,8 @@ from .eventhub_py3 import Eventhub from .arm_disaster_recovery_py3 import ArmDisasterRecovery from .migration_config_properties_py3 import MigrationConfigProperties + from .ip_filter_rule_py3 import IpFilterRule + from .virtual_network_rule_py3 import VirtualNetworkRule except (SyntaxError, ImportError): from .tracked_resource import TrackedResource from .resource import Resource @@ -73,9 +75,13 @@ from .eventhub import Eventhub from .arm_disaster_recovery import ArmDisasterRecovery from .migration_config_properties import MigrationConfigProperties + from .ip_filter_rule import IpFilterRule + from .virtual_network_rule import VirtualNetworkRule from .operation_paged import OperationPaged from .sb_namespace_paged import SBNamespacePaged from .sb_authorization_rule_paged import SBAuthorizationRulePaged +from .ip_filter_rule_paged import IpFilterRulePaged +from .virtual_network_rule_paged import VirtualNetworkRulePaged from .arm_disaster_recovery_paged import ArmDisasterRecoveryPaged from .migration_config_properties_paged import MigrationConfigPropertiesPaged from .sb_queue_paged import SBQueuePaged @@ -95,6 +101,7 @@ EncodingCaptureDescription, ProvisioningStateDR, RoleDisasterRecovery, + IPAction, ) __all__ = [ @@ -129,9 +136,13 @@ 'Eventhub', 'ArmDisasterRecovery', 'MigrationConfigProperties', + 'IpFilterRule', + 'VirtualNetworkRule', 'OperationPaged', 'SBNamespacePaged', 'SBAuthorizationRulePaged', + 'IpFilterRulePaged', + 'VirtualNetworkRulePaged', 'ArmDisasterRecoveryPaged', 'MigrationConfigPropertiesPaged', 'SBQueuePaged', @@ -150,4 +161,5 @@ 'EncodingCaptureDescription', 'ProvisioningStateDR', 'RoleDisasterRecovery', + 'IPAction', ] diff --git a/azure-mgmt-servicebus/azure/mgmt/servicebus/models/ip_filter_rule.py b/azure-mgmt-servicebus/azure/mgmt/servicebus/models/ip_filter_rule.py new file mode 100644 index 000000000000..927652d86d36 --- /dev/null +++ b/azure-mgmt-servicebus/azure/mgmt/servicebus/models/ip_filter_rule.py @@ -0,0 +1,55 @@ +# 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 IpFilterRule(Resource): + """Single item in a List or Get IpFilterRules 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 ip_mask: IP Mask + :type ip_mask: str + :param action: The IP Filter Action. Possible values include: 'Accept', + 'Reject' + :type action: str or ~azure.mgmt.servicebus.models.IPAction + :param filter_name: IP Filter name + :type filter_name: 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'}, + 'ip_mask': {'key': 'properties.ipMask', 'type': 'str'}, + 'action': {'key': 'properties.action', 'type': 'str'}, + 'filter_name': {'key': 'properties.filterName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(IpFilterRule, self).__init__(**kwargs) + self.ip_mask = kwargs.get('ip_mask', None) + self.action = kwargs.get('action', None) + self.filter_name = kwargs.get('filter_name', None) diff --git a/azure-mgmt-servicebus/azure/mgmt/servicebus/models/ip_filter_rule_paged.py b/azure-mgmt-servicebus/azure/mgmt/servicebus/models/ip_filter_rule_paged.py new file mode 100644 index 000000000000..44c2148fff71 --- /dev/null +++ b/azure-mgmt-servicebus/azure/mgmt/servicebus/models/ip_filter_rule_paged.py @@ -0,0 +1,27 @@ +# 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 IpFilterRulePaged(Paged): + """ + A paging container for iterating over a list of :class:`IpFilterRule ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[IpFilterRule]'} + } + + def __init__(self, *args, **kwargs): + + super(IpFilterRulePaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-servicebus/azure/mgmt/servicebus/models/ip_filter_rule_py3.py b/azure-mgmt-servicebus/azure/mgmt/servicebus/models/ip_filter_rule_py3.py new file mode 100644 index 000000000000..2b74fc97b46c --- /dev/null +++ b/azure-mgmt-servicebus/azure/mgmt/servicebus/models/ip_filter_rule_py3.py @@ -0,0 +1,55 @@ +# 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 IpFilterRule(Resource): + """Single item in a List or Get IpFilterRules 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 ip_mask: IP Mask + :type ip_mask: str + :param action: The IP Filter Action. Possible values include: 'Accept', + 'Reject' + :type action: str or ~azure.mgmt.servicebus.models.IPAction + :param filter_name: IP Filter name + :type filter_name: 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'}, + 'ip_mask': {'key': 'properties.ipMask', 'type': 'str'}, + 'action': {'key': 'properties.action', 'type': 'str'}, + 'filter_name': {'key': 'properties.filterName', 'type': 'str'}, + } + + def __init__(self, *, ip_mask: str=None, action=None, filter_name: str=None, **kwargs) -> None: + super(IpFilterRule, self).__init__(**kwargs) + self.ip_mask = ip_mask + self.action = action + self.filter_name = filter_name 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 a313fa144d3b..53552468acd9 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 @@ -86,3 +86,9 @@ class RoleDisasterRecovery(str, Enum): primary = "Primary" primary_not_replicating = "PrimaryNotReplicating" secondary = "Secondary" + + +class IPAction(str, Enum): + + accept = "Accept" + reject = "Reject" diff --git a/azure-mgmt-servicebus/azure/mgmt/servicebus/models/virtual_network_rule.py b/azure-mgmt-servicebus/azure/mgmt/servicebus/models/virtual_network_rule.py new file mode 100644 index 000000000000..68c1a893cf4c --- /dev/null +++ b/azure-mgmt-servicebus/azure/mgmt/servicebus/models/virtual_network_rule.py @@ -0,0 +1,46 @@ +# 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 VirtualNetworkRule(Resource): + """Single item in a List or Get VirtualNetworkRules 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 virtual_network_subnet_id: Resource ID of Virtual Network Subnet + :type virtual_network_subnet_id: 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'}, + 'virtual_network_subnet_id': {'key': 'properties.virtualNetworkSubnetId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(VirtualNetworkRule, self).__init__(**kwargs) + self.virtual_network_subnet_id = kwargs.get('virtual_network_subnet_id', None) diff --git a/azure-mgmt-servicebus/azure/mgmt/servicebus/models/virtual_network_rule_paged.py b/azure-mgmt-servicebus/azure/mgmt/servicebus/models/virtual_network_rule_paged.py new file mode 100644 index 000000000000..7808ab7872f9 --- /dev/null +++ b/azure-mgmt-servicebus/azure/mgmt/servicebus/models/virtual_network_rule_paged.py @@ -0,0 +1,27 @@ +# 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 VirtualNetworkRulePaged(Paged): + """ + A paging container for iterating over a list of :class:`VirtualNetworkRule ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[VirtualNetworkRule]'} + } + + def __init__(self, *args, **kwargs): + + super(VirtualNetworkRulePaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-servicebus/azure/mgmt/servicebus/models/virtual_network_rule_py3.py b/azure-mgmt-servicebus/azure/mgmt/servicebus/models/virtual_network_rule_py3.py new file mode 100644 index 000000000000..7fd2e204ca98 --- /dev/null +++ b/azure-mgmt-servicebus/azure/mgmt/servicebus/models/virtual_network_rule_py3.py @@ -0,0 +1,46 @@ +# 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 VirtualNetworkRule(Resource): + """Single item in a List or Get VirtualNetworkRules 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 virtual_network_subnet_id: Resource ID of Virtual Network Subnet + :type virtual_network_subnet_id: 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'}, + 'virtual_network_subnet_id': {'key': 'properties.virtualNetworkSubnetId', 'type': 'str'}, + } + + def __init__(self, *, virtual_network_subnet_id: str=None, **kwargs) -> None: + super(VirtualNetworkRule, self).__init__(**kwargs) + self.virtual_network_subnet_id = virtual_network_subnet_id 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 24c24da1dfa5..7768f6856311 100644 --- a/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/namespaces_operations.py +++ b/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/namespaces_operations.py @@ -958,3 +958,530 @@ def regenerate_keys( return deserialized regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'} + + 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. + + :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 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 IpFilterRule + :rtype: + ~azure.mgmt.servicebus.models.IpFilterRulePaged[~azure.mgmt.servicebus.models.IpFilterRule] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_ip_filter_rules.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') + + 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) + 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 + deserialized = models.IpFilterRulePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.IpFilterRulePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_ip_filter_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules'} + + def create_or_update_ip_filter_rule( + self, resource_group_name, namespace_name, ip_filter_rule_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an IpFilterRule for a Namespace. + + :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 ip_filter_rule_name: The IP Filter Rule name. + :type ip_filter_rule_name: str + :param parameters: The Namespace IpFilterRule. + :type parameters: ~azure.mgmt.servicebus.models.IpFilterRule + :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: IpFilterRule or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.servicebus.models.IpFilterRule or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update_ip_filter_rule.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), + 'ipFilterRuleName': self._serialize.url("ip_filter_rule_name", ip_filter_rule_name, 'str', min_length=1), + '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, 'IpFilterRule') + + # 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]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('IpFilterRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update_ip_filter_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}'} + + def delete_ip_filter_rule( + self, resource_group_name, namespace_name, ip_filter_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes an IpFilterRule for a Namespace. + + :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 ip_filter_rule_name: The IP Filter Rule name. + :type ip_filter_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:`ErrorResponseException` + """ + # Construct URL + url = self.delete_ip_filter_rule.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), + 'ipFilterRuleName': self._serialize.url("ip_filter_rule_name", ip_filter_rule_name, 'str', min_length=1), + '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]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete_ip_filter_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}'} + + def get_ip_filter_rule( + self, resource_group_name, namespace_name, ip_filter_rule_name, custom_headers=None, raw=False, **operation_config): + """Gets an IpFilterRule for a Namespace by rule name. + + :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 ip_filter_rule_name: The IP Filter Rule name. + :type ip_filter_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: IpFilterRule or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.servicebus.models.IpFilterRule or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_ip_filter_rule.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), + 'ipFilterRuleName': self._serialize.url("ip_filter_rule_name", ip_filter_rule_name, 'str', min_length=1), + '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]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('IpFilterRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_ip_filter_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}'} + + def list_virtual_network_rules( + self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): + """Gets a list of VirtualNetwork rules for a Namespace. + + :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 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 VirtualNetworkRule + :rtype: + ~azure.mgmt.servicebus.models.VirtualNetworkRulePaged[~azure.mgmt.servicebus.models.VirtualNetworkRule] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_virtual_network_rules.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') + + 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) + 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 + deserialized = models.VirtualNetworkRulePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.VirtualNetworkRulePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_virtual_network_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules'} + + def create_or_update_virtual_network_rule( + self, resource_group_name, namespace_name, virtual_network_rule_name, virtual_network_subnet_id=None, custom_headers=None, raw=False, **operation_config): + """Creates or updates an VirtualNetworkRule for a Namespace. + + :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 virtual_network_rule_name: The Virtual Network Rule name. + :type virtual_network_rule_name: str + :param virtual_network_subnet_id: Resource ID of Virtual Network + Subnet + :type virtual_network_subnet_id: 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: VirtualNetworkRule or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.servicebus.models.VirtualNetworkRule or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.VirtualNetworkRule(virtual_network_subnet_id=virtual_network_subnet_id) + + # Construct URL + url = self.create_or_update_virtual_network_rule.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), + 'virtualNetworkRuleName': self._serialize.url("virtual_network_rule_name", virtual_network_rule_name, 'str', min_length=1), + '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, 'VirtualNetworkRule') + + # 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]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update_virtual_network_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}'} + + def delete_virtual_network_rule( + self, resource_group_name, namespace_name, virtual_network_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes an VirtualNetworkRule for a Namespace. + + :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 virtual_network_rule_name: The Virtual Network Rule name. + :type virtual_network_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:`ErrorResponseException` + """ + # Construct URL + url = self.delete_virtual_network_rule.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), + 'virtualNetworkRuleName': self._serialize.url("virtual_network_rule_name", virtual_network_rule_name, 'str', min_length=1), + '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]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete_virtual_network_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}'} + + def get_virtual_network_rule( + self, resource_group_name, namespace_name, virtual_network_rule_name, custom_headers=None, raw=False, **operation_config): + """Gets an VirtualNetworkRule for a Namespace by rule name. + + :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 virtual_network_rule_name: The Virtual Network Rule name. + :type virtual_network_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: VirtualNetworkRule or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.servicebus.models.VirtualNetworkRule or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_virtual_network_rule.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), + 'virtualNetworkRuleName': self._serialize.url("virtual_network_rule_name", virtual_network_rule_name, 'str', min_length=1), + '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]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_virtual_network_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}'} diff --git a/azure-mgmt-servicebus/azure/mgmt/servicebus/version.py b/azure-mgmt-servicebus/azure/mgmt/servicebus/version.py index 3c93989b8fef..266f5a486d79 100644 --- a/azure-mgmt-servicebus/azure/mgmt/servicebus/version.py +++ b/azure-mgmt-servicebus/azure/mgmt/servicebus/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.5.2" +VERSION = "0.5.0"