diff --git a/sdk/servicebus/azure-mgmt-servicebus/MANIFEST.in b/sdk/servicebus/azure-mgmt-servicebus/MANIFEST.in index a3cb07df87658..3a9b6517412bc 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/MANIFEST.in +++ b/sdk/servicebus/azure-mgmt-servicebus/MANIFEST.in @@ -1,3 +1,4 @@ +include _meta.json recursive-include tests *.py *.yaml include *.md include azure/__init__.py diff --git a/sdk/servicebus/azure-mgmt-servicebus/_meta.json b/sdk/servicebus/azure-mgmt-servicebus/_meta.json new file mode 100644 index 0000000000000..c737c7993feaf --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.2", + "use": [ + "@autorest/python@5.8.1", + "@autorest/modelerfour@4.19.2" + ], + "commit": "e7d35b23b005016276b4f0bc05d092d4d9dec7dd", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/servicebus/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.1 --use=@autorest/modelerfour@4.19.2 --version=3.4.2", + "readme": "specification/servicebus/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/__init__.py index e6ef471ff03a7..f640dac181bb7 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/__init__.py @@ -7,9 +7,6 @@ # -------------------------------------------------------------------------- from ._service_bus_management_client import ServiceBusManagementClient -from ._version import VERSION - -__version__ = VERSION __all__ = ['ServiceBusManagementClient'] try: diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_configuration.py index 5f855135c3d33..9531d7678c129 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_configuration.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_configuration.py @@ -1,11 +1,13 @@ # 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. +# 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. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. # -------------------------------------------------------------------------- - from typing import TYPE_CHECKING from azure.core.configuration import Configuration @@ -20,7 +22,6 @@ from azure.core.credentials import TokenCredential - class ServiceBusManagementClientConfiguration(Configuration): """Configuration for ServiceBusManagementClient. @@ -49,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'azure-mgmt-servicebus/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_service_bus_management_client.py index 08a628c95a434..1073ca4084432 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_service_bus_management_client.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_service_bus_management_client.py @@ -1,130 +1,366 @@ # 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. +# 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. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. # -------------------------------------------------------------------------- from typing import TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient +from azure.profiles import KnownProfiles, ProfileDefinition +from azure.profiles.multiapiclient import MultiApiClientMixin from msrest import Deserializer, Serializer +from ._configuration import ServiceBusManagementClientConfiguration + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +class _SDKClient(object): + def __init__(self, *args, **kwargs): + """This is a fake class to support current implemetation of MultiApiClientMixin." + Will be removed in final version of multiapi azure-core based client + """ + pass + +class ServiceBusManagementClient(MultiApiClientMixin, _SDKClient): + """Azure Service Bus client. + + This ready contains multiple API versions, to help you deal with all of the Azure clouds + (Azure Stack, Azure Government, Azure China, etc.). + By default, it uses the latest API version available on public Azure. + For production, you should stick to a particular api-version and/or profile. + The profile sets a mapping between an operation group and its API version. + The api-version parameter sets the default API version if the operation + group is not described in the profile. -from ._configuration import ServiceBusManagementClientConfiguration -from .operations import NamespacesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import Operations -from .operations import DisasterRecoveryConfigsOperations -from .operations import QueuesOperations -from .operations import TopicsOperations -from .operations import EventHubsOperations -from .operations import MigrationConfigsOperations -from .operations import PremiumMessagingRegionsOperations -from .operations import RegionsOperations -from .operations import SubscriptionsOperations -from .operations import RulesOperations -from . import models - - -class ServiceBusManagementClient(object): - """Azure Service Bus client for managing Namespace, IPFilter Rules, VirtualNetworkRules and Zone Redundant. - - :ivar namespaces: NamespacesOperations operations - :vartype namespaces: azure.mgmt.servicebus.operations.NamespacesOperations - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.servicebus.operations.PrivateEndpointConnectionsOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.servicebus.operations.PrivateLinkResourcesOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.servicebus.operations.Operations - :ivar disaster_recovery_configs: DisasterRecoveryConfigsOperations operations - :vartype disaster_recovery_configs: azure.mgmt.servicebus.operations.DisasterRecoveryConfigsOperations - :ivar queues: QueuesOperations operations - :vartype queues: azure.mgmt.servicebus.operations.QueuesOperations - :ivar topics: TopicsOperations operations - :vartype topics: azure.mgmt.servicebus.operations.TopicsOperations - :ivar event_hubs: EventHubsOperations operations - :vartype event_hubs: azure.mgmt.servicebus.operations.EventHubsOperations - :ivar migration_configs: MigrationConfigsOperations operations - :vartype migration_configs: azure.mgmt.servicebus.operations.MigrationConfigsOperations - :ivar premium_messaging_regions: PremiumMessagingRegionsOperations operations - :vartype premium_messaging_regions: azure.mgmt.servicebus.operations.PremiumMessagingRegionsOperations - :ivar regions: RegionsOperations operations - :vartype regions: azure.mgmt.servicebus.operations.RegionsOperations - :ivar subscriptions: SubscriptionsOperations operations - :vartype subscriptions: azure.mgmt.servicebus.operations.SubscriptionsOperations - :ivar rules: RulesOperations operations - :vartype rules: azure.mgmt.servicebus.operations.RulesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL + :param api_version: API version to use if no profile is provided, or if missing in profile. + :type api_version: str + :param base_url: Service URL + :type base_url: str + :param profile: A profile definition, from KnownProfiles to dict. + :type profile: azure.profiles.KnownProfiles :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ + DEFAULT_API_VERSION = '2017-04-01' + _PROFILE_TAG = "azure.mgmt.servicebus.ServiceBusManagementClient" + LATEST_PROFILE = ProfileDefinition({ + _PROFILE_TAG: { + None: DEFAULT_API_VERSION, + }}, + _PROFILE_TAG + " latest" + ) + def __init__( self, credential, # type: "TokenCredential" subscription_id, # type: str + api_version=None, # type: Optional[str] base_url=None, # type: Optional[str] + profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): - # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' self._config = ServiceBusManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + super(ServiceBusManagementClient, self).__init__( + api_version=api_version, + profile=profile + ) + + @classmethod + def _models_dict(cls, api_version): + return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} + + @classmethod + def models(cls, api_version=DEFAULT_API_VERSION): + """Module depends on the API version: + + * 2015-08-01: :mod:`v2015_08_01.models` + * 2017-04-01: :mod:`v2017_04_01.models` + * 2018-01-01-preview: :mod:`v2018_01_01_preview.models` + * 2021-01-01-preview: :mod:`v2021_01_01_preview.models` + """ + if api_version == '2015-08-01': + from .v2015_08_01 import models + return models + elif api_version == '2017-04-01': + from .v2017_04_01 import models + return models + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview import models + return models + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview import models + return models + raise ValueError("API version {} is not available".format(api_version)) + + @property + def disaster_recovery_configs(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`DisasterRecoveryConfigsOperations` + * 2018-01-01-preview: :class:`DisasterRecoveryConfigsOperations` + * 2021-01-01-preview: :class:`DisasterRecoveryConfigsOperations` + """ + api_version = self._get_api_version('disaster_recovery_configs') + if api_version == '2017-04-01': + from .v2017_04_01.operations import DisasterRecoveryConfigsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import DisasterRecoveryConfigsOperations as OperationClass + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import DisasterRecoveryConfigsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'disaster_recovery_configs'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def event_hubs(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`EventHubsOperations` + * 2018-01-01-preview: :class:`EventHubsOperations` + """ + api_version = self._get_api_version('event_hubs') + if api_version == '2017-04-01': + from .v2017_04_01.operations import EventHubsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import EventHubsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'event_hubs'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def migration_configs(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`MigrationConfigsOperations` + * 2018-01-01-preview: :class:`MigrationConfigsOperations` + * 2021-01-01-preview: :class:`MigrationConfigsOperations` + """ + api_version = self._get_api_version('migration_configs') + if api_version == '2017-04-01': + from .v2017_04_01.operations import MigrationConfigsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import MigrationConfigsOperations as OperationClass + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import MigrationConfigsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'migration_configs'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def namespaces(self): + """Instance depends on the API version: + + * 2015-08-01: :class:`NamespacesOperations` + * 2017-04-01: :class:`NamespacesOperations` + * 2018-01-01-preview: :class:`NamespacesOperations` + * 2021-01-01-preview: :class:`NamespacesOperations` + """ + api_version = self._get_api_version('namespaces') + if api_version == '2015-08-01': + from .v2015_08_01.operations import NamespacesOperations as OperationClass + elif api_version == '2017-04-01': + from .v2017_04_01.operations import NamespacesOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import NamespacesOperations as OperationClass + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import NamespacesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'namespaces'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def operations(self): + """Instance depends on the API version: - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False - self._deserialize = Deserializer(client_models) - - self.namespaces = NamespacesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queues = QueuesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.topics = TopicsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.event_hubs = EventHubsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.migration_configs = MigrationConfigsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.premium_messaging_regions = PremiumMessagingRegionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.regions = RegionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.subscriptions = SubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.rules = RulesOperations( - self._client, self._config, self._serialize, self._deserialize) + * 2015-08-01: :class:`Operations` + * 2017-04-01: :class:`Operations` + * 2018-01-01-preview: :class:`Operations` + * 2021-01-01-preview: :class:`Operations` + """ + api_version = self._get_api_version('operations') + if api_version == '2015-08-01': + from .v2015_08_01.operations import Operations as OperationClass + elif api_version == '2017-04-01': + from .v2017_04_01.operations import Operations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import Operations as OperationClass + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import Operations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def premium_messaging_regions(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`PremiumMessagingRegionsOperations` + * 2018-01-01-preview: :class:`PremiumMessagingRegionsOperations` + """ + api_version = self._get_api_version('premium_messaging_regions') + if api_version == '2017-04-01': + from .v2017_04_01.operations import PremiumMessagingRegionsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import PremiumMessagingRegionsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'premium_messaging_regions'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def private_endpoint_connections(self): + """Instance depends on the API version: + + * 2018-01-01-preview: :class:`PrivateEndpointConnectionsOperations` + * 2021-01-01-preview: :class:`PrivateEndpointConnectionsOperations` + """ + api_version = self._get_api_version('private_endpoint_connections') + if api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import PrivateEndpointConnectionsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def private_link_resources(self): + """Instance depends on the API version: + + * 2018-01-01-preview: :class:`PrivateLinkResourcesOperations` + * 2021-01-01-preview: :class:`PrivateLinkResourcesOperations` + """ + api_version = self._get_api_version('private_link_resources') + if api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import PrivateLinkResourcesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def queues(self): + """Instance depends on the API version: + + * 2015-08-01: :class:`QueuesOperations` + * 2017-04-01: :class:`QueuesOperations` + * 2018-01-01-preview: :class:`QueuesOperations` + * 2021-01-01-preview: :class:`QueuesOperations` + """ + api_version = self._get_api_version('queues') + if api_version == '2015-08-01': + from .v2015_08_01.operations import QueuesOperations as OperationClass + elif api_version == '2017-04-01': + from .v2017_04_01.operations import QueuesOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import QueuesOperations as OperationClass + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import QueuesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'queues'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def regions(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`RegionsOperations` + * 2018-01-01-preview: :class:`RegionsOperations` + """ + api_version = self._get_api_version('regions') + if api_version == '2017-04-01': + from .v2017_04_01.operations import RegionsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import RegionsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'regions'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def rules(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`RulesOperations` + * 2018-01-01-preview: :class:`RulesOperations` + * 2021-01-01-preview: :class:`RulesOperations` + """ + api_version = self._get_api_version('rules') + if api_version == '2017-04-01': + from .v2017_04_01.operations import RulesOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import RulesOperations as OperationClass + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import RulesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'rules'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def subscriptions(self): + """Instance depends on the API version: + + * 2015-08-01: :class:`SubscriptionsOperations` + * 2017-04-01: :class:`SubscriptionsOperations` + * 2018-01-01-preview: :class:`SubscriptionsOperations` + * 2021-01-01-preview: :class:`SubscriptionsOperations` + """ + api_version = self._get_api_version('subscriptions') + if api_version == '2015-08-01': + from .v2015_08_01.operations import SubscriptionsOperations as OperationClass + elif api_version == '2017-04-01': + from .v2017_04_01.operations import SubscriptionsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import SubscriptionsOperations as OperationClass + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import SubscriptionsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'subscriptions'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def topics(self): + """Instance depends on the API version: + + * 2015-08-01: :class:`TopicsOperations` + * 2017-04-01: :class:`TopicsOperations` + * 2018-01-01-preview: :class:`TopicsOperations` + * 2021-01-01-preview: :class:`TopicsOperations` + """ + api_version = self._get_api_version('topics') + if api_version == '2015-08-01': + from .v2015_08_01.operations import TopicsOperations as OperationClass + elif api_version == '2017-04-01': + from .v2017_04_01.operations import TopicsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import TopicsOperations as OperationClass + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import TopicsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'topics'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) def close(self): - # type: () -> None self._client.close() - def __enter__(self): - # type: () -> ServiceBusManagementClient self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None self._client.__exit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_configuration.py index 731dc0b33f61a..81b406d86751e 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_configuration.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_configuration.py @@ -1,11 +1,13 @@ # 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. +# 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. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. # -------------------------------------------------------------------------- - from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -18,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential - class ServiceBusManagementClientConfiguration(Configuration): """Configuration for ServiceBusManagementClient. @@ -35,7 +36,7 @@ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - **kwargs: Any + **kwargs # type: Any ) -> None: if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -46,7 +47,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'azure-mgmt-servicebus/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_service_bus_management_client.py index b4bb2493ea16e..e62c78ab6d31c 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_service_bus_management_client.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_service_bus_management_client.py @@ -1,124 +1,364 @@ # 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. +# 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. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. # -------------------------------------------------------------------------- from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient +from azure.profiles import KnownProfiles, ProfileDefinition +from azure.profiles.multiapiclient import MultiApiClientMixin from msrest import Deserializer, Serializer +from ._configuration import ServiceBusManagementClientConfiguration + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ServiceBusManagementClientConfiguration -from .operations import NamespacesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import Operations -from .operations import DisasterRecoveryConfigsOperations -from .operations import QueuesOperations -from .operations import TopicsOperations -from .operations import EventHubsOperations -from .operations import MigrationConfigsOperations -from .operations import PremiumMessagingRegionsOperations -from .operations import RegionsOperations -from .operations import SubscriptionsOperations -from .operations import RulesOperations -from .. import models - - -class ServiceBusManagementClient(object): - """Azure Service Bus client for managing Namespace, IPFilter Rules, VirtualNetworkRules and Zone Redundant. - - :ivar namespaces: NamespacesOperations operations - :vartype namespaces: azure.mgmt.servicebus.aio.operations.NamespacesOperations - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.servicebus.aio.operations.PrivateEndpointConnectionsOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.servicebus.aio.operations.PrivateLinkResourcesOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.servicebus.aio.operations.Operations - :ivar disaster_recovery_configs: DisasterRecoveryConfigsOperations operations - :vartype disaster_recovery_configs: azure.mgmt.servicebus.aio.operations.DisasterRecoveryConfigsOperations - :ivar queues: QueuesOperations operations - :vartype queues: azure.mgmt.servicebus.aio.operations.QueuesOperations - :ivar topics: TopicsOperations operations - :vartype topics: azure.mgmt.servicebus.aio.operations.TopicsOperations - :ivar event_hubs: EventHubsOperations operations - :vartype event_hubs: azure.mgmt.servicebus.aio.operations.EventHubsOperations - :ivar migration_configs: MigrationConfigsOperations operations - :vartype migration_configs: azure.mgmt.servicebus.aio.operations.MigrationConfigsOperations - :ivar premium_messaging_regions: PremiumMessagingRegionsOperations operations - :vartype premium_messaging_regions: azure.mgmt.servicebus.aio.operations.PremiumMessagingRegionsOperations - :ivar regions: RegionsOperations operations - :vartype regions: azure.mgmt.servicebus.aio.operations.RegionsOperations - :ivar subscriptions: SubscriptionsOperations operations - :vartype subscriptions: azure.mgmt.servicebus.aio.operations.SubscriptionsOperations - :ivar rules: RulesOperations operations - :vartype rules: azure.mgmt.servicebus.aio.operations.RulesOperations +class _SDKClient(object): + def __init__(self, *args, **kwargs): + """This is a fake class to support current implemetation of MultiApiClientMixin." + Will be removed in final version of multiapi azure-core based client + """ + pass + +class ServiceBusManagementClient(MultiApiClientMixin, _SDKClient): + """Azure Service Bus client. + + This ready contains multiple API versions, to help you deal with all of the Azure clouds + (Azure Stack, Azure Government, Azure China, etc.). + By default, it uses the latest API version available on public Azure. + For production, you should stick to a particular api-version and/or profile. + The profile sets a mapping between an operation group and its API version. + The api-version parameter sets the default API version if the operation + group is not described in the profile. + :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL + :param api_version: API version to use if no profile is provided, or if missing in profile. + :type api_version: str + :param base_url: Service URL + :type base_url: str + :param profile: A profile definition, from KnownProfiles to dict. + :type profile: azure.profiles.KnownProfiles :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ + DEFAULT_API_VERSION = '2017-04-01' + _PROFILE_TAG = "azure.mgmt.servicebus.ServiceBusManagementClient" + LATEST_PROFILE = ProfileDefinition({ + _PROFILE_TAG: { + None: DEFAULT_API_VERSION, + }}, + _PROFILE_TAG + " latest" + ) + def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, + api_version: Optional[str] = None, base_url: Optional[str] = None, - **kwargs: Any + profile: KnownProfiles = KnownProfiles.default, + **kwargs # type: Any ) -> None: if not base_url: base_url = 'https://management.azure.com' self._config = ServiceBusManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + super(ServiceBusManagementClient, self).__init__( + api_version=api_version, + profile=profile + ) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False - self._deserialize = Deserializer(client_models) - - self.namespaces = NamespacesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queues = QueuesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.topics = TopicsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.event_hubs = EventHubsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.migration_configs = MigrationConfigsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.premium_messaging_regions = PremiumMessagingRegionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.regions = RegionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.subscriptions = SubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.rules = RulesOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def close(self) -> None: - await self._client.close() + @classmethod + def _models_dict(cls, api_version): + return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} + + @classmethod + def models(cls, api_version=DEFAULT_API_VERSION): + """Module depends on the API version: + + * 2015-08-01: :mod:`v2015_08_01.models` + * 2017-04-01: :mod:`v2017_04_01.models` + * 2018-01-01-preview: :mod:`v2018_01_01_preview.models` + * 2021-01-01-preview: :mod:`v2021_01_01_preview.models` + """ + if api_version == '2015-08-01': + from ..v2015_08_01 import models + return models + elif api_version == '2017-04-01': + from ..v2017_04_01 import models + return models + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview import models + return models + elif api_version == '2021-01-01-preview': + from ..v2021_01_01_preview import models + return models + raise ValueError("API version {} is not available".format(api_version)) + + @property + def disaster_recovery_configs(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`DisasterRecoveryConfigsOperations` + * 2018-01-01-preview: :class:`DisasterRecoveryConfigsOperations` + * 2021-01-01-preview: :class:`DisasterRecoveryConfigsOperations` + """ + api_version = self._get_api_version('disaster_recovery_configs') + if api_version == '2017-04-01': + from ..v2017_04_01.aio.operations import DisasterRecoveryConfigsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import DisasterRecoveryConfigsOperations as OperationClass + elif api_version == '2021-01-01-preview': + from ..v2021_01_01_preview.aio.operations import DisasterRecoveryConfigsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'disaster_recovery_configs'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def event_hubs(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`EventHubsOperations` + * 2018-01-01-preview: :class:`EventHubsOperations` + """ + api_version = self._get_api_version('event_hubs') + if api_version == '2017-04-01': + from ..v2017_04_01.aio.operations import EventHubsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import EventHubsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'event_hubs'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def migration_configs(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`MigrationConfigsOperations` + * 2018-01-01-preview: :class:`MigrationConfigsOperations` + * 2021-01-01-preview: :class:`MigrationConfigsOperations` + """ + api_version = self._get_api_version('migration_configs') + if api_version == '2017-04-01': + from ..v2017_04_01.aio.operations import MigrationConfigsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import MigrationConfigsOperations as OperationClass + elif api_version == '2021-01-01-preview': + from ..v2021_01_01_preview.aio.operations import MigrationConfigsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'migration_configs'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def namespaces(self): + """Instance depends on the API version: + + * 2015-08-01: :class:`NamespacesOperations` + * 2017-04-01: :class:`NamespacesOperations` + * 2018-01-01-preview: :class:`NamespacesOperations` + * 2021-01-01-preview: :class:`NamespacesOperations` + """ + api_version = self._get_api_version('namespaces') + if api_version == '2015-08-01': + from ..v2015_08_01.aio.operations import NamespacesOperations as OperationClass + elif api_version == '2017-04-01': + from ..v2017_04_01.aio.operations import NamespacesOperations as OperationClass + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import NamespacesOperations as OperationClass + elif api_version == '2021-01-01-preview': + from ..v2021_01_01_preview.aio.operations import NamespacesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'namespaces'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def operations(self): + """Instance depends on the API version: - async def __aenter__(self) -> "ServiceBusManagementClient": + * 2015-08-01: :class:`Operations` + * 2017-04-01: :class:`Operations` + * 2018-01-01-preview: :class:`Operations` + * 2021-01-01-preview: :class:`Operations` + """ + api_version = self._get_api_version('operations') + if api_version == '2015-08-01': + from ..v2015_08_01.aio.operations import Operations as OperationClass + elif api_version == '2017-04-01': + from ..v2017_04_01.aio.operations import Operations as OperationClass + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import Operations as OperationClass + elif api_version == '2021-01-01-preview': + from ..v2021_01_01_preview.aio.operations import Operations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def premium_messaging_regions(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`PremiumMessagingRegionsOperations` + * 2018-01-01-preview: :class:`PremiumMessagingRegionsOperations` + """ + api_version = self._get_api_version('premium_messaging_regions') + if api_version == '2017-04-01': + from ..v2017_04_01.aio.operations import PremiumMessagingRegionsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import PremiumMessagingRegionsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'premium_messaging_regions'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def private_endpoint_connections(self): + """Instance depends on the API version: + + * 2018-01-01-preview: :class:`PrivateEndpointConnectionsOperations` + * 2021-01-01-preview: :class:`PrivateEndpointConnectionsOperations` + """ + api_version = self._get_api_version('private_endpoint_connections') + if api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2021-01-01-preview': + from ..v2021_01_01_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def private_link_resources(self): + """Instance depends on the API version: + + * 2018-01-01-preview: :class:`PrivateLinkResourcesOperations` + * 2021-01-01-preview: :class:`PrivateLinkResourcesOperations` + """ + api_version = self._get_api_version('private_link_resources') + if api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2021-01-01-preview': + from ..v2021_01_01_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def queues(self): + """Instance depends on the API version: + + * 2015-08-01: :class:`QueuesOperations` + * 2017-04-01: :class:`QueuesOperations` + * 2018-01-01-preview: :class:`QueuesOperations` + * 2021-01-01-preview: :class:`QueuesOperations` + """ + api_version = self._get_api_version('queues') + if api_version == '2015-08-01': + from ..v2015_08_01.aio.operations import QueuesOperations as OperationClass + elif api_version == '2017-04-01': + from ..v2017_04_01.aio.operations import QueuesOperations as OperationClass + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import QueuesOperations as OperationClass + elif api_version == '2021-01-01-preview': + from ..v2021_01_01_preview.aio.operations import QueuesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'queues'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def regions(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`RegionsOperations` + * 2018-01-01-preview: :class:`RegionsOperations` + """ + api_version = self._get_api_version('regions') + if api_version == '2017-04-01': + from ..v2017_04_01.aio.operations import RegionsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import RegionsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'regions'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def rules(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`RulesOperations` + * 2018-01-01-preview: :class:`RulesOperations` + * 2021-01-01-preview: :class:`RulesOperations` + """ + api_version = self._get_api_version('rules') + if api_version == '2017-04-01': + from ..v2017_04_01.aio.operations import RulesOperations as OperationClass + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import RulesOperations as OperationClass + elif api_version == '2021-01-01-preview': + from ..v2021_01_01_preview.aio.operations import RulesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'rules'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def subscriptions(self): + """Instance depends on the API version: + + * 2015-08-01: :class:`SubscriptionsOperations` + * 2017-04-01: :class:`SubscriptionsOperations` + * 2018-01-01-preview: :class:`SubscriptionsOperations` + * 2021-01-01-preview: :class:`SubscriptionsOperations` + """ + api_version = self._get_api_version('subscriptions') + if api_version == '2015-08-01': + from ..v2015_08_01.aio.operations import SubscriptionsOperations as OperationClass + elif api_version == '2017-04-01': + from ..v2017_04_01.aio.operations import SubscriptionsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import SubscriptionsOperations as OperationClass + elif api_version == '2021-01-01-preview': + from ..v2021_01_01_preview.aio.operations import SubscriptionsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'subscriptions'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def topics(self): + """Instance depends on the API version: + + * 2015-08-01: :class:`TopicsOperations` + * 2017-04-01: :class:`TopicsOperations` + * 2018-01-01-preview: :class:`TopicsOperations` + * 2021-01-01-preview: :class:`TopicsOperations` + """ + api_version = self._get_api_version('topics') + if api_version == '2015-08-01': + from ..v2015_08_01.aio.operations import TopicsOperations as OperationClass + elif api_version == '2017-04-01': + from ..v2017_04_01.aio.operations import TopicsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import TopicsOperations as OperationClass + elif api_version == '2021-01-01-preview': + from ..v2021_01_01_preview.aio.operations import TopicsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'topics'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + async def close(self): + await self._client.close() + async def __aenter__(self): await self._client.__aenter__() return self - - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details): await self._client.__aexit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models.py new file mode 100644 index 0000000000000..5572430ae05d6 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models.py @@ -0,0 +1,7 @@ +# 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. +# -------------------------------------------------------------------------- +from .v2017_04_01.models import * diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/__init__.py new file mode 100644 index 0000000000000..f640dac181bb7 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/__init__.py @@ -0,0 +1,16 @@ +# 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 ._service_bus_management_client import ServiceBusManagementClient +__all__ = ['ServiceBusManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_configuration.py new file mode 100644 index 0000000000000..86251b30a6cd5 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_configuration.py @@ -0,0 +1,70 @@ +# 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 typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class ServiceBusManagementClientConfiguration(Configuration): + """Configuration for ServiceBusManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2015-08-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_metadata.json b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_metadata.json new file mode 100644 index 0000000000000..f0e50cee8bd2f --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_metadata.json @@ -0,0 +1,107 @@ +{ + "chosen_version": "2015-08-01", + "total_api_version_list": ["2015-08-01"], + "client": { + "name": "ServiceBusManagementClient", + "filename": "_service_bus_management_client", + "description": "Azure Service Bus client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "namespaces": "NamespacesOperations", + "queues": "QueuesOperations", + "topics": "TopicsOperations", + "subscriptions": "SubscriptionsOperations" + } +} \ No newline at end of file diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_service_bus_management_client.py new file mode 100644 index 0000000000000..8e48132a11738 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_service_bus_management_client.py @@ -0,0 +1,109 @@ +# 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 typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import ServiceBusManagementClientConfiguration +from .operations import Operations +from .operations import NamespacesOperations +from .operations import QueuesOperations +from .operations import TopicsOperations +from .operations import SubscriptionsOperations +from . import models + + +class ServiceBusManagementClient(object): + """Azure Service Bus client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.servicebus.v2015_08_01.operations.Operations + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: azure.mgmt.servicebus.v2015_08_01.operations.NamespacesOperations + :ivar queues: QueuesOperations operations + :vartype queues: azure.mgmt.servicebus.v2015_08_01.operations.QueuesOperations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.servicebus.v2015_08_01.operations.TopicsOperations + :ivar subscriptions: SubscriptionsOperations operations + :vartype subscriptions: azure.mgmt.servicebus.v2015_08_01.operations.SubscriptionsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = ServiceBusManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.namespaces = NamespacesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.queues = QueuesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ServiceBusManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/__init__.py new file mode 100644 index 0000000000000..9016cbc217954 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/__init__.py @@ -0,0 +1,10 @@ +# 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 ._service_bus_management_client import ServiceBusManagementClient +__all__ = ['ServiceBusManagementClient'] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_configuration.py new file mode 100644 index 0000000000000..110ae4142b88f --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class ServiceBusManagementClientConfiguration(Configuration): + """Configuration for ServiceBusManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2015-08-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_service_bus_management_client.py new file mode 100644 index 0000000000000..b2bce21706fce --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_service_bus_management_client.py @@ -0,0 +1,102 @@ +# 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 typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import ServiceBusManagementClientConfiguration +from .operations import Operations +from .operations import NamespacesOperations +from .operations import QueuesOperations +from .operations import TopicsOperations +from .operations import SubscriptionsOperations +from .. import models + + +class ServiceBusManagementClient(object): + """Azure Service Bus client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.servicebus.v2015_08_01.aio.operations.Operations + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: azure.mgmt.servicebus.v2015_08_01.aio.operations.NamespacesOperations + :ivar queues: QueuesOperations operations + :vartype queues: azure.mgmt.servicebus.v2015_08_01.aio.operations.QueuesOperations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.servicebus.v2015_08_01.aio.operations.TopicsOperations + :ivar subscriptions: SubscriptionsOperations operations + :vartype subscriptions: azure.mgmt.servicebus.v2015_08_01.aio.operations.SubscriptionsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = ServiceBusManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.namespaces = NamespacesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.queues = QueuesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ServiceBusManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/__init__.py new file mode 100644 index 0000000000000..7acd03e6343c4 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/__init__.py @@ -0,0 +1,21 @@ +# 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 ._operations import Operations +from ._namespaces_operations import NamespacesOperations +from ._queues_operations import QueuesOperations +from ._topics_operations import TopicsOperations +from ._subscriptions_operations import SubscriptionsOperations + +__all__ = [ + 'Operations', + 'NamespacesOperations', + 'QueuesOperations', + 'TopicsOperations', + 'SubscriptionsOperations', +] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_namespaces_operations.py new file mode 100644 index 0000000000000..2b18ed327fa7c --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_namespaces_operations.py @@ -0,0 +1,1000 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NamespacesOperations: + """NamespacesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2015_08_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def check_name_availability( + self, + parameters: "_models.CheckNameAvailability", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability'} # type: ignore + + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.NamespaceListResult"]: + """Gets all the available namespaces within the subscription, irrespective of the resource groups. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NamespaceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.NamespaceListResult"]: + """Gets the available namespaces within a resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NamespaceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.NamespaceCreateOrUpdateParameters", + **kwargs: Any + ) -> Optional["_models.NamespaceResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.NamespaceResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + 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'), + '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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NamespaceCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.NamespaceCreateOrUpdateParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.NamespaceResource"]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + :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 parameters: Parameters supplied to create a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NamespaceResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NamespaceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing namespace. This operation also removes all associated resources under the + 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> "_models.NamespaceResource": + """Gets a description for the specified 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NamespaceResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NamespaceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.NamespaceUpdateParameters", + **kwargs: Any + ) -> Optional["_models.NamespaceResource"]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :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 parameters: Parameters supplied to update a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NamespaceResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.NamespaceResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NamespaceUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SharedAccessAuthorizationRuleListResult"]: + """Gets the authorization 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SharedAccessAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: "_models.SharedAccessAuthorizationRuleCreateOrUpdateParameters", + **kwargs: Any + ) -> "_models.SharedAccessAuthorizationRuleResource": + """Creates or updates an authorization rule 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a namespace authorization rule. + + :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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SharedAccessAuthorizationRuleResource": + """Gets an authorization rule 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.ResourceListKeys": + """Gets the primary and secondary connection strings for the 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateKeysParameters", + **kwargs: Any + ) -> "_models.ResourceListKeys": + """Regenerates the primary or secondary connection strings for the 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateKeysParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_operations.py new file mode 100644 index 0000000000000..41f1aa1219ffb --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_operations.py @@ -0,0 +1,104 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2015_08_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists all of the available ServiceBus REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.ServiceBus/operations'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_queues_operations.py new file mode 100644 index 0000000000000..21e4945daaa79 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_queues_operations.py @@ -0,0 +1,790 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class QueuesOperations: + """QueuesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2015_08_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_all( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.QueueListResult"]: + """Gets the queues within 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either QueueListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.QueueListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.QueueListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_all.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('QueueListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: "_models.QueueCreateOrUpdateParameters", + **kwargs: Any + ) -> "_models.QueueResource": + """Creates or updates a Service Bus queue. This operation is idempotent. + + :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 queue_name: The queue name. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.QueueCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QueueResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.QueueResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.QueueResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'QueueCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QueueResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> None: + """Deletes a queue from the specified namespace in a resource group. + + :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 queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> "_models.QueueResource": + """Returns a description for the specified queue. + + :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 queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QueueResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.QueueResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.QueueResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QueueResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SharedAccessAuthorizationRuleListResult"]: + """Gets all authorization rules for a queue. + + :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 queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SharedAccessAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: "_models.SharedAccessAuthorizationRuleCreateOrUpdateParameters", + **kwargs: Any + ) -> "_models.SharedAccessAuthorizationRuleResource": + """Creates an authorization rule for a queue. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def post_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SharedAccessAuthorizationRuleResource": + """Gets an authorization rule for a queue 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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.post_authorization_rule.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a queue authorization rule. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SharedAccessAuthorizationRuleResource": + """Gets an authorization rule for a queue 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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.ResourceListKeys": + """Primary and secondary connection strings to the queue. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateKeysParameters", + **kwargs: Any + ) -> "_models.ResourceListKeys": + """Regenerates the primary or secondary connection strings to the queue. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateKeysParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_subscriptions_operations.py new file mode 100644 index 0000000000000..ecad0389db189 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_subscriptions_operations.py @@ -0,0 +1,321 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionsOperations: + """SubscriptionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2015_08_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_all( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SubscriptionListResult"]: + """List all the subscriptions under a specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SubscriptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_all.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SubscriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: "_models.SubscriptionCreateOrUpdateParameters", + **kwargs: Any + ) -> "_models.SubscriptionResource": + """Creates a topic subscription. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SubscriptionResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SubscriptionCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SubscriptionResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + **kwargs: Any + ) -> None: + """Deletes a subscription from the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + **kwargs: Any + ) -> "_models.SubscriptionResource": + """Returns a subscription description for the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SubscriptionResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SubscriptionResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_topics_operations.py new file mode 100644 index 0000000000000..78809361ef44c --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_topics_operations.py @@ -0,0 +1,790 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TopicsOperations: + """TopicsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2015_08_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_all( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.TopicListResult"]: + """Gets all the topics in 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TopicListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.TopicListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TopicListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_all.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('TopicListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: "_models.TopicCreateOrUpdateParameters", + **kwargs: Any + ) -> "_models.TopicResource": + """Creates a topic in the specified 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 topic_name: The topic name. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.TopicCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopicResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.TopicResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TopicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'TopicCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TopicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> None: + """Deletes a topic from the specified namespace and resource group. + + :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 topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> "_models.TopicResource": + """Returns a description for the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopicResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.TopicResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TopicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TopicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SharedAccessAuthorizationRuleListResult"]: + """Gets authorization rules for a topic. + + :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 topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SharedAccessAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: "_models.SharedAccessAuthorizationRuleCreateOrUpdateParameters", + **kwargs: Any + ) -> "_models.SharedAccessAuthorizationRuleResource": + """Creates an authorization rule for the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def post_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SharedAccessAuthorizationRuleResource": + """Returns the specified authorization rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.post_authorization_rule.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SharedAccessAuthorizationRuleResource": + """Returns the specified authorization rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a topic authorization rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.ResourceListKeys": + """Gets the primary and secondary connection strings for the topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateKeysParameters", + **kwargs: Any + ) -> "_models.ResourceListKeys": + """Regenerates primary or secondary connection strings for the topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateKeysParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/__init__.py new file mode 100644 index 0000000000000..78f57734661b9 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/__init__.py @@ -0,0 +1,113 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import CheckNameAvailability + from ._models_py3 import CheckNameAvailabilityResult + from ._models_py3 import MessageCountDetails + from ._models_py3 import NamespaceCreateOrUpdateParameters + from ._models_py3 import NamespaceListResult + from ._models_py3 import NamespaceResource + from ._models_py3 import NamespaceUpdateParameters + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult + from ._models_py3 import QueueCreateOrUpdateParameters + from ._models_py3 import QueueListResult + from ._models_py3 import QueueResource + from ._models_py3 import RegenerateKeysParameters + from ._models_py3 import Resource + from ._models_py3 import ResourceListKeys + from ._models_py3 import SharedAccessAuthorizationRuleCreateOrUpdateParameters + from ._models_py3 import SharedAccessAuthorizationRuleListResult + from ._models_py3 import SharedAccessAuthorizationRuleResource + from ._models_py3 import Sku + from ._models_py3 import SubscriptionCreateOrUpdateParameters + from ._models_py3 import SubscriptionListResult + from ._models_py3 import SubscriptionResource + from ._models_py3 import TopicCreateOrUpdateParameters + from ._models_py3 import TopicListResult + from ._models_py3 import TopicResource + from ._models_py3 import TrackedResource +except (SyntaxError, ImportError): + from ._models import CheckNameAvailability # type: ignore + from ._models import CheckNameAvailabilityResult # type: ignore + from ._models import MessageCountDetails # type: ignore + from ._models import NamespaceCreateOrUpdateParameters # type: ignore + from ._models import NamespaceListResult # type: ignore + from ._models import NamespaceResource # type: ignore + from ._models import NamespaceUpdateParameters # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import QueueCreateOrUpdateParameters # type: ignore + from ._models import QueueListResult # type: ignore + from ._models import QueueResource # type: ignore + from ._models import RegenerateKeysParameters # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceListKeys # type: ignore + from ._models import SharedAccessAuthorizationRuleCreateOrUpdateParameters # type: ignore + from ._models import SharedAccessAuthorizationRuleListResult # type: ignore + from ._models import SharedAccessAuthorizationRuleResource # type: ignore + from ._models import Sku # type: ignore + from ._models import SubscriptionCreateOrUpdateParameters # type: ignore + from ._models import SubscriptionListResult # type: ignore + from ._models import SubscriptionResource # type: ignore + from ._models import TopicCreateOrUpdateParameters # type: ignore + from ._models import TopicListResult # type: ignore + from ._models import TopicResource # type: ignore + from ._models import TrackedResource # type: ignore + +from ._service_bus_management_client_enums import ( + AccessRights, + EntityAvailabilityStatus, + EntityStatus, + NamespaceState, + Policykey, + SkuName, + SkuTier, + UnavailableReason, +) + +__all__ = [ + 'CheckNameAvailability', + 'CheckNameAvailabilityResult', + 'MessageCountDetails', + 'NamespaceCreateOrUpdateParameters', + 'NamespaceListResult', + 'NamespaceResource', + 'NamespaceUpdateParameters', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'QueueCreateOrUpdateParameters', + 'QueueListResult', + 'QueueResource', + 'RegenerateKeysParameters', + 'Resource', + 'ResourceListKeys', + 'SharedAccessAuthorizationRuleCreateOrUpdateParameters', + 'SharedAccessAuthorizationRuleListResult', + 'SharedAccessAuthorizationRuleResource', + 'Sku', + 'SubscriptionCreateOrUpdateParameters', + 'SubscriptionListResult', + 'SubscriptionResource', + 'TopicCreateOrUpdateParameters', + 'TopicListResult', + 'TopicResource', + 'TrackedResource', + 'AccessRights', + 'EntityAvailabilityStatus', + 'EntityStatus', + 'NamespaceState', + 'Policykey', + 'SkuName', + 'SkuTier', + 'UnavailableReason', +] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_models.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_models.py new file mode 100644 index 0000000000000..27c8525903301 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_models.py @@ -0,0 +1,1525 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import msrest.serialization + + +class CheckNameAvailability(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The Name to check the namespace name availability and The namespace name + can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it + must end with a letter or number. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailability, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class CheckNameAvailabilityResult(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param name_available: Value indicating namespace is availability, true if the namespace is + available; otherwise, false. + :type name_available: bool + :param reason: The reason for unavailability of a namespace. Possible values include: "None", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "TooManyNamespaceInCurrentSubscription". + :type reason: str or ~azure.mgmt.servicebus.v2015_08_01.models.UnavailableReason + :ivar message: The detailed info regarding the reason associated with the namespace. + :vartype message: str + """ + + _validation = { + 'message': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.name_available = kwargs.get('name_available', None) + self.reason = kwargs.get('reason', None) + self.message = None + + +class MessageCountDetails(msrest.serialization.Model): + """Message Count Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar active_message_count: Number of active messages in the queue, topic, or subscription. + :vartype active_message_count: long + :ivar dead_letter_message_count: Number of messages that are dead lettered. + :vartype dead_letter_message_count: long + :ivar scheduled_message_count: Number of scheduled messages. + :vartype scheduled_message_count: long + :ivar transfer_dead_letter_message_count: Number of messages transferred into dead letters. + :vartype transfer_dead_letter_message_count: long + :ivar transfer_message_count: Number of messages transferred to another queue, topic, or + subscription. + :vartype transfer_message_count: long + """ + + _validation = { + 'active_message_count': {'readonly': True}, + 'dead_letter_message_count': {'readonly': True}, + 'scheduled_message_count': {'readonly': True}, + 'transfer_dead_letter_message_count': {'readonly': True}, + 'transfer_message_count': {'readonly': True}, + } + + _attribute_map = { + 'active_message_count': {'key': 'activeMessageCount', 'type': 'long'}, + 'dead_letter_message_count': {'key': 'deadLetterMessageCount', 'type': 'long'}, + 'scheduled_message_count': {'key': 'scheduledMessageCount', 'type': 'long'}, + 'transfer_dead_letter_message_count': {'key': 'transferDeadLetterMessageCount', 'type': 'long'}, + 'transfer_message_count': {'key': 'transferMessageCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(MessageCountDetails, self).__init__(**kwargs) + self.active_message_count = None + self.dead_letter_message_count = None + self.scheduled_message_count = None + self.transfer_dead_letter_message_count = None + self.transfer_message_count = None + + +class NamespaceCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Create Or Update Namespace operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. Namespace location. + :type location: str + :param sku: SKU of the namespace. + :type sku: ~azure.mgmt.servicebus.v2015_08_01.models.Sku + :param tags: A set of tags. Namespace tags. + :type tags: dict[str, str] + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :param status: State of the namespace. Possible values include: "Unknown", "Creating", + "Created", "Activating", "Enabling", "Active", "Disabling", "Disabled", "SoftDeleting", + "SoftDeleted", "Removing", "Removed", "Failed". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceState + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :param create_acs_namespace: Indicates whether to create an ACS namespace. + :type create_acs_namespace: bool + :param enabled: Specifies whether this instance is enabled. + :type enabled: bool + """ + + _validation = { + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'create_acs_namespace': {'key': 'properties.createACSNamespace', 'type': 'bool'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(NamespaceCreateOrUpdateParameters, self).__init__(**kwargs) + self.location = kwargs['location'] + self.sku = kwargs.get('sku', None) + self.tags = kwargs.get('tags', None) + self.provisioning_state = None + self.status = kwargs.get('status', None) + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.create_acs_namespace = kwargs.get('create_acs_namespace', None) + self.enabled = kwargs.get('enabled', None) + + +class NamespaceListResult(msrest.serialization.Model): + """The response of the List Namespace operation. + + :param value: Result of the List Namespace operation. + :type value: list[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Namespaces. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NamespaceResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NamespaceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class Resource(msrest.serialization.Model): + """The Resource definition for other than namespace. + + 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 + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.location = kwargs.get('location', None) + self.type = None + + +class TrackedResource(Resource): + """The Resource definition. + + 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 + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class NamespaceResource(TrackedResource): + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: SKU of the namespace. + :type sku: ~azure.mgmt.servicebus.v2015_08_01.models.Sku + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :param status: State of the namespace. Possible values include: "Unknown", "Creating", + "Created", "Activating", "Enabling", "Active", "Disabling", "Disabled", "SoftDeleting", + "SoftDeleted", "Removing", "Removed", "Failed". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceState + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :param create_acs_namespace: Indicates whether to create an ACS namespace. + :type create_acs_namespace: bool + :param enabled: Specifies whether this instance is enabled. + :type enabled: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'create_acs_namespace': {'key': 'properties.createACSNamespace', 'type': 'bool'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(NamespaceResource, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.provisioning_state = None + self.status = kwargs.get('status', None) + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.create_acs_namespace = kwargs.get('create_acs_namespace', None) + self.enabled = kwargs.get('enabled', None) + + +class NamespaceUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Patch Namespace operation. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: The sku of the created namespace. + :type sku: ~azure.mgmt.servicebus.v2015_08_01.models.Sku + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__( + self, + **kwargs + ): + super(NamespaceUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.sku = kwargs.get('sku', None) + + +class Operation(msrest.serialization.Model): + """A ServiceBus REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.servicebus.v2015_08_01.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = kwargs.get('display', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft.ServiceBus. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Invoice, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list ServiceBus operations. It contains a list of operations and a URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of ServiceBus operations supported by the Microsoft.ServiceBus resource + provider. + :vartype value: list[~azure.mgmt.servicebus.v2015_08_01.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class QueueCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Create Or Update Queue operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Queue name. + :type name: str + :param location: Required. location of the resource. + :type location: str + :param lock_duration: The duration of a peek-lock; that is, the amount of time that the message + is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default + value is 1 minute. + :type lock_duration: str + :ivar accessed_at: Last time a message was sent, or the last time there was a receive request + to this queue. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: the TimeSpan idle interval after which the queue is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :param entity_availability_status: Entity availability status for the queue. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :ivar created_at: The exact time the message was created. + :vartype created_at: ~datetime.datetime + :param default_message_time_to_live: The default message time to live value. This is the + duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param duplicate_detection_history_time_window: TimeSpan structure that defines the duration of + the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: str + :param enable_batched_operations: A value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param dead_lettering_on_message_expiration: A value that indicates whether this queue has dead + letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param enable_express: A value that indicates whether Express Entities are enabled. An express + queue holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param enable_partitioning: A value that indicates whether the queue is to be partitioned + across multiple message brokers. + :type enable_partitioning: bool + :param is_anonymous_accessible: A value that indicates whether the message is accessible + anonymously. + :type is_anonymous_accessible: bool + :param max_delivery_count: The maximum delivery count. A message is automatically deadlettered + after this number of deliveries. + :type max_delivery_count: int + :param max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size of + memory allocated for the queue. + :type max_size_in_megabytes: long + :ivar message_count: The number of messages in the queue. + :vartype message_count: long + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :param requires_duplicate_detection: A value indicating if this queue requires duplicate + detection. + :type requires_duplicate_detection: bool + :param requires_session: A value that indicates whether the queue supports the concept of + sessions. + :type requires_session: bool + :ivar size_in_bytes: The size of the queue, in bytes. + :vartype size_in_bytes: long + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :param support_ordering: A value that indicates whether the queue supports ordering. + :type support_ordering: bool + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'location': {'required': True}, + 'accessed_at': {'readonly': True}, + 'created_at': {'readonly': True}, + 'message_count': {'readonly': True}, + 'count_details': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'is_anonymous_accessible': {'key': 'properties.isAnonymousAccessible', 'type': 'bool'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'long'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(QueueCreateOrUpdateParameters, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.location = kwargs['location'] + self.lock_duration = kwargs.get('lock_duration', None) + self.accessed_at = None + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.entity_availability_status = kwargs.get('entity_availability_status', None) + self.created_at = None + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.duplicate_detection_history_time_window = kwargs.get('duplicate_detection_history_time_window', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.dead_lettering_on_message_expiration = kwargs.get('dead_lettering_on_message_expiration', None) + self.enable_express = kwargs.get('enable_express', None) + self.enable_partitioning = kwargs.get('enable_partitioning', None) + self.is_anonymous_accessible = kwargs.get('is_anonymous_accessible', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + self.max_size_in_megabytes = kwargs.get('max_size_in_megabytes', None) + self.message_count = None + self.count_details = None + self.requires_duplicate_detection = kwargs.get('requires_duplicate_detection', None) + self.requires_session = kwargs.get('requires_session', None) + self.size_in_bytes = None + self.status = kwargs.get('status', None) + self.support_ordering = kwargs.get('support_ordering', None) + self.updated_at = None + + +class QueueListResult(msrest.serialization.Model): + """The response to the List Queues operation. + + :param value: Result of the List Queues operation. + :type value: list[~azure.mgmt.servicebus.v2015_08_01.models.QueueResource] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of queues. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[QueueResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(QueueListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class QueueResource(Resource): + """Description of queue 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 + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :param lock_duration: The duration of a peek-lock; that is, the amount of time that the message + is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default + value is 1 minute. + :type lock_duration: str + :ivar accessed_at: Last time a message was sent, or the last time there was a receive request + to this queue. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: the TimeSpan idle interval after which the queue is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :param entity_availability_status: Entity availability status for the queue. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :ivar created_at: The exact time the message was created. + :vartype created_at: ~datetime.datetime + :param default_message_time_to_live: The default message time to live value. This is the + duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param duplicate_detection_history_time_window: TimeSpan structure that defines the duration of + the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: str + :param enable_batched_operations: A value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param dead_lettering_on_message_expiration: A value that indicates whether this queue has dead + letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param enable_express: A value that indicates whether Express Entities are enabled. An express + queue holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param enable_partitioning: A value that indicates whether the queue is to be partitioned + across multiple message brokers. + :type enable_partitioning: bool + :param is_anonymous_accessible: A value that indicates whether the message is accessible + anonymously. + :type is_anonymous_accessible: bool + :param max_delivery_count: The maximum delivery count. A message is automatically deadlettered + after this number of deliveries. + :type max_delivery_count: int + :param max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size of + memory allocated for the queue. + :type max_size_in_megabytes: long + :ivar message_count: The number of messages in the queue. + :vartype message_count: long + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :param requires_duplicate_detection: A value indicating if this queue requires duplicate + detection. + :type requires_duplicate_detection: bool + :param requires_session: A value that indicates whether the queue supports the concept of + sessions. + :type requires_session: bool + :ivar size_in_bytes: The size of the queue, in bytes. + :vartype size_in_bytes: long + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :param support_ordering: A value that indicates whether the queue supports ordering. + :type support_ordering: bool + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'created_at': {'readonly': True}, + 'message_count': {'readonly': True}, + 'count_details': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'is_anonymous_accessible': {'key': 'properties.isAnonymousAccessible', 'type': 'bool'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'long'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(QueueResource, self).__init__(**kwargs) + self.lock_duration = kwargs.get('lock_duration', None) + self.accessed_at = None + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.entity_availability_status = kwargs.get('entity_availability_status', None) + self.created_at = None + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.duplicate_detection_history_time_window = kwargs.get('duplicate_detection_history_time_window', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.dead_lettering_on_message_expiration = kwargs.get('dead_lettering_on_message_expiration', None) + self.enable_express = kwargs.get('enable_express', None) + self.enable_partitioning = kwargs.get('enable_partitioning', None) + self.is_anonymous_accessible = kwargs.get('is_anonymous_accessible', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + self.max_size_in_megabytes = kwargs.get('max_size_in_megabytes', None) + self.message_count = None + self.count_details = None + self.requires_duplicate_detection = kwargs.get('requires_duplicate_detection', None) + self.requires_session = kwargs.get('requires_session', None) + self.size_in_bytes = None + self.status = kwargs.get('status', None) + self.support_ordering = kwargs.get('support_ordering', None) + self.updated_at = None + + +class RegenerateKeysParameters(msrest.serialization.Model): + """Parameters supplied to the Regenerate Authorization Rule operation. + + :param policykey: Key that needs to be regenerated. Possible values include: "PrimaryKey", + "SecondaryKey". + :type policykey: str or ~azure.mgmt.servicebus.v2015_08_01.models.Policykey + """ + + _attribute_map = { + 'policykey': {'key': 'Policykey', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RegenerateKeysParameters, self).__init__(**kwargs) + self.policykey = kwargs.get('policykey', None) + + +class ResourceListKeys(msrest.serialization.Model): + """Namespace/ServiceBus Connection String. + + :param primary_connection_string: Primary connection string of the created namespace + authorization rule. + :type primary_connection_string: str + :param secondary_connection_string: Secondary connection string of the created namespace + authorization rule. + :type secondary_connection_string: str + :param primary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :type primary_key: str + :param secondary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :type secondary_key: str + :param key_name: A string that describes the authorization rule. + :type key_name: str + """ + + _attribute_map = { + 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, + 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'key_name': {'key': 'keyName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceListKeys, self).__init__(**kwargs) + self.primary_connection_string = kwargs.get('primary_connection_string', None) + self.secondary_connection_string = kwargs.get('secondary_connection_string', None) + self.primary_key = kwargs.get('primary_key', None) + self.secondary_key = kwargs.get('secondary_key', None) + self.key_name = kwargs.get('key_name', None) + + +class SharedAccessAuthorizationRuleCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Create Or Update Authorization Rules operation. + + :param location: data center location. + :type location: str + :param name: Name of the authorization rule. + :type name: str + :param rights: The rights associated with the rule. + :type rights: list[str or ~azure.mgmt.servicebus.v2015_08_01.models.AccessRights] + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'rights': {'key': 'properties.rights', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedAccessAuthorizationRuleCreateOrUpdateParameters, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.name = kwargs.get('name', None) + self.rights = kwargs.get('rights', None) + + +class SharedAccessAuthorizationRuleListResult(msrest.serialization.Model): + """The response to the List Namespace operation. + + :param value: Result of the List Authorization Rules operation. + :type value: + list[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Authorization Rules. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedAccessAuthorizationRuleResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedAccessAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SharedAccessAuthorizationRuleResource(Resource): + """Description of a namespace authorization rule. + + 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 + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :param rights: The rights associated with the rule. + :type rights: list[str or ~azure.mgmt.servicebus.v2015_08_01.models.AccessRights] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'rights': {'key': 'properties.rights', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedAccessAuthorizationRuleResource, self).__init__(**kwargs) + self.rights = kwargs.get('rights', None) + + +class Sku(msrest.serialization.Model): + """SKU of the namespace. + + All required parameters must be populated in order to send to Azure. + + :param name: Name of this SKU. Possible values include: "Basic", "Standard", "Premium". + :type name: str or ~azure.mgmt.servicebus.v2015_08_01.models.SkuName + :param tier: Required. The billing tier of this particular SKU. Possible values include: + "Basic", "Standard", "Premium". + :type tier: str or ~azure.mgmt.servicebus.v2015_08_01.models.SkuTier + :param capacity: The specified messaging units for the tier. + :type capacity: int + """ + + _validation = { + 'tier': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.tier = kwargs['tier'] + self.capacity = kwargs.get('capacity', None) + + +class SubscriptionCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Create Or Update Subscription operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. Subscription data center location. + :type location: str + :param type: Resource manager type of the resource. + :type type: str + :ivar accessed_at: Last time there was a receive request to this subscription. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: TimeSpan idle interval after which the topic is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :param default_message_time_to_live: Default message time to live value. This is the duration + after which the message expires, starting from when the message is sent to Service Bus. This is + the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param dead_lettering_on_filter_evaluation_exceptions: Value that indicates whether a + subscription has dead letter support on filter evaluation exceptions. + :type dead_lettering_on_filter_evaluation_exceptions: bool + :param dead_lettering_on_message_expiration: Value that indicates whether a subscription has + dead letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param entity_availability_status: Entity availability status for the topic. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :param is_read_only: Value that indicates whether the entity description is read-only. + :type is_read_only: bool + :param lock_duration: The lock duration time span for the subscription. + :type lock_duration: str + :param max_delivery_count: Number of maximum deliveries. + :type max_delivery_count: int + :ivar message_count: Number of messages. + :vartype message_count: long + :param requires_session: Value indicating if a subscription supports the concept of sessions. + :type requires_session: bool + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'location': {'required': True}, + 'accessed_at': {'readonly': True}, + 'count_details': {'readonly': True}, + 'created_at': {'readonly': True}, + 'message_count': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'is_read_only': {'key': 'properties.isReadOnly', 'type': 'bool'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'str'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SubscriptionCreateOrUpdateParameters, self).__init__(**kwargs) + self.location = kwargs['location'] + self.type = kwargs.get('type', None) + self.accessed_at = None + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.count_details = None + self.created_at = None + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.dead_lettering_on_filter_evaluation_exceptions = kwargs.get('dead_lettering_on_filter_evaluation_exceptions', None) + self.dead_lettering_on_message_expiration = kwargs.get('dead_lettering_on_message_expiration', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.entity_availability_status = kwargs.get('entity_availability_status', None) + self.is_read_only = kwargs.get('is_read_only', None) + self.lock_duration = kwargs.get('lock_duration', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + self.message_count = None + self.requires_session = kwargs.get('requires_session', None) + self.status = kwargs.get('status', None) + self.updated_at = None + + +class SubscriptionListResult(msrest.serialization.Model): + """The response to the List Subscriptions operation. + + :param value: Result of the List Subscriptions operation. + :type value: list[~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionResource] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of subscriptions. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SubscriptionResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SubscriptionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SubscriptionResource(Resource): + """Description of subscription 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 + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :ivar accessed_at: Last time there was a receive request to this subscription. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: TimeSpan idle interval after which the topic is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :param default_message_time_to_live: Default message time to live value. This is the duration + after which the message expires, starting from when the message is sent to Service Bus. This is + the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param dead_lettering_on_filter_evaluation_exceptions: Value that indicates whether a + subscription has dead letter support on filter evaluation exceptions. + :type dead_lettering_on_filter_evaluation_exceptions: bool + :param dead_lettering_on_message_expiration: Value that indicates whether a subscription has + dead letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param entity_availability_status: Entity availability status for the topic. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :param is_read_only: Value that indicates whether the entity description is read-only. + :type is_read_only: bool + :param lock_duration: The lock duration time span for the subscription. + :type lock_duration: str + :param max_delivery_count: Number of maximum deliveries. + :type max_delivery_count: int + :ivar message_count: Number of messages. + :vartype message_count: long + :param requires_session: Value indicating if a subscription supports the concept of sessions. + :type requires_session: bool + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'count_details': {'readonly': True}, + 'created_at': {'readonly': True}, + 'message_count': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'is_read_only': {'key': 'properties.isReadOnly', 'type': 'bool'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'str'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SubscriptionResource, self).__init__(**kwargs) + self.accessed_at = None + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.count_details = None + self.created_at = None + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.dead_lettering_on_filter_evaluation_exceptions = kwargs.get('dead_lettering_on_filter_evaluation_exceptions', None) + self.dead_lettering_on_message_expiration = kwargs.get('dead_lettering_on_message_expiration', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.entity_availability_status = kwargs.get('entity_availability_status', None) + self.is_read_only = kwargs.get('is_read_only', None) + self.lock_duration = kwargs.get('lock_duration', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + self.message_count = None + self.requires_session = kwargs.get('requires_session', None) + self.status = kwargs.get('status', None) + self.updated_at = None + + +class TopicCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Create Or Update Topic operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Topic name. + :type name: str + :param location: Required. Location of the resource. + :type location: str + :ivar accessed_at: Last time the message was sent, or a request was received, for this topic. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: TimeSpan idle interval after which the topic is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :param entity_availability_status: Entity availability status for the topic. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :param default_message_time_to_live: Default message time to live value. This is the duration + after which the message expires, starting from when the message is sent to Service Bus. This is + the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param duplicate_detection_history_time_window: TimeSpan structure that defines the duration of + the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: str + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param enable_express: Value that indicates whether Express Entities are enabled. An express + topic holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param enable_partitioning: Value that indicates whether the topic to be partitioned across + multiple message brokers is enabled. + :type enable_partitioning: bool + :param filtering_messages_before_publishing: Whether messages should be filtered before + publishing. + :type filtering_messages_before_publishing: bool + :param is_anonymous_accessible: Value that indicates whether the message is accessible + anonymously. + :type is_anonymous_accessible: bool + :param is_express: + :type is_express: bool + :param max_size_in_megabytes: Maximum size of the topic in megabytes, which is the size of the + memory allocated for the topic. + :type max_size_in_megabytes: long + :param requires_duplicate_detection: Value indicating if this topic requires duplicate + detection. + :type requires_duplicate_detection: bool + :ivar size_in_bytes: Size of the topic, in bytes. + :vartype size_in_bytes: long + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :ivar subscription_count: Number of subscriptions. + :vartype subscription_count: int + :param support_ordering: Value that indicates whether the topic supports ordering. + :type support_ordering: bool + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'location': {'required': True}, + 'accessed_at': {'readonly': True}, + 'created_at': {'readonly': True}, + 'count_details': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'subscription_count': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'filtering_messages_before_publishing': {'key': 'properties.filteringMessagesBeforePublishing', 'type': 'bool'}, + 'is_anonymous_accessible': {'key': 'properties.isAnonymousAccessible', 'type': 'bool'}, + 'is_express': {'key': 'properties.isExpress', 'type': 'bool'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'long'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(TopicCreateOrUpdateParameters, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.location = kwargs['location'] + self.accessed_at = None + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.entity_availability_status = kwargs.get('entity_availability_status', None) + self.created_at = None + self.count_details = None + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.duplicate_detection_history_time_window = kwargs.get('duplicate_detection_history_time_window', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.enable_express = kwargs.get('enable_express', None) + self.enable_partitioning = kwargs.get('enable_partitioning', None) + self.filtering_messages_before_publishing = kwargs.get('filtering_messages_before_publishing', None) + self.is_anonymous_accessible = kwargs.get('is_anonymous_accessible', None) + self.is_express = kwargs.get('is_express', None) + self.max_size_in_megabytes = kwargs.get('max_size_in_megabytes', None) + self.requires_duplicate_detection = kwargs.get('requires_duplicate_detection', None) + self.size_in_bytes = None + self.status = kwargs.get('status', None) + self.subscription_count = None + self.support_ordering = kwargs.get('support_ordering', None) + self.updated_at = None + + +class TopicListResult(msrest.serialization.Model): + """The response to the List Topics operation. + + :param value: Result of the List Topics operation. + :type value: list[~azure.mgmt.servicebus.v2015_08_01.models.TopicResource] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of topics. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TopicResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TopicListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class TopicResource(Resource): + """Description of topic 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 + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :ivar accessed_at: Last time the message was sent, or a request was received, for this topic. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: TimeSpan idle interval after which the topic is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :param entity_availability_status: Entity availability status for the topic. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :param default_message_time_to_live: Default message time to live value. This is the duration + after which the message expires, starting from when the message is sent to Service Bus. This is + the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param duplicate_detection_history_time_window: TimeSpan structure that defines the duration of + the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: str + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param enable_express: Value that indicates whether Express Entities are enabled. An express + topic holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param enable_partitioning: Value that indicates whether the topic to be partitioned across + multiple message brokers is enabled. + :type enable_partitioning: bool + :param filtering_messages_before_publishing: Whether messages should be filtered before + publishing. + :type filtering_messages_before_publishing: bool + :param is_anonymous_accessible: Value that indicates whether the message is accessible + anonymously. + :type is_anonymous_accessible: bool + :param is_express: + :type is_express: bool + :param max_size_in_megabytes: Maximum size of the topic in megabytes, which is the size of the + memory allocated for the topic. + :type max_size_in_megabytes: long + :param requires_duplicate_detection: Value indicating if this topic requires duplicate + detection. + :type requires_duplicate_detection: bool + :ivar size_in_bytes: Size of the topic, in bytes. + :vartype size_in_bytes: long + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :ivar subscription_count: Number of subscriptions. + :vartype subscription_count: int + :param support_ordering: Value that indicates whether the topic supports ordering. + :type support_ordering: bool + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'created_at': {'readonly': True}, + 'count_details': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'subscription_count': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'filtering_messages_before_publishing': {'key': 'properties.filteringMessagesBeforePublishing', 'type': 'bool'}, + 'is_anonymous_accessible': {'key': 'properties.isAnonymousAccessible', 'type': 'bool'}, + 'is_express': {'key': 'properties.isExpress', 'type': 'bool'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'long'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(TopicResource, self).__init__(**kwargs) + self.accessed_at = None + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.entity_availability_status = kwargs.get('entity_availability_status', None) + self.created_at = None + self.count_details = None + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.duplicate_detection_history_time_window = kwargs.get('duplicate_detection_history_time_window', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.enable_express = kwargs.get('enable_express', None) + self.enable_partitioning = kwargs.get('enable_partitioning', None) + self.filtering_messages_before_publishing = kwargs.get('filtering_messages_before_publishing', None) + self.is_anonymous_accessible = kwargs.get('is_anonymous_accessible', None) + self.is_express = kwargs.get('is_express', None) + self.max_size_in_megabytes = kwargs.get('max_size_in_megabytes', None) + self.requires_duplicate_detection = kwargs.get('requires_duplicate_detection', None) + self.size_in_bytes = None + self.status = kwargs.get('status', None) + self.subscription_count = None + self.support_ordering = kwargs.get('support_ordering', None) + self.updated_at = None diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_models_py3.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_models_py3.py new file mode 100644 index 0000000000000..2b2c32db4e790 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_models_py3.py @@ -0,0 +1,1689 @@ +# 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 typing import Dict, List, Optional, Union + +import msrest.serialization + +from ._service_bus_management_client_enums import * + + +class CheckNameAvailability(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The Name to check the namespace name availability and The namespace name + can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it + must end with a letter or number. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(CheckNameAvailability, self).__init__(**kwargs) + self.name = name + + +class CheckNameAvailabilityResult(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param name_available: Value indicating namespace is availability, true if the namespace is + available; otherwise, false. + :type name_available: bool + :param reason: The reason for unavailability of a namespace. Possible values include: "None", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "TooManyNamespaceInCurrentSubscription". + :type reason: str or ~azure.mgmt.servicebus.v2015_08_01.models.UnavailableReason + :ivar message: The detailed info regarding the reason associated with the namespace. + :vartype message: str + """ + + _validation = { + 'message': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[Union[str, "UnavailableReason"]] = None, + **kwargs + ): + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.name_available = name_available + self.reason = reason + self.message = None + + +class MessageCountDetails(msrest.serialization.Model): + """Message Count Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar active_message_count: Number of active messages in the queue, topic, or subscription. + :vartype active_message_count: long + :ivar dead_letter_message_count: Number of messages that are dead lettered. + :vartype dead_letter_message_count: long + :ivar scheduled_message_count: Number of scheduled messages. + :vartype scheduled_message_count: long + :ivar transfer_dead_letter_message_count: Number of messages transferred into dead letters. + :vartype transfer_dead_letter_message_count: long + :ivar transfer_message_count: Number of messages transferred to another queue, topic, or + subscription. + :vartype transfer_message_count: long + """ + + _validation = { + 'active_message_count': {'readonly': True}, + 'dead_letter_message_count': {'readonly': True}, + 'scheduled_message_count': {'readonly': True}, + 'transfer_dead_letter_message_count': {'readonly': True}, + 'transfer_message_count': {'readonly': True}, + } + + _attribute_map = { + 'active_message_count': {'key': 'activeMessageCount', 'type': 'long'}, + 'dead_letter_message_count': {'key': 'deadLetterMessageCount', 'type': 'long'}, + 'scheduled_message_count': {'key': 'scheduledMessageCount', 'type': 'long'}, + 'transfer_dead_letter_message_count': {'key': 'transferDeadLetterMessageCount', 'type': 'long'}, + 'transfer_message_count': {'key': 'transferMessageCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(MessageCountDetails, self).__init__(**kwargs) + self.active_message_count = None + self.dead_letter_message_count = None + self.scheduled_message_count = None + self.transfer_dead_letter_message_count = None + self.transfer_message_count = None + + +class NamespaceCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Create Or Update Namespace operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. Namespace location. + :type location: str + :param sku: SKU of the namespace. + :type sku: ~azure.mgmt.servicebus.v2015_08_01.models.Sku + :param tags: A set of tags. Namespace tags. + :type tags: dict[str, str] + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :param status: State of the namespace. Possible values include: "Unknown", "Creating", + "Created", "Activating", "Enabling", "Active", "Disabling", "Disabled", "SoftDeleting", + "SoftDeleted", "Removing", "Removed", "Failed". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceState + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :param create_acs_namespace: Indicates whether to create an ACS namespace. + :type create_acs_namespace: bool + :param enabled: Specifies whether this instance is enabled. + :type enabled: bool + """ + + _validation = { + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'create_acs_namespace': {'key': 'properties.createACSNamespace', 'type': 'bool'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + location: str, + sku: Optional["Sku"] = None, + tags: Optional[Dict[str, str]] = None, + status: Optional[Union[str, "NamespaceState"]] = None, + create_acs_namespace: Optional[bool] = None, + enabled: Optional[bool] = None, + **kwargs + ): + super(NamespaceCreateOrUpdateParameters, self).__init__(**kwargs) + self.location = location + self.sku = sku + self.tags = tags + self.provisioning_state = None + self.status = status + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.create_acs_namespace = create_acs_namespace + self.enabled = enabled + + +class NamespaceListResult(msrest.serialization.Model): + """The response of the List Namespace operation. + + :param value: Result of the List Namespace operation. + :type value: list[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Namespaces. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NamespaceResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NamespaceResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(NamespaceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class Resource(msrest.serialization.Model): + """The Resource definition for other than namespace. + + 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 + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.location = location + self.type = None + + +class TrackedResource(Resource): + """The Resource definition. + + 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 + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TrackedResource, self).__init__(location=location, **kwargs) + self.tags = tags + + +class NamespaceResource(TrackedResource): + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: SKU of the namespace. + :type sku: ~azure.mgmt.servicebus.v2015_08_01.models.Sku + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :param status: State of the namespace. Possible values include: "Unknown", "Creating", + "Created", "Activating", "Enabling", "Active", "Disabling", "Disabled", "SoftDeleting", + "SoftDeleted", "Removing", "Removed", "Failed". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceState + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :param create_acs_namespace: Indicates whether to create an ACS namespace. + :type create_acs_namespace: bool + :param enabled: Specifies whether this instance is enabled. + :type enabled: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'create_acs_namespace': {'key': 'properties.createACSNamespace', 'type': 'bool'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["Sku"] = None, + status: Optional[Union[str, "NamespaceState"]] = None, + create_acs_namespace: Optional[bool] = None, + enabled: Optional[bool] = None, + **kwargs + ): + super(NamespaceResource, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.provisioning_state = None + self.status = status + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.create_acs_namespace = create_acs_namespace + self.enabled = enabled + + +class NamespaceUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Patch Namespace operation. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: The sku of the created namespace. + :type sku: ~azure.mgmt.servicebus.v2015_08_01.models.Sku + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + sku: Optional["Sku"] = None, + **kwargs + ): + super(NamespaceUpdateParameters, self).__init__(**kwargs) + self.tags = tags + self.sku = sku + + +class Operation(msrest.serialization.Model): + """A ServiceBus REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.servicebus.v2015_08_01.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = display + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft.ServiceBus. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Invoice, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list ServiceBus operations. It contains a list of operations and a URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of ServiceBus operations supported by the Microsoft.ServiceBus resource + provider. + :vartype value: list[~azure.mgmt.servicebus.v2015_08_01.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class QueueCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Create Or Update Queue operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Queue name. + :type name: str + :param location: Required. location of the resource. + :type location: str + :param lock_duration: The duration of a peek-lock; that is, the amount of time that the message + is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default + value is 1 minute. + :type lock_duration: str + :ivar accessed_at: Last time a message was sent, or the last time there was a receive request + to this queue. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: the TimeSpan idle interval after which the queue is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :param entity_availability_status: Entity availability status for the queue. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :ivar created_at: The exact time the message was created. + :vartype created_at: ~datetime.datetime + :param default_message_time_to_live: The default message time to live value. This is the + duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param duplicate_detection_history_time_window: TimeSpan structure that defines the duration of + the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: str + :param enable_batched_operations: A value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param dead_lettering_on_message_expiration: A value that indicates whether this queue has dead + letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param enable_express: A value that indicates whether Express Entities are enabled. An express + queue holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param enable_partitioning: A value that indicates whether the queue is to be partitioned + across multiple message brokers. + :type enable_partitioning: bool + :param is_anonymous_accessible: A value that indicates whether the message is accessible + anonymously. + :type is_anonymous_accessible: bool + :param max_delivery_count: The maximum delivery count. A message is automatically deadlettered + after this number of deliveries. + :type max_delivery_count: int + :param max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size of + memory allocated for the queue. + :type max_size_in_megabytes: long + :ivar message_count: The number of messages in the queue. + :vartype message_count: long + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :param requires_duplicate_detection: A value indicating if this queue requires duplicate + detection. + :type requires_duplicate_detection: bool + :param requires_session: A value that indicates whether the queue supports the concept of + sessions. + :type requires_session: bool + :ivar size_in_bytes: The size of the queue, in bytes. + :vartype size_in_bytes: long + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :param support_ordering: A value that indicates whether the queue supports ordering. + :type support_ordering: bool + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'location': {'required': True}, + 'accessed_at': {'readonly': True}, + 'created_at': {'readonly': True}, + 'message_count': {'readonly': True}, + 'count_details': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'is_anonymous_accessible': {'key': 'properties.isAnonymousAccessible', 'type': 'bool'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'long'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + location: str, + name: Optional[str] = None, + lock_duration: Optional[str] = None, + auto_delete_on_idle: Optional[str] = None, + entity_availability_status: Optional[Union[str, "EntityAvailabilityStatus"]] = None, + default_message_time_to_live: Optional[str] = None, + duplicate_detection_history_time_window: Optional[str] = None, + enable_batched_operations: Optional[bool] = None, + dead_lettering_on_message_expiration: Optional[bool] = None, + enable_express: Optional[bool] = None, + enable_partitioning: Optional[bool] = None, + is_anonymous_accessible: Optional[bool] = None, + max_delivery_count: Optional[int] = None, + max_size_in_megabytes: Optional[int] = None, + requires_duplicate_detection: Optional[bool] = None, + requires_session: Optional[bool] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + support_ordering: Optional[bool] = None, + **kwargs + ): + super(QueueCreateOrUpdateParameters, self).__init__(**kwargs) + self.name = name + self.location = location + self.lock_duration = lock_duration + self.accessed_at = None + self.auto_delete_on_idle = auto_delete_on_idle + self.entity_availability_status = entity_availability_status + self.created_at = None + self.default_message_time_to_live = default_message_time_to_live + self.duplicate_detection_history_time_window = duplicate_detection_history_time_window + self.enable_batched_operations = enable_batched_operations + self.dead_lettering_on_message_expiration = dead_lettering_on_message_expiration + self.enable_express = enable_express + self.enable_partitioning = enable_partitioning + self.is_anonymous_accessible = is_anonymous_accessible + self.max_delivery_count = max_delivery_count + self.max_size_in_megabytes = max_size_in_megabytes + self.message_count = None + self.count_details = None + self.requires_duplicate_detection = requires_duplicate_detection + self.requires_session = requires_session + self.size_in_bytes = None + self.status = status + self.support_ordering = support_ordering + self.updated_at = None + + +class QueueListResult(msrest.serialization.Model): + """The response to the List Queues operation. + + :param value: Result of the List Queues operation. + :type value: list[~azure.mgmt.servicebus.v2015_08_01.models.QueueResource] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of queues. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[QueueResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["QueueResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(QueueListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class QueueResource(Resource): + """Description of queue 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 + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :param lock_duration: The duration of a peek-lock; that is, the amount of time that the message + is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default + value is 1 minute. + :type lock_duration: str + :ivar accessed_at: Last time a message was sent, or the last time there was a receive request + to this queue. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: the TimeSpan idle interval after which the queue is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :param entity_availability_status: Entity availability status for the queue. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :ivar created_at: The exact time the message was created. + :vartype created_at: ~datetime.datetime + :param default_message_time_to_live: The default message time to live value. This is the + duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param duplicate_detection_history_time_window: TimeSpan structure that defines the duration of + the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: str + :param enable_batched_operations: A value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param dead_lettering_on_message_expiration: A value that indicates whether this queue has dead + letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param enable_express: A value that indicates whether Express Entities are enabled. An express + queue holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param enable_partitioning: A value that indicates whether the queue is to be partitioned + across multiple message brokers. + :type enable_partitioning: bool + :param is_anonymous_accessible: A value that indicates whether the message is accessible + anonymously. + :type is_anonymous_accessible: bool + :param max_delivery_count: The maximum delivery count. A message is automatically deadlettered + after this number of deliveries. + :type max_delivery_count: int + :param max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size of + memory allocated for the queue. + :type max_size_in_megabytes: long + :ivar message_count: The number of messages in the queue. + :vartype message_count: long + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :param requires_duplicate_detection: A value indicating if this queue requires duplicate + detection. + :type requires_duplicate_detection: bool + :param requires_session: A value that indicates whether the queue supports the concept of + sessions. + :type requires_session: bool + :ivar size_in_bytes: The size of the queue, in bytes. + :vartype size_in_bytes: long + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :param support_ordering: A value that indicates whether the queue supports ordering. + :type support_ordering: bool + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'created_at': {'readonly': True}, + 'message_count': {'readonly': True}, + 'count_details': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'is_anonymous_accessible': {'key': 'properties.isAnonymousAccessible', 'type': 'bool'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'long'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + lock_duration: Optional[str] = None, + auto_delete_on_idle: Optional[str] = None, + entity_availability_status: Optional[Union[str, "EntityAvailabilityStatus"]] = None, + default_message_time_to_live: Optional[str] = None, + duplicate_detection_history_time_window: Optional[str] = None, + enable_batched_operations: Optional[bool] = None, + dead_lettering_on_message_expiration: Optional[bool] = None, + enable_express: Optional[bool] = None, + enable_partitioning: Optional[bool] = None, + is_anonymous_accessible: Optional[bool] = None, + max_delivery_count: Optional[int] = None, + max_size_in_megabytes: Optional[int] = None, + requires_duplicate_detection: Optional[bool] = None, + requires_session: Optional[bool] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + support_ordering: Optional[bool] = None, + **kwargs + ): + super(QueueResource, self).__init__(location=location, **kwargs) + self.lock_duration = lock_duration + self.accessed_at = None + self.auto_delete_on_idle = auto_delete_on_idle + self.entity_availability_status = entity_availability_status + self.created_at = None + self.default_message_time_to_live = default_message_time_to_live + self.duplicate_detection_history_time_window = duplicate_detection_history_time_window + self.enable_batched_operations = enable_batched_operations + self.dead_lettering_on_message_expiration = dead_lettering_on_message_expiration + self.enable_express = enable_express + self.enable_partitioning = enable_partitioning + self.is_anonymous_accessible = is_anonymous_accessible + self.max_delivery_count = max_delivery_count + self.max_size_in_megabytes = max_size_in_megabytes + self.message_count = None + self.count_details = None + self.requires_duplicate_detection = requires_duplicate_detection + self.requires_session = requires_session + self.size_in_bytes = None + self.status = status + self.support_ordering = support_ordering + self.updated_at = None + + +class RegenerateKeysParameters(msrest.serialization.Model): + """Parameters supplied to the Regenerate Authorization Rule operation. + + :param policykey: Key that needs to be regenerated. Possible values include: "PrimaryKey", + "SecondaryKey". + :type policykey: str or ~azure.mgmt.servicebus.v2015_08_01.models.Policykey + """ + + _attribute_map = { + 'policykey': {'key': 'Policykey', 'type': 'str'}, + } + + def __init__( + self, + *, + policykey: Optional[Union[str, "Policykey"]] = None, + **kwargs + ): + super(RegenerateKeysParameters, self).__init__(**kwargs) + self.policykey = policykey + + +class ResourceListKeys(msrest.serialization.Model): + """Namespace/ServiceBus Connection String. + + :param primary_connection_string: Primary connection string of the created namespace + authorization rule. + :type primary_connection_string: str + :param secondary_connection_string: Secondary connection string of the created namespace + authorization rule. + :type secondary_connection_string: str + :param primary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :type primary_key: str + :param secondary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :type secondary_key: str + :param key_name: A string that describes the authorization rule. + :type key_name: str + """ + + _attribute_map = { + 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, + 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'key_name': {'key': 'keyName', 'type': 'str'}, + } + + def __init__( + self, + *, + primary_connection_string: Optional[str] = None, + secondary_connection_string: Optional[str] = None, + primary_key: Optional[str] = None, + secondary_key: Optional[str] = None, + key_name: Optional[str] = None, + **kwargs + ): + super(ResourceListKeys, self).__init__(**kwargs) + self.primary_connection_string = primary_connection_string + self.secondary_connection_string = secondary_connection_string + self.primary_key = primary_key + self.secondary_key = secondary_key + self.key_name = key_name + + +class SharedAccessAuthorizationRuleCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Create Or Update Authorization Rules operation. + + :param location: data center location. + :type location: str + :param name: Name of the authorization rule. + :type name: str + :param rights: The rights associated with the rule. + :type rights: list[str or ~azure.mgmt.servicebus.v2015_08_01.models.AccessRights] + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'rights': {'key': 'properties.rights', 'type': '[str]'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + name: Optional[str] = None, + rights: Optional[List[Union[str, "AccessRights"]]] = None, + **kwargs + ): + super(SharedAccessAuthorizationRuleCreateOrUpdateParameters, self).__init__(**kwargs) + self.location = location + self.name = name + self.rights = rights + + +class SharedAccessAuthorizationRuleListResult(msrest.serialization.Model): + """The response to the List Namespace operation. + + :param value: Result of the List Authorization Rules operation. + :type value: + list[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Authorization Rules. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedAccessAuthorizationRuleResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SharedAccessAuthorizationRuleResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SharedAccessAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SharedAccessAuthorizationRuleResource(Resource): + """Description of a namespace authorization rule. + + 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 + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :param rights: The rights associated with the rule. + :type rights: list[str or ~azure.mgmt.servicebus.v2015_08_01.models.AccessRights] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'rights': {'key': 'properties.rights', 'type': '[str]'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + rights: Optional[List[Union[str, "AccessRights"]]] = None, + **kwargs + ): + super(SharedAccessAuthorizationRuleResource, self).__init__(location=location, **kwargs) + self.rights = rights + + +class Sku(msrest.serialization.Model): + """SKU of the namespace. + + All required parameters must be populated in order to send to Azure. + + :param name: Name of this SKU. Possible values include: "Basic", "Standard", "Premium". + :type name: str or ~azure.mgmt.servicebus.v2015_08_01.models.SkuName + :param tier: Required. The billing tier of this particular SKU. Possible values include: + "Basic", "Standard", "Premium". + :type tier: str or ~azure.mgmt.servicebus.v2015_08_01.models.SkuTier + :param capacity: The specified messaging units for the tier. + :type capacity: int + """ + + _validation = { + 'tier': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + *, + tier: Union[str, "SkuTier"], + name: Optional[Union[str, "SkuName"]] = None, + capacity: Optional[int] = None, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.capacity = capacity + + +class SubscriptionCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Create Or Update Subscription operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. Subscription data center location. + :type location: str + :param type: Resource manager type of the resource. + :type type: str + :ivar accessed_at: Last time there was a receive request to this subscription. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: TimeSpan idle interval after which the topic is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :param default_message_time_to_live: Default message time to live value. This is the duration + after which the message expires, starting from when the message is sent to Service Bus. This is + the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param dead_lettering_on_filter_evaluation_exceptions: Value that indicates whether a + subscription has dead letter support on filter evaluation exceptions. + :type dead_lettering_on_filter_evaluation_exceptions: bool + :param dead_lettering_on_message_expiration: Value that indicates whether a subscription has + dead letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param entity_availability_status: Entity availability status for the topic. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :param is_read_only: Value that indicates whether the entity description is read-only. + :type is_read_only: bool + :param lock_duration: The lock duration time span for the subscription. + :type lock_duration: str + :param max_delivery_count: Number of maximum deliveries. + :type max_delivery_count: int + :ivar message_count: Number of messages. + :vartype message_count: long + :param requires_session: Value indicating if a subscription supports the concept of sessions. + :type requires_session: bool + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'location': {'required': True}, + 'accessed_at': {'readonly': True}, + 'count_details': {'readonly': True}, + 'created_at': {'readonly': True}, + 'message_count': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'is_read_only': {'key': 'properties.isReadOnly', 'type': 'bool'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'str'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + location: str, + type: Optional[str] = None, + auto_delete_on_idle: Optional[str] = None, + default_message_time_to_live: Optional[str] = None, + dead_lettering_on_filter_evaluation_exceptions: Optional[bool] = None, + dead_lettering_on_message_expiration: Optional[bool] = None, + enable_batched_operations: Optional[bool] = None, + entity_availability_status: Optional[Union[str, "EntityAvailabilityStatus"]] = None, + is_read_only: Optional[bool] = None, + lock_duration: Optional[str] = None, + max_delivery_count: Optional[int] = None, + requires_session: Optional[bool] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + **kwargs + ): + super(SubscriptionCreateOrUpdateParameters, self).__init__(**kwargs) + self.location = location + self.type = type + self.accessed_at = None + self.auto_delete_on_idle = auto_delete_on_idle + self.count_details = None + self.created_at = None + self.default_message_time_to_live = default_message_time_to_live + self.dead_lettering_on_filter_evaluation_exceptions = dead_lettering_on_filter_evaluation_exceptions + self.dead_lettering_on_message_expiration = dead_lettering_on_message_expiration + self.enable_batched_operations = enable_batched_operations + self.entity_availability_status = entity_availability_status + self.is_read_only = is_read_only + self.lock_duration = lock_duration + self.max_delivery_count = max_delivery_count + self.message_count = None + self.requires_session = requires_session + self.status = status + self.updated_at = None + + +class SubscriptionListResult(msrest.serialization.Model): + """The response to the List Subscriptions operation. + + :param value: Result of the List Subscriptions operation. + :type value: list[~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionResource] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of subscriptions. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SubscriptionResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SubscriptionResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SubscriptionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SubscriptionResource(Resource): + """Description of subscription 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 + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :ivar accessed_at: Last time there was a receive request to this subscription. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: TimeSpan idle interval after which the topic is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :param default_message_time_to_live: Default message time to live value. This is the duration + after which the message expires, starting from when the message is sent to Service Bus. This is + the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param dead_lettering_on_filter_evaluation_exceptions: Value that indicates whether a + subscription has dead letter support on filter evaluation exceptions. + :type dead_lettering_on_filter_evaluation_exceptions: bool + :param dead_lettering_on_message_expiration: Value that indicates whether a subscription has + dead letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param entity_availability_status: Entity availability status for the topic. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :param is_read_only: Value that indicates whether the entity description is read-only. + :type is_read_only: bool + :param lock_duration: The lock duration time span for the subscription. + :type lock_duration: str + :param max_delivery_count: Number of maximum deliveries. + :type max_delivery_count: int + :ivar message_count: Number of messages. + :vartype message_count: long + :param requires_session: Value indicating if a subscription supports the concept of sessions. + :type requires_session: bool + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'count_details': {'readonly': True}, + 'created_at': {'readonly': True}, + 'message_count': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'is_read_only': {'key': 'properties.isReadOnly', 'type': 'bool'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'str'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + auto_delete_on_idle: Optional[str] = None, + default_message_time_to_live: Optional[str] = None, + dead_lettering_on_filter_evaluation_exceptions: Optional[bool] = None, + dead_lettering_on_message_expiration: Optional[bool] = None, + enable_batched_operations: Optional[bool] = None, + entity_availability_status: Optional[Union[str, "EntityAvailabilityStatus"]] = None, + is_read_only: Optional[bool] = None, + lock_duration: Optional[str] = None, + max_delivery_count: Optional[int] = None, + requires_session: Optional[bool] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + **kwargs + ): + super(SubscriptionResource, self).__init__(location=location, **kwargs) + self.accessed_at = None + self.auto_delete_on_idle = auto_delete_on_idle + self.count_details = None + self.created_at = None + self.default_message_time_to_live = default_message_time_to_live + self.dead_lettering_on_filter_evaluation_exceptions = dead_lettering_on_filter_evaluation_exceptions + self.dead_lettering_on_message_expiration = dead_lettering_on_message_expiration + self.enable_batched_operations = enable_batched_operations + self.entity_availability_status = entity_availability_status + self.is_read_only = is_read_only + self.lock_duration = lock_duration + self.max_delivery_count = max_delivery_count + self.message_count = None + self.requires_session = requires_session + self.status = status + self.updated_at = None + + +class TopicCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Create Or Update Topic operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Topic name. + :type name: str + :param location: Required. Location of the resource. + :type location: str + :ivar accessed_at: Last time the message was sent, or a request was received, for this topic. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: TimeSpan idle interval after which the topic is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :param entity_availability_status: Entity availability status for the topic. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :param default_message_time_to_live: Default message time to live value. This is the duration + after which the message expires, starting from when the message is sent to Service Bus. This is + the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param duplicate_detection_history_time_window: TimeSpan structure that defines the duration of + the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: str + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param enable_express: Value that indicates whether Express Entities are enabled. An express + topic holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param enable_partitioning: Value that indicates whether the topic to be partitioned across + multiple message brokers is enabled. + :type enable_partitioning: bool + :param filtering_messages_before_publishing: Whether messages should be filtered before + publishing. + :type filtering_messages_before_publishing: bool + :param is_anonymous_accessible: Value that indicates whether the message is accessible + anonymously. + :type is_anonymous_accessible: bool + :param is_express: + :type is_express: bool + :param max_size_in_megabytes: Maximum size of the topic in megabytes, which is the size of the + memory allocated for the topic. + :type max_size_in_megabytes: long + :param requires_duplicate_detection: Value indicating if this topic requires duplicate + detection. + :type requires_duplicate_detection: bool + :ivar size_in_bytes: Size of the topic, in bytes. + :vartype size_in_bytes: long + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :ivar subscription_count: Number of subscriptions. + :vartype subscription_count: int + :param support_ordering: Value that indicates whether the topic supports ordering. + :type support_ordering: bool + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'location': {'required': True}, + 'accessed_at': {'readonly': True}, + 'created_at': {'readonly': True}, + 'count_details': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'subscription_count': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'filtering_messages_before_publishing': {'key': 'properties.filteringMessagesBeforePublishing', 'type': 'bool'}, + 'is_anonymous_accessible': {'key': 'properties.isAnonymousAccessible', 'type': 'bool'}, + 'is_express': {'key': 'properties.isExpress', 'type': 'bool'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'long'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + location: str, + name: Optional[str] = None, + auto_delete_on_idle: Optional[str] = None, + entity_availability_status: Optional[Union[str, "EntityAvailabilityStatus"]] = None, + default_message_time_to_live: Optional[str] = None, + duplicate_detection_history_time_window: Optional[str] = None, + enable_batched_operations: Optional[bool] = None, + enable_express: Optional[bool] = None, + enable_partitioning: Optional[bool] = None, + filtering_messages_before_publishing: Optional[bool] = None, + is_anonymous_accessible: Optional[bool] = None, + is_express: Optional[bool] = None, + max_size_in_megabytes: Optional[int] = None, + requires_duplicate_detection: Optional[bool] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + support_ordering: Optional[bool] = None, + **kwargs + ): + super(TopicCreateOrUpdateParameters, self).__init__(**kwargs) + self.name = name + self.location = location + self.accessed_at = None + self.auto_delete_on_idle = auto_delete_on_idle + self.entity_availability_status = entity_availability_status + self.created_at = None + self.count_details = None + self.default_message_time_to_live = default_message_time_to_live + self.duplicate_detection_history_time_window = duplicate_detection_history_time_window + self.enable_batched_operations = enable_batched_operations + self.enable_express = enable_express + self.enable_partitioning = enable_partitioning + self.filtering_messages_before_publishing = filtering_messages_before_publishing + self.is_anonymous_accessible = is_anonymous_accessible + self.is_express = is_express + self.max_size_in_megabytes = max_size_in_megabytes + self.requires_duplicate_detection = requires_duplicate_detection + self.size_in_bytes = None + self.status = status + self.subscription_count = None + self.support_ordering = support_ordering + self.updated_at = None + + +class TopicListResult(msrest.serialization.Model): + """The response to the List Topics operation. + + :param value: Result of the List Topics operation. + :type value: list[~azure.mgmt.servicebus.v2015_08_01.models.TopicResource] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of topics. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TopicResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["TopicResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(TopicListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class TopicResource(Resource): + """Description of topic 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 + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :ivar accessed_at: Last time the message was sent, or a request was received, for this topic. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: TimeSpan idle interval after which the topic is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :param entity_availability_status: Entity availability status for the topic. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :param default_message_time_to_live: Default message time to live value. This is the duration + after which the message expires, starting from when the message is sent to Service Bus. This is + the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param duplicate_detection_history_time_window: TimeSpan structure that defines the duration of + the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: str + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param enable_express: Value that indicates whether Express Entities are enabled. An express + topic holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param enable_partitioning: Value that indicates whether the topic to be partitioned across + multiple message brokers is enabled. + :type enable_partitioning: bool + :param filtering_messages_before_publishing: Whether messages should be filtered before + publishing. + :type filtering_messages_before_publishing: bool + :param is_anonymous_accessible: Value that indicates whether the message is accessible + anonymously. + :type is_anonymous_accessible: bool + :param is_express: + :type is_express: bool + :param max_size_in_megabytes: Maximum size of the topic in megabytes, which is the size of the + memory allocated for the topic. + :type max_size_in_megabytes: long + :param requires_duplicate_detection: Value indicating if this topic requires duplicate + detection. + :type requires_duplicate_detection: bool + :ivar size_in_bytes: Size of the topic, in bytes. + :vartype size_in_bytes: long + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :ivar subscription_count: Number of subscriptions. + :vartype subscription_count: int + :param support_ordering: Value that indicates whether the topic supports ordering. + :type support_ordering: bool + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'created_at': {'readonly': True}, + 'count_details': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'subscription_count': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'filtering_messages_before_publishing': {'key': 'properties.filteringMessagesBeforePublishing', 'type': 'bool'}, + 'is_anonymous_accessible': {'key': 'properties.isAnonymousAccessible', 'type': 'bool'}, + 'is_express': {'key': 'properties.isExpress', 'type': 'bool'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'long'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + auto_delete_on_idle: Optional[str] = None, + entity_availability_status: Optional[Union[str, "EntityAvailabilityStatus"]] = None, + default_message_time_to_live: Optional[str] = None, + duplicate_detection_history_time_window: Optional[str] = None, + enable_batched_operations: Optional[bool] = None, + enable_express: Optional[bool] = None, + enable_partitioning: Optional[bool] = None, + filtering_messages_before_publishing: Optional[bool] = None, + is_anonymous_accessible: Optional[bool] = None, + is_express: Optional[bool] = None, + max_size_in_megabytes: Optional[int] = None, + requires_duplicate_detection: Optional[bool] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + support_ordering: Optional[bool] = None, + **kwargs + ): + super(TopicResource, self).__init__(location=location, **kwargs) + self.accessed_at = None + self.auto_delete_on_idle = auto_delete_on_idle + self.entity_availability_status = entity_availability_status + self.created_at = None + self.count_details = None + self.default_message_time_to_live = default_message_time_to_live + self.duplicate_detection_history_time_window = duplicate_detection_history_time_window + self.enable_batched_operations = enable_batched_operations + self.enable_express = enable_express + self.enable_partitioning = enable_partitioning + self.filtering_messages_before_publishing = filtering_messages_before_publishing + self.is_anonymous_accessible = is_anonymous_accessible + self.is_express = is_express + self.max_size_in_megabytes = max_size_in_megabytes + self.requires_duplicate_detection = requires_duplicate_detection + self.size_in_bytes = None + self.status = status + self.subscription_count = None + self.support_ordering = support_ordering + self.updated_at = None diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_service_bus_management_client_enums.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_service_bus_management_client_enums.py new file mode 100644 index 0000000000000..e6b495d5c78ac --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_service_bus_management_client_enums.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AccessRights(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + MANAGE = "Manage" + SEND = "Send" + LISTEN = "Listen" + +class EntityAvailabilityStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Entity availability status. + """ + + AVAILABLE = "Available" + LIMITED = "Limited" + RENAMING = "Renaming" + RESTORING = "Restoring" + UNKNOWN = "Unknown" + +class EntityStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Entity status. + """ + + ACTIVE = "Active" + CREATING = "Creating" + DELETING = "Deleting" + DISABLED = "Disabled" + RECEIVE_DISABLED = "ReceiveDisabled" + RENAMING = "Renaming" + RESTORING = "Restoring" + SEND_DISABLED = "SendDisabled" + UNKNOWN = "Unknown" + +class NamespaceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State of the namespace. + """ + + UNKNOWN = "Unknown" + CREATING = "Creating" + CREATED = "Created" + ACTIVATING = "Activating" + ENABLING = "Enabling" + ACTIVE = "Active" + DISABLING = "Disabling" + DISABLED = "Disabled" + SOFT_DELETING = "SoftDeleting" + SOFT_DELETED = "SoftDeleted" + REMOVING = "Removing" + REMOVED = "Removed" + FAILED = "Failed" + +class Policykey(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Key that needs to be regenerated. + """ + + PRIMARY_KEY = "PrimaryKey" + SECONDARY_KEY = "SecondaryKey" + +class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Name of this SKU. + """ + + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + +class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The billing tier of this particular SKU. + """ + + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + +class UnavailableReason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the reason for the unavailability of the service. + """ + + NONE = "None" + INVALID_NAME = "InvalidName" + SUBSCRIPTION_IS_DISABLED = "SubscriptionIsDisabled" + NAME_IN_USE = "NameInUse" + NAME_IN_LOCKDOWN = "NameInLockdown" + TOO_MANY_NAMESPACE_IN_CURRENT_SUBSCRIPTION = "TooManyNamespaceInCurrentSubscription" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/__init__.py new file mode 100644 index 0000000000000..7acd03e6343c4 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/__init__.py @@ -0,0 +1,21 @@ +# 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 ._operations import Operations +from ._namespaces_operations import NamespacesOperations +from ._queues_operations import QueuesOperations +from ._topics_operations import TopicsOperations +from ._subscriptions_operations import SubscriptionsOperations + +__all__ = [ + 'Operations', + 'NamespacesOperations', + 'QueuesOperations', + 'TopicsOperations', + 'SubscriptionsOperations', +] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_namespaces_operations.py new file mode 100644 index 0000000000000..c8d403dde987f --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_namespaces_operations.py @@ -0,0 +1,1019 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class NamespacesOperations(object): + """NamespacesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2015_08_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def check_name_availability( + self, + parameters, # type: "_models.CheckNameAvailability" + **kwargs # type: Any + ): + # type: (...) -> "_models.CheckNameAvailabilityResult" + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NamespaceListResult"] + """Gets all the available namespaces within the subscription, irrespective of the resource groups. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NamespaceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('NamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NamespaceListResult"] + """Gets the available namespaces within a resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NamespaceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('NamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.NamespaceCreateOrUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.NamespaceResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.NamespaceResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + 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'), + '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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NamespaceCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.NamespaceCreateOrUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.NamespaceResource"] + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + :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 parameters: Parameters supplied to create a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either NamespaceResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NamespaceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes an existing namespace. This operation also removes all associated resources under the + 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.NamespaceResource" + """Gets a description for the specified 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NamespaceResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NamespaceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.NamespaceUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.NamespaceResource"] + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :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 parameters: Parameters supplied to update a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NamespaceResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.NamespaceResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NamespaceUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SharedAccessAuthorizationRuleListResult"] + """Gets the authorization 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SharedAccessAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules'} # type: ignore + + def create_or_update_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.SharedAccessAuthorizationRuleCreateOrUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedAccessAuthorizationRuleResource" + """Creates or updates an authorization rule 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + def delete_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a namespace authorization rule. + + :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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + def get_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedAccessAuthorizationRuleResource" + """Gets an authorization rule 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceListKeys" + """Gets the primary and secondary connection strings for the 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys'} # type: ignore + + def regenerate_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.RegenerateKeysParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceListKeys" + """Regenerates the primary or secondary connection strings for the 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateKeysParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_operations.py new file mode 100644 index 0000000000000..5815ac6a02364 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_operations.py @@ -0,0 +1,109 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2015_08_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationListResult"] + """Lists all of the available ServiceBus REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.ServiceBus/operations'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_queues_operations.py new file mode 100644 index 0000000000000..8d2009db92b9e --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_queues_operations.py @@ -0,0 +1,805 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class QueuesOperations(object): + """QueuesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2015_08_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_all( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.QueueListResult"] + """Gets the queues within 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either QueueListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.QueueListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.QueueListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_all.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('QueueListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + parameters, # type: "_models.QueueCreateOrUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.QueueResource" + """Creates or updates a Service Bus queue. This operation is idempotent. + + :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 queue_name: The queue name. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.QueueCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QueueResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.QueueResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.QueueResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'QueueCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QueueResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a queue from the specified namespace in a resource group. + + :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 queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.QueueResource" + """Returns a description for the specified queue. + + :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 queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QueueResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.QueueResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.QueueResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QueueResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SharedAccessAuthorizationRuleListResult"] + """Gets all authorization rules for a queue. + + :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 queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SharedAccessAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules'} # type: ignore + + def create_or_update_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.SharedAccessAuthorizationRuleCreateOrUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedAccessAuthorizationRuleResource" + """Creates an authorization rule for a queue. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def post_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedAccessAuthorizationRuleResource" + """Gets an authorization rule for a queue 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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.post_authorization_rule.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def delete_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a queue authorization rule. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def get_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedAccessAuthorizationRuleResource" + """Gets an authorization rule for a queue 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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceListKeys" + """Primary and secondary connection strings to the queue. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + def regenerate_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.RegenerateKeysParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceListKeys" + """Regenerates the primary or secondary connection strings to the queue. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateKeysParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_subscriptions_operations.py new file mode 100644 index 0000000000000..b8ce3a8356e8e --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_subscriptions_operations.py @@ -0,0 +1,329 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionsOperations(object): + """SubscriptionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2015_08_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_all( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SubscriptionListResult"] + """List all the subscriptions under a specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SubscriptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_all.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SubscriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + parameters, # type: "_models.SubscriptionCreateOrUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.SubscriptionResource" + """Creates a topic subscription. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SubscriptionResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SubscriptionCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SubscriptionResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a subscription from the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SubscriptionResource" + """Returns a subscription description for the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SubscriptionResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SubscriptionResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_topics_operations.py new file mode 100644 index 0000000000000..32b70acb162bd --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_topics_operations.py @@ -0,0 +1,805 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class TopicsOperations(object): + """TopicsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2015_08_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_all( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.TopicListResult"] + """Gets all the topics in 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TopicListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.TopicListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TopicListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_all.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('TopicListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + parameters, # type: "_models.TopicCreateOrUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.TopicResource" + """Creates a topic in the specified 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 topic_name: The topic name. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.TopicCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopicResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.TopicResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TopicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'TopicCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TopicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a topic from the specified namespace and resource group. + + :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 topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TopicResource" + """Returns a description for the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopicResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.TopicResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TopicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TopicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SharedAccessAuthorizationRuleListResult"] + """Gets authorization rules for a topic. + + :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 topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SharedAccessAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules'} # type: ignore + + def create_or_update_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.SharedAccessAuthorizationRuleCreateOrUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedAccessAuthorizationRuleResource" + """Creates an authorization rule for the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def post_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedAccessAuthorizationRuleResource" + """Returns the specified authorization rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.post_authorization_rule.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def get_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedAccessAuthorizationRuleResource" + """Returns the specified authorization rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def delete_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a topic authorization rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceListKeys" + """Gets the primary and secondary connection strings for the topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + def regenerate_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.RegenerateKeysParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceListKeys" + """Regenerates primary or secondary connection strings for the topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateKeysParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/py.typed b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/py.typed new file mode 100644 index 0000000000000..e5aff4f83af86 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/__init__.py new file mode 100644 index 0000000000000..f640dac181bb7 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/__init__.py @@ -0,0 +1,16 @@ +# 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 ._service_bus_management_client import ServiceBusManagementClient +__all__ = ['ServiceBusManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_configuration.py new file mode 100644 index 0000000000000..dd6725ed87ece --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_configuration.py @@ -0,0 +1,70 @@ +# 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 typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class ServiceBusManagementClientConfiguration(Configuration): + """Configuration for ServiceBusManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2017-04-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_metadata.json b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_metadata.json new file mode 100644 index 0000000000000..f5b275a5417be --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_metadata.json @@ -0,0 +1,113 @@ +{ + "chosen_version": "2017-04-01", + "total_api_version_list": ["2017-04-01"], + "client": { + "name": "ServiceBusManagementClient", + "filename": "_service_bus_management_client", + "description": "Azure Service Bus client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "namespaces": "NamespacesOperations", + "queues": "QueuesOperations", + "topics": "TopicsOperations", + "disaster_recovery_configs": "DisasterRecoveryConfigsOperations", + "event_hubs": "EventHubsOperations", + "migration_configs": "MigrationConfigsOperations", + "operations": "Operations", + "premium_messaging_regions": "PremiumMessagingRegionsOperations", + "rules": "RulesOperations", + "regions": "RegionsOperations", + "subscriptions": "SubscriptionsOperations" + } +} \ No newline at end of file diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_service_bus_management_client.py new file mode 100644 index 0000000000000..21dce75ea7b88 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_service_bus_management_client.py @@ -0,0 +1,139 @@ +# 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 typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import ServiceBusManagementClientConfiguration +from .operations import NamespacesOperations +from .operations import QueuesOperations +from .operations import TopicsOperations +from .operations import DisasterRecoveryConfigsOperations +from .operations import EventHubsOperations +from .operations import MigrationConfigsOperations +from .operations import Operations +from .operations import PremiumMessagingRegionsOperations +from .operations import RulesOperations +from .operations import RegionsOperations +from .operations import SubscriptionsOperations +from . import models + + +class ServiceBusManagementClient(object): + """Azure Service Bus client. + + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: azure.mgmt.servicebus.v2017_04_01.operations.NamespacesOperations + :ivar queues: QueuesOperations operations + :vartype queues: azure.mgmt.servicebus.v2017_04_01.operations.QueuesOperations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.servicebus.v2017_04_01.operations.TopicsOperations + :ivar disaster_recovery_configs: DisasterRecoveryConfigsOperations operations + :vartype disaster_recovery_configs: azure.mgmt.servicebus.v2017_04_01.operations.DisasterRecoveryConfigsOperations + :ivar event_hubs: EventHubsOperations operations + :vartype event_hubs: azure.mgmt.servicebus.v2017_04_01.operations.EventHubsOperations + :ivar migration_configs: MigrationConfigsOperations operations + :vartype migration_configs: azure.mgmt.servicebus.v2017_04_01.operations.MigrationConfigsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.servicebus.v2017_04_01.operations.Operations + :ivar premium_messaging_regions: PremiumMessagingRegionsOperations operations + :vartype premium_messaging_regions: azure.mgmt.servicebus.v2017_04_01.operations.PremiumMessagingRegionsOperations + :ivar rules: RulesOperations operations + :vartype rules: azure.mgmt.servicebus.v2017_04_01.operations.RulesOperations + :ivar regions: RegionsOperations operations + :vartype regions: azure.mgmt.servicebus.v2017_04_01.operations.RegionsOperations + :ivar subscriptions: SubscriptionsOperations operations + :vartype subscriptions: azure.mgmt.servicebus.v2017_04_01.operations.SubscriptionsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = ServiceBusManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.namespaces = NamespacesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.queues = QueuesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.event_hubs = EventHubsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.migration_configs = MigrationConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.premium_messaging_regions = PremiumMessagingRegionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.regions = RegionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ServiceBusManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/__init__.py new file mode 100644 index 0000000000000..9016cbc217954 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/__init__.py @@ -0,0 +1,10 @@ +# 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 ._service_bus_management_client import ServiceBusManagementClient +__all__ = ['ServiceBusManagementClient'] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_configuration.py new file mode 100644 index 0000000000000..8ae5c045a4601 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class ServiceBusManagementClientConfiguration(Configuration): + """Configuration for ServiceBusManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2017-04-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_service_bus_management_client.py new file mode 100644 index 0000000000000..ecfea0af33bbb --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_service_bus_management_client.py @@ -0,0 +1,132 @@ +# 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 typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import ServiceBusManagementClientConfiguration +from .operations import NamespacesOperations +from .operations import QueuesOperations +from .operations import TopicsOperations +from .operations import DisasterRecoveryConfigsOperations +from .operations import EventHubsOperations +from .operations import MigrationConfigsOperations +from .operations import Operations +from .operations import PremiumMessagingRegionsOperations +from .operations import RulesOperations +from .operations import RegionsOperations +from .operations import SubscriptionsOperations +from .. import models + + +class ServiceBusManagementClient(object): + """Azure Service Bus client. + + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: azure.mgmt.servicebus.v2017_04_01.aio.operations.NamespacesOperations + :ivar queues: QueuesOperations operations + :vartype queues: azure.mgmt.servicebus.v2017_04_01.aio.operations.QueuesOperations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.servicebus.v2017_04_01.aio.operations.TopicsOperations + :ivar disaster_recovery_configs: DisasterRecoveryConfigsOperations operations + :vartype disaster_recovery_configs: azure.mgmt.servicebus.v2017_04_01.aio.operations.DisasterRecoveryConfigsOperations + :ivar event_hubs: EventHubsOperations operations + :vartype event_hubs: azure.mgmt.servicebus.v2017_04_01.aio.operations.EventHubsOperations + :ivar migration_configs: MigrationConfigsOperations operations + :vartype migration_configs: azure.mgmt.servicebus.v2017_04_01.aio.operations.MigrationConfigsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.servicebus.v2017_04_01.aio.operations.Operations + :ivar premium_messaging_regions: PremiumMessagingRegionsOperations operations + :vartype premium_messaging_regions: azure.mgmt.servicebus.v2017_04_01.aio.operations.PremiumMessagingRegionsOperations + :ivar rules: RulesOperations operations + :vartype rules: azure.mgmt.servicebus.v2017_04_01.aio.operations.RulesOperations + :ivar regions: RegionsOperations operations + :vartype regions: azure.mgmt.servicebus.v2017_04_01.aio.operations.RegionsOperations + :ivar subscriptions: SubscriptionsOperations operations + :vartype subscriptions: azure.mgmt.servicebus.v2017_04_01.aio.operations.SubscriptionsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = ServiceBusManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.namespaces = NamespacesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.queues = QueuesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.event_hubs = EventHubsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.migration_configs = MigrationConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.premium_messaging_regions = PremiumMessagingRegionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.regions = RegionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ServiceBusManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/__init__.py new file mode 100644 index 0000000000000..0a2e6926c1094 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/__init__.py @@ -0,0 +1,33 @@ +# 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 ._namespaces_operations import NamespacesOperations +from ._queues_operations import QueuesOperations +from ._topics_operations import TopicsOperations +from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations +from ._event_hubs_operations import EventHubsOperations +from ._migration_configs_operations import MigrationConfigsOperations +from ._operations import Operations +from ._premium_messaging_regions_operations import PremiumMessagingRegionsOperations +from ._rules_operations import RulesOperations +from ._regions_operations import RegionsOperations +from ._subscriptions_operations import SubscriptionsOperations + +__all__ = [ + 'NamespacesOperations', + 'QueuesOperations', + 'TopicsOperations', + 'DisasterRecoveryConfigsOperations', + 'EventHubsOperations', + 'MigrationConfigsOperations', + 'Operations', + 'PremiumMessagingRegionsOperations', + 'RulesOperations', + 'RegionsOperations', + 'SubscriptionsOperations', +] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_disaster_recovery_configs_operations.py new file mode 100644 index 0000000000000..b4b2633565f97 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_disaster_recovery_configs_operations.py @@ -0,0 +1,714 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DisasterRecoveryConfigsOperations: + """DisasterRecoveryConfigsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.CheckNameAvailability", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": + """Check the give namespace name availability. + + :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 parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability'} # type: ignore + + def list( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ArmDisasterRecoveryListResult"]: + """Gets all Alias(Disaster Recovery configurations). + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecoveryListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecoveryListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ArmDisasterRecoveryListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: "_models.ArmDisasterRecovery", + **kwargs: Any + ) -> Optional["_models.ArmDisasterRecovery"]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :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 alias: The Disaster Recovery configuration name. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ArmDisasterRecovery"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ArmDisasterRecovery') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> None: + """Deletes an Alias(Disaster Recovery configuration). + + :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 alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> "_models.ArmDisasterRecovery": + """Retrieves Alias(Disaster Recovery configuration) for primary or secondary 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 alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecovery"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + async def break_pairing( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> None: + """This operation disables the Disaster Recovery and stops replicating changes from primary to + secondary namespaces. + + :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 alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.break_pairing.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + break_pairing.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing'} # type: ignore + + async def fail_over( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary 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 alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.fail_over.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + fail_over.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets the authorization 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 alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Gets an authorization rule 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 alias: The Disaster Recovery configuration name. + :type alias: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Gets the primary and secondary connection strings for the 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 alias: The Disaster Recovery configuration name. + :type alias: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}/listKeys'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_event_hubs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_event_hubs_operations.py new file mode 100644 index 0000000000000..a1e0e4fd626d7 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_event_hubs_operations.py @@ -0,0 +1,117 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class EventHubsOperations: + """EventHubsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_namespace( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.EventHubListResult"]: + """Gets all the Event Hubs in a service bus 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventHubListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.EventHubListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EventHubListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/eventhubs'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_migration_configs_operations.py new file mode 100644 index 0000000000000..7d56babaabd9d --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_migration_configs_operations.py @@ -0,0 +1,499 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MigrationConfigsOperations: + """MigrationConfigsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.MigrationConfigListResult"]: + """Gets all migrationConfigurations. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MigrationConfigListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('MigrationConfigListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations'} # type: ignore + + async def _create_and_start_migration_initial( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + parameters: "_models.MigrationConfigProperties", + **kwargs: Any + ) -> Optional["_models.MigrationConfigProperties"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MigrationConfigProperties"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_and_start_migration_initial.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'MigrationConfigProperties') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_and_start_migration_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + parameters: "_models.MigrationConfigProperties", + **kwargs: Any + ) -> AsyncLROPoller["_models.MigrationConfigProperties"]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + 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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationConfigProperties or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigProperties"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_and_start_migration_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + config_name=config_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_and_start_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> None: + """Deletes a MigrationConfiguration. + + :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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> "_models.MigrationConfigProperties": + """Retrieves Migration Config. + + :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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigrationConfigProperties, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def complete_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> None: + """This operation Completes Migration of entities by pointing the connection strings to Premium + namespace and any entities created after the operation will be under Premium Namespace. + CompleteMigration operation will fail when entity migration is in-progress. + + :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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.complete_migration.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + complete_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade'} # type: ignore + + async def revert( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> None: + """This operation reverts Migration. + + :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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.revert.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + revert.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_namespaces_operations.py new file mode 100644 index 0000000000000..d5f3fa0e9e1d2 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_namespaces_operations.py @@ -0,0 +1,1282 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NamespacesOperations: + """NamespacesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets the authorization 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: "_models.SBAuthorizationRule", + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Creates or updates an authorization rule 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a namespace authorization rule. + + :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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Gets an authorization rule 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Gets the primary and secondary connection strings for the 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateAccessKeyParameters", + **kwargs: Any + ) -> "_models.AccessKeys": + """Regenerates the primary or secondary connection strings for the 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + async def check_name_availability( + self, + parameters: "_models.CheckNameAvailability", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability'} # type: ignore + + async def migrate( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.SBNamespaceMigrate", + **kwargs: Any + ) -> None: + """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 parameters: Parameters supplied to migrate namespace type. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceMigrate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.migrate.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespaceMigrate') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + migrate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrate'} # type: ignore + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.SBNamespaceListResult"]: + """Gets all the available namespaces within the subscription, irrespective of the resource groups. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBNamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBNamespaceListResult"]: + """Gets the available namespaces within a resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBNamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.SBNamespace", + **kwargs: Any + ) -> Optional["_models.SBNamespace"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SBNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + 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'), + '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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespace') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.SBNamespace", + **kwargs: Any + ) -> AsyncLROPoller["_models.SBNamespace"]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + :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 parameters: Parameters supplied to create a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SBNamespace or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespace"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing namespace. This operation also removes all associated resources under the + 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> "_models.SBNamespace": + """Gets a description for the specified 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.SBNamespaceUpdateParameters", + **kwargs: Any + ) -> Optional["_models.SBNamespace"]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :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 parameters: Parameters supplied to update a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SBNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespaceUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.NetworkRuleSet", + **kwargs: Any + ) -> "_models.NetworkRuleSet": + """Create or update NetworkRuleSet 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 parameters: The Namespace IpFilterRule. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_network_rule_set.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkRuleSet') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + async def get_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> "_models.NetworkRuleSet": + """Gets NetworkRuleSet 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get_network_rule_set.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + def list_network_rule_sets( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkRuleSetListResult"]: + """Gets list of NetworkRuleSet 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkRuleSetListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_network_rule_sets.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkRuleSetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_network_rule_sets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_operations.py new file mode 100644 index 0000000000000..169c562ac22c8 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_operations.py @@ -0,0 +1,105 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists all of the available ServiceBus REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.ServiceBus/operations'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_premium_messaging_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_premium_messaging_regions_operations.py new file mode 100644 index 0000000000000..dbb42428bfbc4 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_premium_messaging_regions_operations.py @@ -0,0 +1,109 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PremiumMessagingRegionsOperations: + """PremiumMessagingRegionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.PremiumMessagingRegionsListResult"]: + """Gets the available premium messaging regions for servicebus. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PremiumMessagingRegionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PremiumMessagingRegionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/premiumMessagingRegions'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_queues_operations.py new file mode 100644 index 0000000000000..b832d1386831e --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_queues_operations.py @@ -0,0 +1,750 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class QueuesOperations: + """QueuesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets all authorization rules for a queue. + + :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 queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: "_models.SBAuthorizationRule", + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Creates an authorization rule for a queue. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a queue authorization rule. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Gets an authorization rule for a queue 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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Primary and secondary connection strings to the queue. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateAccessKeyParameters", + **kwargs: Any + ) -> "_models.AccessKeys": + """Regenerates the primary or secondary connection strings to the queue. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def list_by_namespace( + self, + resource_group_name: str, + namespace_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SBQueueListResult"]: + """Gets the queues within 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 skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBQueueListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBQueueListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueueListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBQueueListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: "_models.SBQueue", + **kwargs: Any + ) -> "_models.SBQueue": + """Creates or updates a Service Bus queue. This operation is idempotent. + + :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 queue_name: The queue name. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBQueue') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> None: + """Deletes a queue from the specified namespace in a resource group. + + :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 queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> "_models.SBQueue": + """Returns a description for the specified queue. + + :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 queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_regions_operations.py new file mode 100644 index 0000000000000..a58e648745fdb --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_regions_operations.py @@ -0,0 +1,113 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RegionsOperations: + """RegionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_sku( + self, + sku: str, + **kwargs: Any + ) -> AsyncIterable["_models.PremiumMessagingRegionsListResult"]: + """Gets the available Regions for a given sku. + + :param sku: The sku type. + :type sku: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PremiumMessagingRegionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_sku.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'sku': self._serialize.url("sku", sku, 'str', max_length=50, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PremiumMessagingRegionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_sku.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/sku/{sku}/regions'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_rules_operations.py new file mode 100644 index 0000000000000..7e3556bb83504 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_rules_operations.py @@ -0,0 +1,355 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RulesOperations: + """RulesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_subscriptions( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.RuleListResult"]: + """List all the rules within given topic-subscription. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.RuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscriptions.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscriptions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: "_models.Rule", + **kwargs: Any + ) -> "_models.Rule": + """Creates a new rule and updates an existing rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.Rule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.Rule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Rule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Rule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + **kwargs: Any + ) -> None: + """Deletes an existing rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + **kwargs: Any + ) -> "_models.Rule": + """Retrieves the description for the specified rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.Rule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Rule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_subscriptions_operations.py new file mode 100644 index 0000000000000..57683192fad17 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_subscriptions_operations.py @@ -0,0 +1,339 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionsOperations: + """SubscriptionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_topic( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SBSubscriptionListResult"]: + """List all the subscriptions under a specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBSubscriptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBSubscriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_topic.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBSubscriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_topic.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: "_models.SBSubscription", + **kwargs: Any + ) -> "_models.SBSubscription": + """Creates a topic subscription. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBSubscription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + **kwargs: Any + ) -> None: + """Deletes a subscription from the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + **kwargs: Any + ) -> "_models.SBSubscription": + """Returns a subscription description for the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_topics_operations.py new file mode 100644 index 0000000000000..6bed7e1e9734f --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_topics_operations.py @@ -0,0 +1,750 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TopicsOperations: + """TopicsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets authorization rules for a topic. + + :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 topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: "_models.SBAuthorizationRule", + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Creates an authorization rule for the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Returns the specified authorization rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a topic authorization rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Gets the primary and secondary connection strings for the topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateAccessKeyParameters", + **kwargs: Any + ) -> "_models.AccessKeys": + """Regenerates primary or secondary connection strings for the topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def list_by_namespace( + self, + resource_group_name: str, + namespace_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SBTopicListResult"]: + """Gets all the topics in 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 skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBTopicListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBTopicListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopicListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBTopicListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: "_models.SBTopic", + **kwargs: Any + ) -> "_models.SBTopic": + """Creates a topic in the specified 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 topic_name: The topic name. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBTopic') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> None: + """Deletes a topic from the specified namespace and resource group. + + :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 topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> "_models.SBTopic": + """Returns a description for the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/__init__.py new file mode 100644 index 0000000000000..80f9a1628e4d6 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/__init__.py @@ -0,0 +1,191 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AccessKeys + from ._models_py3 import Action + from ._models_py3 import ArmDisasterRecovery + from ._models_py3 import ArmDisasterRecoveryListResult + from ._models_py3 import CaptureDescription + from ._models_py3 import CheckNameAvailability + from ._models_py3 import CheckNameAvailabilityResult + from ._models_py3 import CorrelationFilter + from ._models_py3 import Destination + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorResponse + from ._models_py3 import ErrorResponseError + from ._models_py3 import EventHubListResult + from ._models_py3 import Eventhub + from ._models_py3 import MessageCountDetails + from ._models_py3 import MigrationConfigListResult + from ._models_py3 import MigrationConfigProperties + from ._models_py3 import NWRuleSetIpRules + from ._models_py3 import NWRuleSetVirtualNetworkRules + from ._models_py3 import NetworkRuleSet + from ._models_py3 import NetworkRuleSetListResult + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult + from ._models_py3 import PremiumMessagingRegions + from ._models_py3 import PremiumMessagingRegionsListResult + from ._models_py3 import PremiumMessagingRegionsProperties + from ._models_py3 import RegenerateAccessKeyParameters + from ._models_py3 import Resource + from ._models_py3 import ResourceNamespacePatch + from ._models_py3 import Rule + from ._models_py3 import RuleListResult + from ._models_py3 import SBAuthorizationRule + from ._models_py3 import SBAuthorizationRuleListResult + from ._models_py3 import SBNamespace + from ._models_py3 import SBNamespaceListResult + from ._models_py3 import SBNamespaceMigrate + from ._models_py3 import SBNamespaceUpdateParameters + from ._models_py3 import SBQueue + from ._models_py3 import SBQueueListResult + from ._models_py3 import SBSku + from ._models_py3 import SBSubscription + from ._models_py3 import SBSubscriptionListResult + from ._models_py3 import SBTopic + from ._models_py3 import SBTopicListResult + from ._models_py3 import SqlFilter + from ._models_py3 import SqlRuleAction + from ._models_py3 import Subnet + from ._models_py3 import TrackedResource +except (SyntaxError, ImportError): + from ._models import AccessKeys # type: ignore + from ._models import Action # type: ignore + from ._models import ArmDisasterRecovery # type: ignore + from ._models import ArmDisasterRecoveryListResult # type: ignore + from ._models import CaptureDescription # type: ignore + from ._models import CheckNameAvailability # type: ignore + from ._models import CheckNameAvailabilityResult # type: ignore + from ._models import CorrelationFilter # type: ignore + from ._models import Destination # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import ErrorResponseError # type: ignore + from ._models import EventHubListResult # type: ignore + from ._models import Eventhub # type: ignore + from ._models import MessageCountDetails # type: ignore + from ._models import MigrationConfigListResult # type: ignore + from ._models import MigrationConfigProperties # type: ignore + from ._models import NWRuleSetIpRules # type: ignore + from ._models import NWRuleSetVirtualNetworkRules # type: ignore + from ._models import NetworkRuleSet # type: ignore + from ._models import NetworkRuleSetListResult # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import PremiumMessagingRegions # type: ignore + from ._models import PremiumMessagingRegionsListResult # type: ignore + from ._models import PremiumMessagingRegionsProperties # type: ignore + from ._models import RegenerateAccessKeyParameters # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceNamespacePatch # type: ignore + from ._models import Rule # type: ignore + from ._models import RuleListResult # type: ignore + from ._models import SBAuthorizationRule # type: ignore + from ._models import SBAuthorizationRuleListResult # type: ignore + from ._models import SBNamespace # type: ignore + from ._models import SBNamespaceListResult # type: ignore + from ._models import SBNamespaceMigrate # type: ignore + from ._models import SBNamespaceUpdateParameters # type: ignore + from ._models import SBQueue # type: ignore + from ._models import SBQueueListResult # type: ignore + from ._models import SBSku # type: ignore + from ._models import SBSubscription # type: ignore + from ._models import SBSubscriptionListResult # type: ignore + from ._models import SBTopic # type: ignore + from ._models import SBTopicListResult # type: ignore + from ._models import SqlFilter # type: ignore + from ._models import SqlRuleAction # type: ignore + from ._models import Subnet # type: ignore + from ._models import TrackedResource # type: ignore + +from ._service_bus_management_client_enums import ( + AccessRights, + DefaultAction, + EncodingCaptureDescription, + EntityStatus, + FilterType, + KeyType, + MigrationConfigurationName, + NameSpaceType, + NetworkRuleIPAction, + ProvisioningStateDR, + RoleDisasterRecovery, + SkuName, + SkuTier, + UnavailableReason, +) + +__all__ = [ + 'AccessKeys', + 'Action', + 'ArmDisasterRecovery', + 'ArmDisasterRecoveryListResult', + 'CaptureDescription', + 'CheckNameAvailability', + 'CheckNameAvailabilityResult', + 'CorrelationFilter', + 'Destination', + 'ErrorAdditionalInfo', + 'ErrorResponse', + 'ErrorResponseError', + 'EventHubListResult', + 'Eventhub', + 'MessageCountDetails', + 'MigrationConfigListResult', + 'MigrationConfigProperties', + 'NWRuleSetIpRules', + 'NWRuleSetVirtualNetworkRules', + 'NetworkRuleSet', + 'NetworkRuleSetListResult', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'PremiumMessagingRegions', + 'PremiumMessagingRegionsListResult', + 'PremiumMessagingRegionsProperties', + 'RegenerateAccessKeyParameters', + 'Resource', + 'ResourceNamespacePatch', + 'Rule', + 'RuleListResult', + 'SBAuthorizationRule', + 'SBAuthorizationRuleListResult', + 'SBNamespace', + 'SBNamespaceListResult', + 'SBNamespaceMigrate', + 'SBNamespaceUpdateParameters', + 'SBQueue', + 'SBQueueListResult', + 'SBSku', + 'SBSubscription', + 'SBSubscriptionListResult', + 'SBTopic', + 'SBTopicListResult', + 'SqlFilter', + 'SqlRuleAction', + 'Subnet', + 'TrackedResource', + 'AccessRights', + 'DefaultAction', + 'EncodingCaptureDescription', + 'EntityStatus', + 'FilterType', + 'KeyType', + 'MigrationConfigurationName', + 'NameSpaceType', + 'NetworkRuleIPAction', + 'ProvisioningStateDR', + 'RoleDisasterRecovery', + 'SkuName', + 'SkuTier', + 'UnavailableReason', +] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_models.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_models.py new file mode 100644 index 0000000000000..9d8d819f83a48 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_models.py @@ -0,0 +1,2057 @@ +# 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 azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class AccessKeys(msrest.serialization.Model): + """Namespace/ServiceBus Connection String. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar primary_connection_string: Primary connection string of the created namespace + authorization rule. + :vartype primary_connection_string: str + :ivar secondary_connection_string: Secondary connection string of the created namespace + authorization rule. + :vartype secondary_connection_string: str + :ivar alias_primary_connection_string: Primary connection string of the alias if GEO DR is + enabled. + :vartype alias_primary_connection_string: str + :ivar alias_secondary_connection_string: Secondary connection string of the alias if GEO DR is + enabled. + :vartype alias_secondary_connection_string: str + :ivar primary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :vartype primary_key: str + :ivar secondary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :vartype secondary_key: str + :ivar key_name: A string that describes the authorization rule. + :vartype key_name: str + """ + + _validation = { + 'primary_connection_string': {'readonly': True}, + 'secondary_connection_string': {'readonly': True}, + 'alias_primary_connection_string': {'readonly': True}, + 'alias_secondary_connection_string': {'readonly': True}, + 'primary_key': {'readonly': True}, + 'secondary_key': {'readonly': True}, + 'key_name': {'readonly': True}, + } + + _attribute_map = { + 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, + 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, + 'alias_primary_connection_string': {'key': 'aliasPrimaryConnectionString', 'type': 'str'}, + 'alias_secondary_connection_string': {'key': 'aliasSecondaryConnectionString', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'key_name': {'key': 'keyName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AccessKeys, self).__init__(**kwargs) + self.primary_connection_string = None + self.secondary_connection_string = None + self.alias_primary_connection_string = None + self.alias_secondary_connection_string = None + self.primary_key = None + self.secondary_key = None + self.key_name = None + + +class Action(msrest.serialization.Model): + """Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. + + :param sql_expression: SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(Action, self).__init__(**kwargs) + self.sql_expression = kwargs.get('sql_expression', None) + self.compatibility_level = kwargs.get('compatibility_level', None) + self.requires_preprocessing = kwargs.get('requires_preprocessing', True) + + +class Resource(msrest.serialization.Model): + """The Resource definition for other than namespace. + + 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 + """ + + _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'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ArmDisasterRecovery(Resource): + """Single item in List or Get Alias(Disaster Recovery configuration) 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 + :ivar provisioning_state: Provisioning state of the Alias(Disaster Recovery configuration) - + possible values 'Accepted' or 'Succeeded' or 'Failed'. Possible values include: "Accepted", + "Succeeded", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.servicebus.v2017_04_01.models.ProvisioningStateDR + :ivar pending_replication_operations_count: Number of entities pending to be replicated. + :vartype pending_replication_operations_count: long + :param partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is + part of GEO DR pairing. + :type partner_namespace: str + :param alternate_name: Primary/Secondary eventhub namespace name, which is part of GEO DR + pairing. + :type alternate_name: str + :ivar role: role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' + or 'Secondary'. Possible values include: "Primary", "PrimaryNotReplicating", "Secondary". + :vartype role: str or ~azure.mgmt.servicebus.v2017_04_01.models.RoleDisasterRecovery + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'pending_replication_operations_count': {'readonly': True}, + 'role': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, + 'partner_namespace': {'key': 'properties.partnerNamespace', 'type': 'str'}, + 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, + 'role': {'key': 'properties.role', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ArmDisasterRecovery, self).__init__(**kwargs) + self.provisioning_state = None + self.pending_replication_operations_count = None + self.partner_namespace = kwargs.get('partner_namespace', None) + self.alternate_name = kwargs.get('alternate_name', None) + self.role = None + + +class ArmDisasterRecoveryListResult(msrest.serialization.Model): + """The result of the List Alias(Disaster Recovery configuration) operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Alias(Disaster Recovery configurations). + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Alias(Disaster Recovery configuration). + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ArmDisasterRecovery]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ArmDisasterRecoveryListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class CaptureDescription(msrest.serialization.Model): + """Properties to configure capture description for eventhub. + + :param enabled: A value that indicates whether capture description is enabled. + :type enabled: bool + :param encoding: Enumerates the possible values for the encoding format of capture description. + Possible values include: "Avro", "AvroDeflate". + :type encoding: str or ~azure.mgmt.servicebus.v2017_04_01.models.EncodingCaptureDescription + :param interval_in_seconds: The time window allows you to set the frequency with which the + capture to Azure Blobs will happen, value should between 60 to 900 seconds. + :type interval_in_seconds: int + :param size_limit_in_bytes: The size window defines the amount of data built up in your Event + Hub before an capture operation, value should be between 10485760 and 524288000 bytes. + :type size_limit_in_bytes: int + :param destination: Properties of Destination where capture will be stored. (Storage Account, + Blob Names). + :type destination: ~azure.mgmt.servicebus.v2017_04_01.models.Destination + """ + + _validation = { + 'interval_in_seconds': {'maximum': 900, 'minimum': 60}, + 'size_limit_in_bytes': {'maximum': 524288000, 'minimum': 10485760}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'encoding': {'key': 'encoding', 'type': 'str'}, + 'interval_in_seconds': {'key': 'intervalInSeconds', 'type': 'int'}, + 'size_limit_in_bytes': {'key': 'sizeLimitInBytes', 'type': 'int'}, + 'destination': {'key': 'destination', 'type': 'Destination'}, + } + + def __init__( + self, + **kwargs + ): + super(CaptureDescription, self).__init__(**kwargs) + self.enabled = kwargs.get('enabled', None) + self.encoding = kwargs.get('encoding', None) + self.interval_in_seconds = kwargs.get('interval_in_seconds', None) + self.size_limit_in_bytes = kwargs.get('size_limit_in_bytes', None) + self.destination = kwargs.get('destination', None) + + +class CheckNameAvailability(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The Name to check the namespace name availability and The namespace name + can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it + must end with a letter or number. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailability, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class CheckNameAvailabilityResult(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar message: The detailed info regarding the reason associated with the namespace. + :vartype message: str + :param name_available: Value indicating namespace is availability, true if the namespace is + available; otherwise, false. + :type name_available: bool + :param reason: The reason for unavailability of a namespace. Possible values include: "None", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "TooManyNamespaceInCurrentSubscription". + :type reason: str or ~azure.mgmt.servicebus.v2017_04_01.models.UnavailableReason + """ + + _validation = { + 'message': {'readonly': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.message = None + self.name_available = kwargs.get('name_available', None) + self.reason = kwargs.get('reason', None) + + +class CorrelationFilter(msrest.serialization.Model): + """Represents the correlation filter expression. + + :param properties: dictionary object for custom filters. + :type properties: dict[str, str] + :param correlation_id: Identifier of the correlation. + :type correlation_id: str + :param message_id: Identifier of the message. + :type message_id: str + :param to: Address to send to. + :type to: str + :param reply_to: Address of the queue to reply to. + :type reply_to: str + :param label: Application specific label. + :type label: str + :param session_id: Session identifier. + :type session_id: str + :param reply_to_session_id: Session identifier to reply to. + :type reply_to_session_id: str + :param content_type: Content type of the message. + :type content_type: str + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': '{str}'}, + 'correlation_id': {'key': 'correlationId', 'type': 'str'}, + 'message_id': {'key': 'messageId', 'type': 'str'}, + 'to': {'key': 'to', 'type': 'str'}, + 'reply_to': {'key': 'replyTo', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'session_id': {'key': 'sessionId', 'type': 'str'}, + 'reply_to_session_id': {'key': 'replyToSessionId', 'type': 'str'}, + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(CorrelationFilter, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.correlation_id = kwargs.get('correlation_id', None) + self.message_id = kwargs.get('message_id', None) + self.to = kwargs.get('to', None) + self.reply_to = kwargs.get('reply_to', None) + self.label = kwargs.get('label', None) + self.session_id = kwargs.get('session_id', None) + self.reply_to_session_id = kwargs.get('reply_to_session_id', None) + self.content_type = kwargs.get('content_type', None) + self.requires_preprocessing = kwargs.get('requires_preprocessing', True) + + +class Destination(msrest.serialization.Model): + """Capture storage details for capture description. + + :param name: Name for capture destination. + :type name: str + :param storage_account_resource_id: Resource id of the storage account to be used to create the + blobs. + :type storage_account_resource_id: str + :param blob_container: Blob container Name. + :type blob_container: str + :param archive_name_format: Blob naming convention for archive, e.g. + {Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}. Here all + the parameters (Namespace,EventHub .. etc) are mandatory irrespective of order. + :type archive_name_format: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'storage_account_resource_id': {'key': 'properties.storageAccountResourceId', 'type': 'str'}, + 'blob_container': {'key': 'properties.blobContainer', 'type': 'str'}, + 'archive_name_format': {'key': 'properties.archiveNameFormat', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Destination, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.storage_account_resource_id = kwargs.get('storage_account_resource_id', None) + self.blob_container = kwargs.get('blob_container', None) + self.archive_name_format = kwargs.get('archive_name_format', None) + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """The resource management error response. + + :param error: The error object. + :type error: ~azure.mgmt.servicebus.v2017_04_01.models.ErrorResponseError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseError(msrest.serialization.Model): + """The error object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.servicebus.v2017_04_01.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.servicebus.v2017_04_01.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseError, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class Eventhub(Resource): + """Single item in List or Get Event Hub 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 + :ivar partition_ids: Current number of shards on the Event Hub. + :vartype partition_ids: list[str] + :ivar created_at: Exact time the Event Hub was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :param message_retention_in_days: Number of days to retain the events for this Event Hub, value + should be 1 to 7 days. + :type message_retention_in_days: long + :param partition_count: Number of partitions created for the Event Hub, allowed values are from + 1 to 32 partitions. + :type partition_count: long + :param status: Enumerates the possible values for the status of a Event Hub. Possible values + include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", + "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus + :param capture_description: Properties of capture description. + :type capture_description: ~azure.mgmt.servicebus.v2017_04_01.models.CaptureDescription + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'partition_ids': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'message_retention_in_days': {'maximum': 7, 'minimum': 1}, + 'partition_count': {'maximum': 32, 'minimum': 1}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'partition_ids': {'key': 'properties.partitionIds', 'type': '[str]'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'message_retention_in_days': {'key': 'properties.messageRetentionInDays', 'type': 'long'}, + 'partition_count': {'key': 'properties.partitionCount', 'type': 'long'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'capture_description': {'key': 'properties.captureDescription', 'type': 'CaptureDescription'}, + } + + def __init__( + self, + **kwargs + ): + super(Eventhub, self).__init__(**kwargs) + self.partition_ids = None + self.created_at = None + self.updated_at = None + self.message_retention_in_days = kwargs.get('message_retention_in_days', None) + self.partition_count = kwargs.get('partition_count', None) + self.status = kwargs.get('status', None) + self.capture_description = kwargs.get('capture_description', None) + + +class EventHubListResult(msrest.serialization.Model): + """The result of the List EventHubs operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: Result of the List EventHubs operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.Eventhub] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of EventHubs. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Eventhub]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventHubListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class MessageCountDetails(msrest.serialization.Model): + """Message Count Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar active_message_count: Number of active messages in the queue, topic, or subscription. + :vartype active_message_count: long + :ivar dead_letter_message_count: Number of messages that are dead lettered. + :vartype dead_letter_message_count: long + :ivar scheduled_message_count: Number of scheduled messages. + :vartype scheduled_message_count: long + :ivar transfer_message_count: Number of messages transferred to another queue, topic, or + subscription. + :vartype transfer_message_count: long + :ivar transfer_dead_letter_message_count: Number of messages transferred into dead letters. + :vartype transfer_dead_letter_message_count: long + """ + + _validation = { + 'active_message_count': {'readonly': True}, + 'dead_letter_message_count': {'readonly': True}, + 'scheduled_message_count': {'readonly': True}, + 'transfer_message_count': {'readonly': True}, + 'transfer_dead_letter_message_count': {'readonly': True}, + } + + _attribute_map = { + 'active_message_count': {'key': 'activeMessageCount', 'type': 'long'}, + 'dead_letter_message_count': {'key': 'deadLetterMessageCount', 'type': 'long'}, + 'scheduled_message_count': {'key': 'scheduledMessageCount', 'type': 'long'}, + 'transfer_message_count': {'key': 'transferMessageCount', 'type': 'long'}, + 'transfer_dead_letter_message_count': {'key': 'transferDeadLetterMessageCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(MessageCountDetails, self).__init__(**kwargs) + self.active_message_count = None + self.dead_letter_message_count = None + self.scheduled_message_count = None + self.transfer_message_count = None + self.transfer_dead_letter_message_count = None + + +class MigrationConfigListResult(msrest.serialization.Model): + """The result of the List migrationConfigurations operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Migration Configs. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of migrationConfigurations. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MigrationConfigProperties]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrationConfigListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class MigrationConfigProperties(Resource): + """Single item in List or Get Migration Config 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 + :ivar provisioning_state: Provisioning state of Migration Configuration. + :vartype provisioning_state: str + :ivar pending_replication_operations_count: Number of entities pending to be replicated. + :vartype pending_replication_operations_count: long + :param target_namespace: Existing premium Namespace ARM Id name which has no entities, will be + used for migration. + :type target_namespace: str + :param post_migration_name: Name to access Standard Namespace after migration. + :type post_migration_name: str + :ivar migration_state: State in which Standard to Premium Migration is, possible values : + Unknown, Reverting, Completing, Initiating, Syncing, Active. + :vartype migration_state: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'pending_replication_operations_count': {'readonly': True}, + 'migration_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, + 'target_namespace': {'key': 'properties.targetNamespace', 'type': 'str'}, + 'post_migration_name': {'key': 'properties.postMigrationName', 'type': 'str'}, + 'migration_state': {'key': 'properties.migrationState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrationConfigProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.pending_replication_operations_count = None + self.target_namespace = kwargs.get('target_namespace', None) + self.post_migration_name = kwargs.get('post_migration_name', None) + self.migration_state = None + + +class NetworkRuleSet(Resource): + """Description of NetworkRuleSet 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 default_action: Default Action for Network Rule Set. Possible values include: "Allow", + "Deny". + :type default_action: str or ~azure.mgmt.servicebus.v2017_04_01.models.DefaultAction + :param virtual_network_rules: List VirtualNetwork Rules. + :type virtual_network_rules: + list[~azure.mgmt.servicebus.v2017_04_01.models.NWRuleSetVirtualNetworkRules] + :param ip_rules: List of IpRules. + :type ip_rules: list[~azure.mgmt.servicebus.v2017_04_01.models.NWRuleSetIpRules] + """ + + _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'}, + 'default_action': {'key': 'properties.defaultAction', 'type': 'str'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[NWRuleSetVirtualNetworkRules]'}, + 'ip_rules': {'key': 'properties.ipRules', 'type': '[NWRuleSetIpRules]'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkRuleSet, self).__init__(**kwargs) + self.default_action = kwargs.get('default_action', None) + self.virtual_network_rules = kwargs.get('virtual_network_rules', None) + self.ip_rules = kwargs.get('ip_rules', None) + + +class NetworkRuleSetListResult(msrest.serialization.Model): + """The response of the List NetworkRuleSet operation. + + :param value: Result of the List NetworkRuleSet operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of NetworkRuleSet. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkRuleSet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkRuleSetListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class NWRuleSetIpRules(msrest.serialization.Model): + """Description of NetWorkRuleSet - IpRules resource. + + :param ip_mask: IP Mask. + :type ip_mask: str + :param action: The IP Filter Action. Possible values include: "Allow". Default value: "Allow". + :type action: str or ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleIPAction + """ + + _attribute_map = { + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NWRuleSetIpRules, self).__init__(**kwargs) + self.ip_mask = kwargs.get('ip_mask', None) + self.action = kwargs.get('action', "Allow") + + +class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): + """Description of VirtualNetworkRules - NetworkRules resource. + + :param subnet: Subnet properties. + :type subnet: ~azure.mgmt.servicebus.v2017_04_01.models.Subnet + :param ignore_missing_vnet_service_endpoint: Value that indicates whether to ignore missing + VNet Service Endpoint. + :type ignore_missing_vnet_service_endpoint: bool + """ + + _attribute_map = { + 'subnet': {'key': 'subnet', 'type': 'Subnet'}, + 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(NWRuleSetVirtualNetworkRules, self).__init__(**kwargs) + self.subnet = kwargs.get('subnet', None) + self.ignore_missing_vnet_service_endpoint = kwargs.get('ignore_missing_vnet_service_endpoint', None) + + +class Operation(msrest.serialization.Model): + """A ServiceBus REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.servicebus.v2017_04_01.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = kwargs.get('display', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft.ServiceBus. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Invoice, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list ServiceBus operations. It contains a list of operations and a URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of ServiceBus operations supported by the Microsoft.ServiceBus resource + provider. + :vartype value: list[~azure.mgmt.servicebus.v2017_04_01.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class ResourceNamespacePatch(Resource): + """The Resource definition. + + 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: A set of tags. Resource tags. + :type tags: dict[str, 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}'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceNamespacePatch, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class PremiumMessagingRegions(ResourceNamespacePatch): + """Premium Messaging Region. + + 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: A set of tags. Resource tags. + :type tags: dict[str, str] + :param properties: + :type properties: ~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegionsProperties + """ + + _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}'}, + 'properties': {'key': 'properties', 'type': 'PremiumMessagingRegionsProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(PremiumMessagingRegions, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class PremiumMessagingRegionsListResult(msrest.serialization.Model): + """The response of the List PremiumMessagingRegions operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: Result of the List PremiumMessagingRegions type. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegions] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of PremiumMessagingRegions. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PremiumMessagingRegions]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PremiumMessagingRegionsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class PremiumMessagingRegionsProperties(msrest.serialization.Model): + """PremiumMessagingRegionsProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Region code. + :vartype code: str + :ivar full_name: Full name of the region. + :vartype full_name: str + """ + + _validation = { + 'code': {'readonly': True}, + 'full_name': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'full_name': {'key': 'fullName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PremiumMessagingRegionsProperties, self).__init__(**kwargs) + self.code = None + self.full_name = None + + +class RegenerateAccessKeyParameters(msrest.serialization.Model): + """Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs to be reset. + + All required parameters must be populated in order to send to Azure. + + :param key_type: Required. The access key to regenerate. Possible values include: "PrimaryKey", + "SecondaryKey". + :type key_type: str or ~azure.mgmt.servicebus.v2017_04_01.models.KeyType + :param key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key + value set for keyType. + :type key: str + """ + + _validation = { + 'key_type': {'required': True}, + } + + _attribute_map = { + 'key_type': {'key': 'keyType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RegenerateAccessKeyParameters, self).__init__(**kwargs) + self.key_type = kwargs['key_type'] + self.key = kwargs.get('key', None) + + +class Rule(Resource): + """Description of Rule 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 action: Represents the filter actions which are allowed for the transformation of a + message that have been matched by a filter expression. + :type action: ~azure.mgmt.servicebus.v2017_04_01.models.Action + :param filter_type: Filter type that is evaluated against a BrokeredMessage. Possible values + include: "SqlFilter", "CorrelationFilter". + :type filter_type: str or ~azure.mgmt.servicebus.v2017_04_01.models.FilterType + :param sql_filter: Properties of sqlFilter. + :type sql_filter: ~azure.mgmt.servicebus.v2017_04_01.models.SqlFilter + :param correlation_filter: Properties of correlationFilter. + :type correlation_filter: ~azure.mgmt.servicebus.v2017_04_01.models.CorrelationFilter + """ + + _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'}, + 'action': {'key': 'properties.action', 'type': 'Action'}, + 'filter_type': {'key': 'properties.filterType', 'type': 'str'}, + 'sql_filter': {'key': 'properties.sqlFilter', 'type': 'SqlFilter'}, + 'correlation_filter': {'key': 'properties.correlationFilter', 'type': 'CorrelationFilter'}, + } + + def __init__( + self, + **kwargs + ): + super(Rule, self).__init__(**kwargs) + self.action = kwargs.get('action', None) + self.filter_type = kwargs.get('filter_type', None) + self.sql_filter = kwargs.get('sql_filter', None) + self.correlation_filter = kwargs.get('correlation_filter', None) + + +class RuleListResult(msrest.serialization.Model): + """The response of the List rule operation. + + :param value: Result of the List Rules operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.Rule] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of rules. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Rule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RuleListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SBAuthorizationRule(Resource): + """Description of a namespace authorization rule. + + 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 rights: The rights associated with the rule. + :type rights: list[str or ~azure.mgmt.servicebus.v2017_04_01.models.AccessRights] + """ + + _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'}, + 'rights': {'key': 'properties.rights', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(SBAuthorizationRule, self).__init__(**kwargs) + self.rights = kwargs.get('rights', None) + + +class SBAuthorizationRuleListResult(msrest.serialization.Model): + """The response to the List Namespace operation. + + :param value: Result of the List Authorization Rules operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Authorization Rules. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBAuthorizationRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class TrackedResource(Resource): + """The Resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. The Geo-location where the resource lives. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': 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}'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) + + +class SBNamespace(TrackedResource): + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. The Geo-location where the resource lives. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Properties of Sku. + :type sku: ~azure.mgmt.servicebus.v2017_04_01.models.SBSku + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :ivar metric_id: Identifier for Azure Insights metrics. + :vartype metric_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + 'metric_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SBSku'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBNamespace, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.provisioning_state = None + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.metric_id = None + + +class SBNamespaceListResult(msrest.serialization.Model): + """The response of the List Namespace operation. + + :param value: Result of the List Namespace operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Namespaces. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBNamespace]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBNamespaceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SBNamespaceMigrate(msrest.serialization.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.v2017_04_01.models.NameSpaceType + """ + + _validation = { + 'target_namespace_type': {'required': True}, + } + + _attribute_map = { + 'target_namespace_type': {'key': 'targetNamespaceType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBNamespaceMigrate, self).__init__(**kwargs) + self.target_namespace_type = kwargs['target_namespace_type'] + + +class SBNamespaceUpdateParameters(ResourceNamespacePatch): + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Properties of Sku. + :type sku: ~azure.mgmt.servicebus.v2017_04_01.models.SBSku + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :ivar metric_id: Identifier for Azure Insights metrics. + :vartype metric_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + 'metric_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SBSku'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBNamespaceUpdateParameters, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.provisioning_state = None + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.metric_id = None + + +class SBQueue(Resource): + """Description of queue 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 + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2017_04_01.models.MessageCountDetails + :ivar created_at: The exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar accessed_at: Last time a message was sent, or the last time there was a receive request + to this queue. + :vartype accessed_at: ~datetime.datetime + :ivar size_in_bytes: The size of the queue, in bytes. + :vartype size_in_bytes: long + :ivar message_count: The number of messages in the queue. + :vartype message_count: long + :param lock_duration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time + that the message is locked for other receivers. The maximum value for LockDuration is 5 + minutes; the default value is 1 minute. + :type lock_duration: ~datetime.timedelta + :param max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size of + memory allocated for the queue. Default is 1024. + :type max_size_in_megabytes: int + :param requires_duplicate_detection: A value indicating if this queue requires duplicate + detection. + :type requires_duplicate_detection: bool + :param requires_session: A value that indicates whether the queue supports the concept of + sessions. + :type requires_session: bool + :param default_message_time_to_live: ISO 8601 default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param dead_lettering_on_message_expiration: A value that indicates whether this queue has dead + letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param duplicate_detection_history_time_window: ISO 8601 timeSpan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param max_delivery_count: The maximum delivery count. A message is automatically deadlettered + after this number of deliveries. default value is 10. + :type max_delivery_count: int + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param auto_delete_on_idle: ISO 8061 timeSpan idle interval after which the queue is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param enable_partitioning: A value that indicates whether the queue is to be partitioned + across multiple message brokers. + :type enable_partitioning: bool + :param enable_express: A value that indicates whether Express Entities are enabled. An express + queue holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param forward_to: Queue/Topic name to forward the messages. + :type forward_to: str + :param forward_dead_lettered_messages_to: Queue/Topic name to forward the Dead Letter message. + :type forward_dead_lettered_messages_to: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'count_details': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'message_count': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, + 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBQueue, self).__init__(**kwargs) + self.count_details = None + self.created_at = None + self.updated_at = None + self.accessed_at = None + self.size_in_bytes = None + self.message_count = None + self.lock_duration = kwargs.get('lock_duration', None) + self.max_size_in_megabytes = kwargs.get('max_size_in_megabytes', None) + self.requires_duplicate_detection = kwargs.get('requires_duplicate_detection', None) + self.requires_session = kwargs.get('requires_session', None) + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.dead_lettering_on_message_expiration = kwargs.get('dead_lettering_on_message_expiration', None) + self.duplicate_detection_history_time_window = kwargs.get('duplicate_detection_history_time_window', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + self.status = kwargs.get('status', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.enable_partitioning = kwargs.get('enable_partitioning', None) + self.enable_express = kwargs.get('enable_express', None) + self.forward_to = kwargs.get('forward_to', None) + self.forward_dead_lettered_messages_to = kwargs.get('forward_dead_lettered_messages_to', None) + + +class SBQueueListResult(msrest.serialization.Model): + """The response to the List Queues operation. + + :param value: Result of the List Queues operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBQueue] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of queues. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBQueue]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBQueueListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SBSku(msrest.serialization.Model): + """SKU of the namespace. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of this SKU. Possible values include: "Basic", "Standard", + "Premium". + :type name: str or ~azure.mgmt.servicebus.v2017_04_01.models.SkuName + :param tier: The billing tier of this particular SKU. Possible values include: "Basic", + "Standard", "Premium". + :type tier: str or ~azure.mgmt.servicebus.v2017_04_01.models.SkuTier + :param capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 + and 4. + :type capacity: int + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(SBSku, self).__init__(**kwargs) + self.name = kwargs['name'] + self.tier = kwargs.get('tier', None) + self.capacity = kwargs.get('capacity', None) + + +class SBSubscription(Resource): + """Description of subscription 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 + :ivar message_count: Number of messages. + :vartype message_count: long + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar accessed_at: Last time there was a receive request to this subscription. + :vartype accessed_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar count_details: Message count details. + :vartype count_details: ~azure.mgmt.servicebus.v2017_04_01.models.MessageCountDetails + :param lock_duration: ISO 8061 lock duration timespan for the subscription. The default value + is 1 minute. + :type lock_duration: ~datetime.timedelta + :param requires_session: Value indicating if a subscription supports the concept of sessions. + :type requires_session: bool + :param default_message_time_to_live: ISO 8061 Default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param dead_lettering_on_filter_evaluation_exceptions: Value that indicates whether a + subscription has dead letter support on filter evaluation exceptions. + :type dead_lettering_on_filter_evaluation_exceptions: bool + :param dead_lettering_on_message_expiration: Value that indicates whether a subscription has + dead letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param duplicate_detection_history_time_window: ISO 8601 timeSpan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param max_delivery_count: Number of maximum deliveries. + :type max_delivery_count: int + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param auto_delete_on_idle: ISO 8061 timeSpan idle interval after which the topic is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param forward_to: Queue/Topic name to forward the messages. + :type forward_to: str + :param forward_dead_lettered_messages_to: Queue/Topic name to forward the Dead Letter message. + :type forward_dead_lettered_messages_to: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'message_count': {'readonly': True}, + 'created_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'count_details': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, + 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBSubscription, self).__init__(**kwargs) + self.message_count = None + self.created_at = None + self.accessed_at = None + self.updated_at = None + self.count_details = None + self.lock_duration = kwargs.get('lock_duration', None) + self.requires_session = kwargs.get('requires_session', None) + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.dead_lettering_on_filter_evaluation_exceptions = kwargs.get('dead_lettering_on_filter_evaluation_exceptions', None) + self.dead_lettering_on_message_expiration = kwargs.get('dead_lettering_on_message_expiration', None) + self.duplicate_detection_history_time_window = kwargs.get('duplicate_detection_history_time_window', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + self.status = kwargs.get('status', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.forward_to = kwargs.get('forward_to', None) + self.forward_dead_lettered_messages_to = kwargs.get('forward_dead_lettered_messages_to', None) + + +class SBSubscriptionListResult(msrest.serialization.Model): + """The response to the List Subscriptions operation. + + :param value: Result of the List Subscriptions operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of subscriptions. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBSubscription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBSubscriptionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SBTopic(Resource): + """Description of topic 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 + :ivar size_in_bytes: Size of the topic, in bytes. + :vartype size_in_bytes: long + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar accessed_at: Last time the message was sent, or a request was received, for this topic. + :vartype accessed_at: ~datetime.datetime + :ivar subscription_count: Number of subscriptions. + :vartype subscription_count: int + :ivar count_details: Message count details. + :vartype count_details: ~azure.mgmt.servicebus.v2017_04_01.models.MessageCountDetails + :param default_message_time_to_live: ISO 8601 Default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param max_size_in_megabytes: Maximum size of the topic in megabytes, which is the size of the + memory allocated for the topic. Default is 1024. + :type max_size_in_megabytes: int + :param requires_duplicate_detection: Value indicating if this topic requires duplicate + detection. + :type requires_duplicate_detection: bool + :param duplicate_detection_history_time_window: ISO8601 timespan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus + :param support_ordering: Value that indicates whether the topic supports ordering. + :type support_ordering: bool + :param auto_delete_on_idle: ISO 8601 timespan idle interval after which the topic is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param enable_partitioning: Value that indicates whether the topic to be partitioned across + multiple message brokers is enabled. + :type enable_partitioning: bool + :param enable_express: Value that indicates whether Express Entities are enabled. An express + topic holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'subscription_count': {'readonly': True}, + 'count_details': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(SBTopic, self).__init__(**kwargs) + self.size_in_bytes = None + self.created_at = None + self.updated_at = None + self.accessed_at = None + self.subscription_count = None + self.count_details = None + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.max_size_in_megabytes = kwargs.get('max_size_in_megabytes', None) + self.requires_duplicate_detection = kwargs.get('requires_duplicate_detection', None) + self.duplicate_detection_history_time_window = kwargs.get('duplicate_detection_history_time_window', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.status = kwargs.get('status', None) + self.support_ordering = kwargs.get('support_ordering', None) + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.enable_partitioning = kwargs.get('enable_partitioning', None) + self.enable_express = kwargs.get('enable_express', None) + + +class SBTopicListResult(msrest.serialization.Model): + """The response to the List Topics operation. + + :param value: Result of the List Topics operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBTopic] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of topics. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBTopic]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBTopicListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SqlFilter(msrest.serialization.Model): + """Represents a filter which is a composition of an expression and an action that is executed in the pub/sub pipeline. + + :param sql_expression: The SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _validation = { + 'compatibility_level': {'maximum': 20, 'minimum': 20}, + } + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(SqlFilter, self).__init__(**kwargs) + self.sql_expression = kwargs.get('sql_expression', None) + self.compatibility_level = kwargs.get('compatibility_level', 20) + self.requires_preprocessing = kwargs.get('requires_preprocessing', True) + + +class SqlRuleAction(Action): + """Represents set of actions written in SQL language-based syntax that is performed against a ServiceBus.Messaging.BrokeredMessage. + + :param sql_expression: SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(SqlRuleAction, self).__init__(**kwargs) + + +class Subnet(msrest.serialization.Model): + """Properties supplied for Subnet. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Resource ID of Virtual Network Subnet. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Subnet, self).__init__(**kwargs) + self.id = kwargs['id'] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_models_py3.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_models_py3.py new file mode 100644 index 0000000000000..cc7755aaf8758 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_models_py3.py @@ -0,0 +1,2231 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._service_bus_management_client_enums import * + + +class AccessKeys(msrest.serialization.Model): + """Namespace/ServiceBus Connection String. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar primary_connection_string: Primary connection string of the created namespace + authorization rule. + :vartype primary_connection_string: str + :ivar secondary_connection_string: Secondary connection string of the created namespace + authorization rule. + :vartype secondary_connection_string: str + :ivar alias_primary_connection_string: Primary connection string of the alias if GEO DR is + enabled. + :vartype alias_primary_connection_string: str + :ivar alias_secondary_connection_string: Secondary connection string of the alias if GEO DR is + enabled. + :vartype alias_secondary_connection_string: str + :ivar primary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :vartype primary_key: str + :ivar secondary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :vartype secondary_key: str + :ivar key_name: A string that describes the authorization rule. + :vartype key_name: str + """ + + _validation = { + 'primary_connection_string': {'readonly': True}, + 'secondary_connection_string': {'readonly': True}, + 'alias_primary_connection_string': {'readonly': True}, + 'alias_secondary_connection_string': {'readonly': True}, + 'primary_key': {'readonly': True}, + 'secondary_key': {'readonly': True}, + 'key_name': {'readonly': True}, + } + + _attribute_map = { + 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, + 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, + 'alias_primary_connection_string': {'key': 'aliasPrimaryConnectionString', 'type': 'str'}, + 'alias_secondary_connection_string': {'key': 'aliasSecondaryConnectionString', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'key_name': {'key': 'keyName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AccessKeys, self).__init__(**kwargs) + self.primary_connection_string = None + self.secondary_connection_string = None + self.alias_primary_connection_string = None + self.alias_secondary_connection_string = None + self.primary_key = None + self.secondary_key = None + self.key_name = None + + +class Action(msrest.serialization.Model): + """Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. + + :param sql_expression: SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + *, + sql_expression: Optional[str] = None, + compatibility_level: Optional[int] = None, + requires_preprocessing: Optional[bool] = True, + **kwargs + ): + super(Action, self).__init__(**kwargs) + self.sql_expression = sql_expression + self.compatibility_level = compatibility_level + self.requires_preprocessing = requires_preprocessing + + +class Resource(msrest.serialization.Model): + """The Resource definition for other than namespace. + + 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 + """ + + _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'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ArmDisasterRecovery(Resource): + """Single item in List or Get Alias(Disaster Recovery configuration) 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 + :ivar provisioning_state: Provisioning state of the Alias(Disaster Recovery configuration) - + possible values 'Accepted' or 'Succeeded' or 'Failed'. Possible values include: "Accepted", + "Succeeded", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.servicebus.v2017_04_01.models.ProvisioningStateDR + :ivar pending_replication_operations_count: Number of entities pending to be replicated. + :vartype pending_replication_operations_count: long + :param partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is + part of GEO DR pairing. + :type partner_namespace: str + :param alternate_name: Primary/Secondary eventhub namespace name, which is part of GEO DR + pairing. + :type alternate_name: str + :ivar role: role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' + or 'Secondary'. Possible values include: "Primary", "PrimaryNotReplicating", "Secondary". + :vartype role: str or ~azure.mgmt.servicebus.v2017_04_01.models.RoleDisasterRecovery + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'pending_replication_operations_count': {'readonly': True}, + 'role': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, + 'partner_namespace': {'key': 'properties.partnerNamespace', 'type': 'str'}, + 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, + 'role': {'key': 'properties.role', 'type': 'str'}, + } + + def __init__( + self, + *, + partner_namespace: Optional[str] = None, + alternate_name: Optional[str] = None, + **kwargs + ): + super(ArmDisasterRecovery, self).__init__(**kwargs) + self.provisioning_state = None + self.pending_replication_operations_count = None + self.partner_namespace = partner_namespace + self.alternate_name = alternate_name + self.role = None + + +class ArmDisasterRecoveryListResult(msrest.serialization.Model): + """The result of the List Alias(Disaster Recovery configuration) operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Alias(Disaster Recovery configurations). + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Alias(Disaster Recovery configuration). + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ArmDisasterRecovery]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ArmDisasterRecovery"]] = None, + **kwargs + ): + super(ArmDisasterRecoveryListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class CaptureDescription(msrest.serialization.Model): + """Properties to configure capture description for eventhub. + + :param enabled: A value that indicates whether capture description is enabled. + :type enabled: bool + :param encoding: Enumerates the possible values for the encoding format of capture description. + Possible values include: "Avro", "AvroDeflate". + :type encoding: str or ~azure.mgmt.servicebus.v2017_04_01.models.EncodingCaptureDescription + :param interval_in_seconds: The time window allows you to set the frequency with which the + capture to Azure Blobs will happen, value should between 60 to 900 seconds. + :type interval_in_seconds: int + :param size_limit_in_bytes: The size window defines the amount of data built up in your Event + Hub before an capture operation, value should be between 10485760 and 524288000 bytes. + :type size_limit_in_bytes: int + :param destination: Properties of Destination where capture will be stored. (Storage Account, + Blob Names). + :type destination: ~azure.mgmt.servicebus.v2017_04_01.models.Destination + """ + + _validation = { + 'interval_in_seconds': {'maximum': 900, 'minimum': 60}, + 'size_limit_in_bytes': {'maximum': 524288000, 'minimum': 10485760}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'encoding': {'key': 'encoding', 'type': 'str'}, + 'interval_in_seconds': {'key': 'intervalInSeconds', 'type': 'int'}, + 'size_limit_in_bytes': {'key': 'sizeLimitInBytes', 'type': 'int'}, + 'destination': {'key': 'destination', 'type': 'Destination'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + encoding: Optional[Union[str, "EncodingCaptureDescription"]] = None, + interval_in_seconds: Optional[int] = None, + size_limit_in_bytes: Optional[int] = None, + destination: Optional["Destination"] = None, + **kwargs + ): + super(CaptureDescription, self).__init__(**kwargs) + self.enabled = enabled + self.encoding = encoding + self.interval_in_seconds = interval_in_seconds + self.size_limit_in_bytes = size_limit_in_bytes + self.destination = destination + + +class CheckNameAvailability(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The Name to check the namespace name availability and The namespace name + can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it + must end with a letter or number. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(CheckNameAvailability, self).__init__(**kwargs) + self.name = name + + +class CheckNameAvailabilityResult(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar message: The detailed info regarding the reason associated with the namespace. + :vartype message: str + :param name_available: Value indicating namespace is availability, true if the namespace is + available; otherwise, false. + :type name_available: bool + :param reason: The reason for unavailability of a namespace. Possible values include: "None", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "TooManyNamespaceInCurrentSubscription". + :type reason: str or ~azure.mgmt.servicebus.v2017_04_01.models.UnavailableReason + """ + + _validation = { + 'message': {'readonly': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + } + + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[Union[str, "UnavailableReason"]] = None, + **kwargs + ): + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.message = None + self.name_available = name_available + self.reason = reason + + +class CorrelationFilter(msrest.serialization.Model): + """Represents the correlation filter expression. + + :param properties: dictionary object for custom filters. + :type properties: dict[str, str] + :param correlation_id: Identifier of the correlation. + :type correlation_id: str + :param message_id: Identifier of the message. + :type message_id: str + :param to: Address to send to. + :type to: str + :param reply_to: Address of the queue to reply to. + :type reply_to: str + :param label: Application specific label. + :type label: str + :param session_id: Session identifier. + :type session_id: str + :param reply_to_session_id: Session identifier to reply to. + :type reply_to_session_id: str + :param content_type: Content type of the message. + :type content_type: str + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': '{str}'}, + 'correlation_id': {'key': 'correlationId', 'type': 'str'}, + 'message_id': {'key': 'messageId', 'type': 'str'}, + 'to': {'key': 'to', 'type': 'str'}, + 'reply_to': {'key': 'replyTo', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'session_id': {'key': 'sessionId', 'type': 'str'}, + 'reply_to_session_id': {'key': 'replyToSessionId', 'type': 'str'}, + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + *, + properties: Optional[Dict[str, str]] = None, + correlation_id: Optional[str] = None, + message_id: Optional[str] = None, + to: Optional[str] = None, + reply_to: Optional[str] = None, + label: Optional[str] = None, + session_id: Optional[str] = None, + reply_to_session_id: Optional[str] = None, + content_type: Optional[str] = None, + requires_preprocessing: Optional[bool] = True, + **kwargs + ): + super(CorrelationFilter, self).__init__(**kwargs) + self.properties = properties + self.correlation_id = correlation_id + self.message_id = message_id + self.to = to + self.reply_to = reply_to + self.label = label + self.session_id = session_id + self.reply_to_session_id = reply_to_session_id + self.content_type = content_type + self.requires_preprocessing = requires_preprocessing + + +class Destination(msrest.serialization.Model): + """Capture storage details for capture description. + + :param name: Name for capture destination. + :type name: str + :param storage_account_resource_id: Resource id of the storage account to be used to create the + blobs. + :type storage_account_resource_id: str + :param blob_container: Blob container Name. + :type blob_container: str + :param archive_name_format: Blob naming convention for archive, e.g. + {Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}. Here all + the parameters (Namespace,EventHub .. etc) are mandatory irrespective of order. + :type archive_name_format: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'storage_account_resource_id': {'key': 'properties.storageAccountResourceId', 'type': 'str'}, + 'blob_container': {'key': 'properties.blobContainer', 'type': 'str'}, + 'archive_name_format': {'key': 'properties.archiveNameFormat', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + storage_account_resource_id: Optional[str] = None, + blob_container: Optional[str] = None, + archive_name_format: Optional[str] = None, + **kwargs + ): + super(Destination, self).__init__(**kwargs) + self.name = name + self.storage_account_resource_id = storage_account_resource_id + self.blob_container = blob_container + self.archive_name_format = archive_name_format + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """The resource management error response. + + :param error: The error object. + :type error: ~azure.mgmt.servicebus.v2017_04_01.models.ErrorResponseError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + } + + def __init__( + self, + *, + error: Optional["ErrorResponseError"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseError(msrest.serialization.Model): + """The error object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.servicebus.v2017_04_01.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.servicebus.v2017_04_01.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseError, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class Eventhub(Resource): + """Single item in List or Get Event Hub 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 + :ivar partition_ids: Current number of shards on the Event Hub. + :vartype partition_ids: list[str] + :ivar created_at: Exact time the Event Hub was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :param message_retention_in_days: Number of days to retain the events for this Event Hub, value + should be 1 to 7 days. + :type message_retention_in_days: long + :param partition_count: Number of partitions created for the Event Hub, allowed values are from + 1 to 32 partitions. + :type partition_count: long + :param status: Enumerates the possible values for the status of a Event Hub. Possible values + include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", + "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus + :param capture_description: Properties of capture description. + :type capture_description: ~azure.mgmt.servicebus.v2017_04_01.models.CaptureDescription + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'partition_ids': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'message_retention_in_days': {'maximum': 7, 'minimum': 1}, + 'partition_count': {'maximum': 32, 'minimum': 1}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'partition_ids': {'key': 'properties.partitionIds', 'type': '[str]'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'message_retention_in_days': {'key': 'properties.messageRetentionInDays', 'type': 'long'}, + 'partition_count': {'key': 'properties.partitionCount', 'type': 'long'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'capture_description': {'key': 'properties.captureDescription', 'type': 'CaptureDescription'}, + } + + def __init__( + self, + *, + message_retention_in_days: Optional[int] = None, + partition_count: Optional[int] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + capture_description: Optional["CaptureDescription"] = None, + **kwargs + ): + super(Eventhub, self).__init__(**kwargs) + self.partition_ids = None + self.created_at = None + self.updated_at = None + self.message_retention_in_days = message_retention_in_days + self.partition_count = partition_count + self.status = status + self.capture_description = capture_description + + +class EventHubListResult(msrest.serialization.Model): + """The result of the List EventHubs operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: Result of the List EventHubs operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.Eventhub] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of EventHubs. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Eventhub]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Eventhub"]] = None, + **kwargs + ): + super(EventHubListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class MessageCountDetails(msrest.serialization.Model): + """Message Count Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar active_message_count: Number of active messages in the queue, topic, or subscription. + :vartype active_message_count: long + :ivar dead_letter_message_count: Number of messages that are dead lettered. + :vartype dead_letter_message_count: long + :ivar scheduled_message_count: Number of scheduled messages. + :vartype scheduled_message_count: long + :ivar transfer_message_count: Number of messages transferred to another queue, topic, or + subscription. + :vartype transfer_message_count: long + :ivar transfer_dead_letter_message_count: Number of messages transferred into dead letters. + :vartype transfer_dead_letter_message_count: long + """ + + _validation = { + 'active_message_count': {'readonly': True}, + 'dead_letter_message_count': {'readonly': True}, + 'scheduled_message_count': {'readonly': True}, + 'transfer_message_count': {'readonly': True}, + 'transfer_dead_letter_message_count': {'readonly': True}, + } + + _attribute_map = { + 'active_message_count': {'key': 'activeMessageCount', 'type': 'long'}, + 'dead_letter_message_count': {'key': 'deadLetterMessageCount', 'type': 'long'}, + 'scheduled_message_count': {'key': 'scheduledMessageCount', 'type': 'long'}, + 'transfer_message_count': {'key': 'transferMessageCount', 'type': 'long'}, + 'transfer_dead_letter_message_count': {'key': 'transferDeadLetterMessageCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(MessageCountDetails, self).__init__(**kwargs) + self.active_message_count = None + self.dead_letter_message_count = None + self.scheduled_message_count = None + self.transfer_message_count = None + self.transfer_dead_letter_message_count = None + + +class MigrationConfigListResult(msrest.serialization.Model): + """The result of the List migrationConfigurations operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Migration Configs. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of migrationConfigurations. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MigrationConfigProperties]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["MigrationConfigProperties"]] = None, + **kwargs + ): + super(MigrationConfigListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class MigrationConfigProperties(Resource): + """Single item in List or Get Migration Config 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 + :ivar provisioning_state: Provisioning state of Migration Configuration. + :vartype provisioning_state: str + :ivar pending_replication_operations_count: Number of entities pending to be replicated. + :vartype pending_replication_operations_count: long + :param target_namespace: Existing premium Namespace ARM Id name which has no entities, will be + used for migration. + :type target_namespace: str + :param post_migration_name: Name to access Standard Namespace after migration. + :type post_migration_name: str + :ivar migration_state: State in which Standard to Premium Migration is, possible values : + Unknown, Reverting, Completing, Initiating, Syncing, Active. + :vartype migration_state: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'pending_replication_operations_count': {'readonly': True}, + 'migration_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, + 'target_namespace': {'key': 'properties.targetNamespace', 'type': 'str'}, + 'post_migration_name': {'key': 'properties.postMigrationName', 'type': 'str'}, + 'migration_state': {'key': 'properties.migrationState', 'type': 'str'}, + } + + def __init__( + self, + *, + target_namespace: Optional[str] = None, + post_migration_name: Optional[str] = None, + **kwargs + ): + super(MigrationConfigProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.pending_replication_operations_count = None + self.target_namespace = target_namespace + self.post_migration_name = post_migration_name + self.migration_state = None + + +class NetworkRuleSet(Resource): + """Description of NetworkRuleSet 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 default_action: Default Action for Network Rule Set. Possible values include: "Allow", + "Deny". + :type default_action: str or ~azure.mgmt.servicebus.v2017_04_01.models.DefaultAction + :param virtual_network_rules: List VirtualNetwork Rules. + :type virtual_network_rules: + list[~azure.mgmt.servicebus.v2017_04_01.models.NWRuleSetVirtualNetworkRules] + :param ip_rules: List of IpRules. + :type ip_rules: list[~azure.mgmt.servicebus.v2017_04_01.models.NWRuleSetIpRules] + """ + + _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'}, + 'default_action': {'key': 'properties.defaultAction', 'type': 'str'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[NWRuleSetVirtualNetworkRules]'}, + 'ip_rules': {'key': 'properties.ipRules', 'type': '[NWRuleSetIpRules]'}, + } + + def __init__( + self, + *, + default_action: Optional[Union[str, "DefaultAction"]] = None, + virtual_network_rules: Optional[List["NWRuleSetVirtualNetworkRules"]] = None, + ip_rules: Optional[List["NWRuleSetIpRules"]] = None, + **kwargs + ): + super(NetworkRuleSet, self).__init__(**kwargs) + self.default_action = default_action + self.virtual_network_rules = virtual_network_rules + self.ip_rules = ip_rules + + +class NetworkRuleSetListResult(msrest.serialization.Model): + """The response of the List NetworkRuleSet operation. + + :param value: Result of the List NetworkRuleSet operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of NetworkRuleSet. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkRuleSet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NetworkRuleSet"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(NetworkRuleSetListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NWRuleSetIpRules(msrest.serialization.Model): + """Description of NetWorkRuleSet - IpRules resource. + + :param ip_mask: IP Mask. + :type ip_mask: str + :param action: The IP Filter Action. Possible values include: "Allow". Default value: "Allow". + :type action: str or ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleIPAction + """ + + _attribute_map = { + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + } + + def __init__( + self, + *, + ip_mask: Optional[str] = None, + action: Optional[Union[str, "NetworkRuleIPAction"]] = "Allow", + **kwargs + ): + super(NWRuleSetIpRules, self).__init__(**kwargs) + self.ip_mask = ip_mask + self.action = action + + +class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): + """Description of VirtualNetworkRules - NetworkRules resource. + + :param subnet: Subnet properties. + :type subnet: ~azure.mgmt.servicebus.v2017_04_01.models.Subnet + :param ignore_missing_vnet_service_endpoint: Value that indicates whether to ignore missing + VNet Service Endpoint. + :type ignore_missing_vnet_service_endpoint: bool + """ + + _attribute_map = { + 'subnet': {'key': 'subnet', 'type': 'Subnet'}, + 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, + } + + def __init__( + self, + *, + subnet: Optional["Subnet"] = None, + ignore_missing_vnet_service_endpoint: Optional[bool] = None, + **kwargs + ): + super(NWRuleSetVirtualNetworkRules, self).__init__(**kwargs) + self.subnet = subnet + self.ignore_missing_vnet_service_endpoint = ignore_missing_vnet_service_endpoint + + +class Operation(msrest.serialization.Model): + """A ServiceBus REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.servicebus.v2017_04_01.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = display + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft.ServiceBus. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Invoice, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list ServiceBus operations. It contains a list of operations and a URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of ServiceBus operations supported by the Microsoft.ServiceBus resource + provider. + :vartype value: list[~azure.mgmt.servicebus.v2017_04_01.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class ResourceNamespacePatch(Resource): + """The Resource definition. + + 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: A set of tags. Resource tags. + :type tags: dict[str, 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}'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ResourceNamespacePatch, self).__init__(**kwargs) + self.location = location + self.tags = tags + + +class PremiumMessagingRegions(ResourceNamespacePatch): + """Premium Messaging Region. + + 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: A set of tags. Resource tags. + :type tags: dict[str, str] + :param properties: + :type properties: ~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegionsProperties + """ + + _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}'}, + 'properties': {'key': 'properties', 'type': 'PremiumMessagingRegionsProperties'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional["PremiumMessagingRegionsProperties"] = None, + **kwargs + ): + super(PremiumMessagingRegions, self).__init__(location=location, tags=tags, **kwargs) + self.properties = properties + + +class PremiumMessagingRegionsListResult(msrest.serialization.Model): + """The response of the List PremiumMessagingRegions operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: Result of the List PremiumMessagingRegions type. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegions] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of PremiumMessagingRegions. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PremiumMessagingRegions]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PremiumMessagingRegions"]] = None, + **kwargs + ): + super(PremiumMessagingRegionsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class PremiumMessagingRegionsProperties(msrest.serialization.Model): + """PremiumMessagingRegionsProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Region code. + :vartype code: str + :ivar full_name: Full name of the region. + :vartype full_name: str + """ + + _validation = { + 'code': {'readonly': True}, + 'full_name': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'full_name': {'key': 'fullName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PremiumMessagingRegionsProperties, self).__init__(**kwargs) + self.code = None + self.full_name = None + + +class RegenerateAccessKeyParameters(msrest.serialization.Model): + """Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs to be reset. + + All required parameters must be populated in order to send to Azure. + + :param key_type: Required. The access key to regenerate. Possible values include: "PrimaryKey", + "SecondaryKey". + :type key_type: str or ~azure.mgmt.servicebus.v2017_04_01.models.KeyType + :param key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key + value set for keyType. + :type key: str + """ + + _validation = { + 'key_type': {'required': True}, + } + + _attribute_map = { + 'key_type': {'key': 'keyType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + } + + def __init__( + self, + *, + key_type: Union[str, "KeyType"], + key: Optional[str] = None, + **kwargs + ): + super(RegenerateAccessKeyParameters, self).__init__(**kwargs) + self.key_type = key_type + self.key = key + + +class Rule(Resource): + """Description of Rule 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 action: Represents the filter actions which are allowed for the transformation of a + message that have been matched by a filter expression. + :type action: ~azure.mgmt.servicebus.v2017_04_01.models.Action + :param filter_type: Filter type that is evaluated against a BrokeredMessage. Possible values + include: "SqlFilter", "CorrelationFilter". + :type filter_type: str or ~azure.mgmt.servicebus.v2017_04_01.models.FilterType + :param sql_filter: Properties of sqlFilter. + :type sql_filter: ~azure.mgmt.servicebus.v2017_04_01.models.SqlFilter + :param correlation_filter: Properties of correlationFilter. + :type correlation_filter: ~azure.mgmt.servicebus.v2017_04_01.models.CorrelationFilter + """ + + _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'}, + 'action': {'key': 'properties.action', 'type': 'Action'}, + 'filter_type': {'key': 'properties.filterType', 'type': 'str'}, + 'sql_filter': {'key': 'properties.sqlFilter', 'type': 'SqlFilter'}, + 'correlation_filter': {'key': 'properties.correlationFilter', 'type': 'CorrelationFilter'}, + } + + def __init__( + self, + *, + action: Optional["Action"] = None, + filter_type: Optional[Union[str, "FilterType"]] = None, + sql_filter: Optional["SqlFilter"] = None, + correlation_filter: Optional["CorrelationFilter"] = None, + **kwargs + ): + super(Rule, self).__init__(**kwargs) + self.action = action + self.filter_type = filter_type + self.sql_filter = sql_filter + self.correlation_filter = correlation_filter + + +class RuleListResult(msrest.serialization.Model): + """The response of the List rule operation. + + :param value: Result of the List Rules operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.Rule] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of rules. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Rule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Rule"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(RuleListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SBAuthorizationRule(Resource): + """Description of a namespace authorization rule. + + 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 rights: The rights associated with the rule. + :type rights: list[str or ~azure.mgmt.servicebus.v2017_04_01.models.AccessRights] + """ + + _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'}, + 'rights': {'key': 'properties.rights', 'type': '[str]'}, + } + + def __init__( + self, + *, + rights: Optional[List[Union[str, "AccessRights"]]] = None, + **kwargs + ): + super(SBAuthorizationRule, self).__init__(**kwargs) + self.rights = rights + + +class SBAuthorizationRuleListResult(msrest.serialization.Model): + """The response to the List Namespace operation. + + :param value: Result of the List Authorization Rules operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Authorization Rules. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBAuthorizationRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SBAuthorizationRule"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SBAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class TrackedResource(Resource): + """The Resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. The Geo-location where the resource lives. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': 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}'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.location = location + self.tags = tags + + +class SBNamespace(TrackedResource): + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. The Geo-location where the resource lives. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Properties of Sku. + :type sku: ~azure.mgmt.servicebus.v2017_04_01.models.SBSku + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :ivar metric_id: Identifier for Azure Insights metrics. + :vartype metric_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + 'metric_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SBSku'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + sku: Optional["SBSku"] = None, + **kwargs + ): + super(SBNamespace, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.provisioning_state = None + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.metric_id = None + + +class SBNamespaceListResult(msrest.serialization.Model): + """The response of the List Namespace operation. + + :param value: Result of the List Namespace operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Namespaces. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBNamespace]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SBNamespace"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SBNamespaceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SBNamespaceMigrate(msrest.serialization.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.v2017_04_01.models.NameSpaceType + """ + + _validation = { + 'target_namespace_type': {'required': True}, + } + + _attribute_map = { + 'target_namespace_type': {'key': 'targetNamespaceType', 'type': 'str'}, + } + + def __init__( + self, + *, + target_namespace_type: Union[str, "NameSpaceType"], + **kwargs + ): + super(SBNamespaceMigrate, self).__init__(**kwargs) + self.target_namespace_type = target_namespace_type + + +class SBNamespaceUpdateParameters(ResourceNamespacePatch): + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Properties of Sku. + :type sku: ~azure.mgmt.servicebus.v2017_04_01.models.SBSku + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :ivar metric_id: Identifier for Azure Insights metrics. + :vartype metric_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + 'metric_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SBSku'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["SBSku"] = None, + **kwargs + ): + super(SBNamespaceUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.provisioning_state = None + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.metric_id = None + + +class SBQueue(Resource): + """Description of queue 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 + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2017_04_01.models.MessageCountDetails + :ivar created_at: The exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar accessed_at: Last time a message was sent, or the last time there was a receive request + to this queue. + :vartype accessed_at: ~datetime.datetime + :ivar size_in_bytes: The size of the queue, in bytes. + :vartype size_in_bytes: long + :ivar message_count: The number of messages in the queue. + :vartype message_count: long + :param lock_duration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time + that the message is locked for other receivers. The maximum value for LockDuration is 5 + minutes; the default value is 1 minute. + :type lock_duration: ~datetime.timedelta + :param max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size of + memory allocated for the queue. Default is 1024. + :type max_size_in_megabytes: int + :param requires_duplicate_detection: A value indicating if this queue requires duplicate + detection. + :type requires_duplicate_detection: bool + :param requires_session: A value that indicates whether the queue supports the concept of + sessions. + :type requires_session: bool + :param default_message_time_to_live: ISO 8601 default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param dead_lettering_on_message_expiration: A value that indicates whether this queue has dead + letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param duplicate_detection_history_time_window: ISO 8601 timeSpan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param max_delivery_count: The maximum delivery count. A message is automatically deadlettered + after this number of deliveries. default value is 10. + :type max_delivery_count: int + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param auto_delete_on_idle: ISO 8061 timeSpan idle interval after which the queue is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param enable_partitioning: A value that indicates whether the queue is to be partitioned + across multiple message brokers. + :type enable_partitioning: bool + :param enable_express: A value that indicates whether Express Entities are enabled. An express + queue holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param forward_to: Queue/Topic name to forward the messages. + :type forward_to: str + :param forward_dead_lettered_messages_to: Queue/Topic name to forward the Dead Letter message. + :type forward_dead_lettered_messages_to: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'count_details': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'message_count': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, + 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, + } + + def __init__( + self, + *, + lock_duration: Optional[datetime.timedelta] = None, + max_size_in_megabytes: Optional[int] = None, + requires_duplicate_detection: Optional[bool] = None, + requires_session: Optional[bool] = None, + default_message_time_to_live: Optional[datetime.timedelta] = None, + dead_lettering_on_message_expiration: Optional[bool] = None, + duplicate_detection_history_time_window: Optional[datetime.timedelta] = None, + max_delivery_count: Optional[int] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + enable_batched_operations: Optional[bool] = None, + auto_delete_on_idle: Optional[datetime.timedelta] = None, + enable_partitioning: Optional[bool] = None, + enable_express: Optional[bool] = None, + forward_to: Optional[str] = None, + forward_dead_lettered_messages_to: Optional[str] = None, + **kwargs + ): + super(SBQueue, self).__init__(**kwargs) + self.count_details = None + self.created_at = None + self.updated_at = None + self.accessed_at = None + self.size_in_bytes = None + self.message_count = None + self.lock_duration = lock_duration + self.max_size_in_megabytes = max_size_in_megabytes + self.requires_duplicate_detection = requires_duplicate_detection + self.requires_session = requires_session + self.default_message_time_to_live = default_message_time_to_live + self.dead_lettering_on_message_expiration = dead_lettering_on_message_expiration + self.duplicate_detection_history_time_window = duplicate_detection_history_time_window + self.max_delivery_count = max_delivery_count + self.status = status + self.enable_batched_operations = enable_batched_operations + self.auto_delete_on_idle = auto_delete_on_idle + self.enable_partitioning = enable_partitioning + self.enable_express = enable_express + self.forward_to = forward_to + self.forward_dead_lettered_messages_to = forward_dead_lettered_messages_to + + +class SBQueueListResult(msrest.serialization.Model): + """The response to the List Queues operation. + + :param value: Result of the List Queues operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBQueue] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of queues. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBQueue]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SBQueue"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SBQueueListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SBSku(msrest.serialization.Model): + """SKU of the namespace. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of this SKU. Possible values include: "Basic", "Standard", + "Premium". + :type name: str or ~azure.mgmt.servicebus.v2017_04_01.models.SkuName + :param tier: The billing tier of this particular SKU. Possible values include: "Basic", + "Standard", "Premium". + :type tier: str or ~azure.mgmt.servicebus.v2017_04_01.models.SkuTier + :param capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 + and 4. + :type capacity: int + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + *, + name: Union[str, "SkuName"], + tier: Optional[Union[str, "SkuTier"]] = None, + capacity: Optional[int] = None, + **kwargs + ): + super(SBSku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.capacity = capacity + + +class SBSubscription(Resource): + """Description of subscription 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 + :ivar message_count: Number of messages. + :vartype message_count: long + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar accessed_at: Last time there was a receive request to this subscription. + :vartype accessed_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar count_details: Message count details. + :vartype count_details: ~azure.mgmt.servicebus.v2017_04_01.models.MessageCountDetails + :param lock_duration: ISO 8061 lock duration timespan for the subscription. The default value + is 1 minute. + :type lock_duration: ~datetime.timedelta + :param requires_session: Value indicating if a subscription supports the concept of sessions. + :type requires_session: bool + :param default_message_time_to_live: ISO 8061 Default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param dead_lettering_on_filter_evaluation_exceptions: Value that indicates whether a + subscription has dead letter support on filter evaluation exceptions. + :type dead_lettering_on_filter_evaluation_exceptions: bool + :param dead_lettering_on_message_expiration: Value that indicates whether a subscription has + dead letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param duplicate_detection_history_time_window: ISO 8601 timeSpan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param max_delivery_count: Number of maximum deliveries. + :type max_delivery_count: int + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param auto_delete_on_idle: ISO 8061 timeSpan idle interval after which the topic is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param forward_to: Queue/Topic name to forward the messages. + :type forward_to: str + :param forward_dead_lettered_messages_to: Queue/Topic name to forward the Dead Letter message. + :type forward_dead_lettered_messages_to: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'message_count': {'readonly': True}, + 'created_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'count_details': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, + 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, + } + + def __init__( + self, + *, + lock_duration: Optional[datetime.timedelta] = None, + requires_session: Optional[bool] = None, + default_message_time_to_live: Optional[datetime.timedelta] = None, + dead_lettering_on_filter_evaluation_exceptions: Optional[bool] = None, + dead_lettering_on_message_expiration: Optional[bool] = None, + duplicate_detection_history_time_window: Optional[datetime.timedelta] = None, + max_delivery_count: Optional[int] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + enable_batched_operations: Optional[bool] = None, + auto_delete_on_idle: Optional[datetime.timedelta] = None, + forward_to: Optional[str] = None, + forward_dead_lettered_messages_to: Optional[str] = None, + **kwargs + ): + super(SBSubscription, self).__init__(**kwargs) + self.message_count = None + self.created_at = None + self.accessed_at = None + self.updated_at = None + self.count_details = None + self.lock_duration = lock_duration + self.requires_session = requires_session + self.default_message_time_to_live = default_message_time_to_live + self.dead_lettering_on_filter_evaluation_exceptions = dead_lettering_on_filter_evaluation_exceptions + self.dead_lettering_on_message_expiration = dead_lettering_on_message_expiration + self.duplicate_detection_history_time_window = duplicate_detection_history_time_window + self.max_delivery_count = max_delivery_count + self.status = status + self.enable_batched_operations = enable_batched_operations + self.auto_delete_on_idle = auto_delete_on_idle + self.forward_to = forward_to + self.forward_dead_lettered_messages_to = forward_dead_lettered_messages_to + + +class SBSubscriptionListResult(msrest.serialization.Model): + """The response to the List Subscriptions operation. + + :param value: Result of the List Subscriptions operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of subscriptions. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBSubscription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SBSubscription"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SBSubscriptionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SBTopic(Resource): + """Description of topic 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 + :ivar size_in_bytes: Size of the topic, in bytes. + :vartype size_in_bytes: long + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar accessed_at: Last time the message was sent, or a request was received, for this topic. + :vartype accessed_at: ~datetime.datetime + :ivar subscription_count: Number of subscriptions. + :vartype subscription_count: int + :ivar count_details: Message count details. + :vartype count_details: ~azure.mgmt.servicebus.v2017_04_01.models.MessageCountDetails + :param default_message_time_to_live: ISO 8601 Default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param max_size_in_megabytes: Maximum size of the topic in megabytes, which is the size of the + memory allocated for the topic. Default is 1024. + :type max_size_in_megabytes: int + :param requires_duplicate_detection: Value indicating if this topic requires duplicate + detection. + :type requires_duplicate_detection: bool + :param duplicate_detection_history_time_window: ISO8601 timespan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus + :param support_ordering: Value that indicates whether the topic supports ordering. + :type support_ordering: bool + :param auto_delete_on_idle: ISO 8601 timespan idle interval after which the topic is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param enable_partitioning: Value that indicates whether the topic to be partitioned across + multiple message brokers is enabled. + :type enable_partitioning: bool + :param enable_express: Value that indicates whether Express Entities are enabled. An express + topic holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'subscription_count': {'readonly': True}, + 'count_details': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + } + + def __init__( + self, + *, + default_message_time_to_live: Optional[datetime.timedelta] = None, + max_size_in_megabytes: Optional[int] = None, + requires_duplicate_detection: Optional[bool] = None, + duplicate_detection_history_time_window: Optional[datetime.timedelta] = None, + enable_batched_operations: Optional[bool] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + support_ordering: Optional[bool] = None, + auto_delete_on_idle: Optional[datetime.timedelta] = None, + enable_partitioning: Optional[bool] = None, + enable_express: Optional[bool] = None, + **kwargs + ): + super(SBTopic, self).__init__(**kwargs) + self.size_in_bytes = None + self.created_at = None + self.updated_at = None + self.accessed_at = None + self.subscription_count = None + self.count_details = None + self.default_message_time_to_live = default_message_time_to_live + self.max_size_in_megabytes = max_size_in_megabytes + self.requires_duplicate_detection = requires_duplicate_detection + self.duplicate_detection_history_time_window = duplicate_detection_history_time_window + self.enable_batched_operations = enable_batched_operations + self.status = status + self.support_ordering = support_ordering + self.auto_delete_on_idle = auto_delete_on_idle + self.enable_partitioning = enable_partitioning + self.enable_express = enable_express + + +class SBTopicListResult(msrest.serialization.Model): + """The response to the List Topics operation. + + :param value: Result of the List Topics operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBTopic] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of topics. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBTopic]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SBTopic"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SBTopicListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SqlFilter(msrest.serialization.Model): + """Represents a filter which is a composition of an expression and an action that is executed in the pub/sub pipeline. + + :param sql_expression: The SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _validation = { + 'compatibility_level': {'maximum': 20, 'minimum': 20}, + } + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + *, + sql_expression: Optional[str] = None, + compatibility_level: Optional[int] = 20, + requires_preprocessing: Optional[bool] = True, + **kwargs + ): + super(SqlFilter, self).__init__(**kwargs) + self.sql_expression = sql_expression + self.compatibility_level = compatibility_level + self.requires_preprocessing = requires_preprocessing + + +class SqlRuleAction(Action): + """Represents set of actions written in SQL language-based syntax that is performed against a ServiceBus.Messaging.BrokeredMessage. + + :param sql_expression: SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + *, + sql_expression: Optional[str] = None, + compatibility_level: Optional[int] = None, + requires_preprocessing: Optional[bool] = True, + **kwargs + ): + super(SqlRuleAction, self).__init__(sql_expression=sql_expression, compatibility_level=compatibility_level, requires_preprocessing=requires_preprocessing, **kwargs) + + +class Subnet(msrest.serialization.Model): + """Properties supplied for Subnet. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Resource ID of Virtual Network Subnet. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: str, + **kwargs + ): + super(Subnet, self).__init__(**kwargs) + self.id = id diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_service_bus_management_client_enums.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_service_bus_management_client_enums.py new file mode 100644 index 0000000000000..0d0adb0e71cd2 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_service_bus_management_client_enums.py @@ -0,0 +1,140 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AccessRights(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + MANAGE = "Manage" + SEND = "Send" + LISTEN = "Listen" + +class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Default Action for Network Rule Set + """ + + ALLOW = "Allow" + DENY = "Deny" + +class EncodingCaptureDescription(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Enumerates the possible values for the encoding format of capture description. + """ + + AVRO = "Avro" + AVRO_DEFLATE = "AvroDeflate" + +class EntityStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Entity status. + """ + + ACTIVE = "Active" + DISABLED = "Disabled" + RESTORING = "Restoring" + SEND_DISABLED = "SendDisabled" + RECEIVE_DISABLED = "ReceiveDisabled" + CREATING = "Creating" + DELETING = "Deleting" + RENAMING = "Renaming" + UNKNOWN = "Unknown" + +class FilterType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Rule filter types + """ + + SQL_FILTER = "SqlFilter" + CORRELATION_FILTER = "CorrelationFilter" + +class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The access key to regenerate. + """ + + PRIMARY_KEY = "PrimaryKey" + SECONDARY_KEY = "SecondaryKey" + +class MigrationConfigurationName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + _DEFAULT = "$default" + +class NameSpaceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of namespaces + """ + + MESSAGING = "Messaging" + NOTIFICATION_HUB = "NotificationHub" + MIXED = "Mixed" + EVENT_HUB = "EventHub" + RELAY = "Relay" + +class NetworkRuleIPAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The IP Filter Action + """ + + ALLOW = "Allow" + +class ProvisioningStateDR(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' + or 'Succeeded' or 'Failed' + """ + + ACCEPTED = "Accepted" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + +class RoleDisasterRecovery(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' or + 'Secondary' + """ + + PRIMARY = "Primary" + PRIMARY_NOT_REPLICATING = "PrimaryNotReplicating" + SECONDARY = "Secondary" + +class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Name of this SKU. + """ + + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + +class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The billing tier of this particular SKU. + """ + + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + +class UnavailableReason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the reason for the unavailability of the service. + """ + + NONE = "None" + INVALID_NAME = "InvalidName" + SUBSCRIPTION_IS_DISABLED = "SubscriptionIsDisabled" + NAME_IN_USE = "NameInUse" + NAME_IN_LOCKDOWN = "NameInLockdown" + TOO_MANY_NAMESPACE_IN_CURRENT_SUBSCRIPTION = "TooManyNamespaceInCurrentSubscription" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/__init__.py new file mode 100644 index 0000000000000..0a2e6926c1094 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/__init__.py @@ -0,0 +1,33 @@ +# 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 ._namespaces_operations import NamespacesOperations +from ._queues_operations import QueuesOperations +from ._topics_operations import TopicsOperations +from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations +from ._event_hubs_operations import EventHubsOperations +from ._migration_configs_operations import MigrationConfigsOperations +from ._operations import Operations +from ._premium_messaging_regions_operations import PremiumMessagingRegionsOperations +from ._rules_operations import RulesOperations +from ._regions_operations import RegionsOperations +from ._subscriptions_operations import SubscriptionsOperations + +__all__ = [ + 'NamespacesOperations', + 'QueuesOperations', + 'TopicsOperations', + 'DisasterRecoveryConfigsOperations', + 'EventHubsOperations', + 'MigrationConfigsOperations', + 'Operations', + 'PremiumMessagingRegionsOperations', + 'RulesOperations', + 'RegionsOperations', + 'SubscriptionsOperations', +] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_disaster_recovery_configs_operations.py new file mode 100644 index 0000000000000..d9faa08e2c17d --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_disaster_recovery_configs_operations.py @@ -0,0 +1,728 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DisasterRecoveryConfigsOperations(object): + """DisasterRecoveryConfigsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def check_name_availability( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.CheckNameAvailability" + **kwargs # type: Any + ): + # type: (...) -> "_models.CheckNameAvailabilityResult" + """Check the give namespace name availability. + + :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 parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability'} # type: ignore + + def list( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ArmDisasterRecoveryListResult"] + """Gets all Alias(Disaster Recovery configurations). + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecoveryListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecoveryListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ArmDisasterRecoveryListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + parameters, # type: "_models.ArmDisasterRecovery" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.ArmDisasterRecovery"] + """Creates or updates a new Alias(Disaster Recovery configuration). + + :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 alias: The Disaster Recovery configuration name. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ArmDisasterRecovery"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ArmDisasterRecovery') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes an Alias(Disaster Recovery configuration). + + :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 alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ArmDisasterRecovery" + """Retrieves Alias(Disaster Recovery configuration) for primary or secondary 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 alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecovery"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + def break_pairing( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """This operation disables the Disaster Recovery and stops replicating changes from primary to + secondary namespaces. + + :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 alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.break_pairing.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + break_pairing.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing'} # type: ignore + + def fail_over( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Invokes GEO DR failover and reconfigure the alias to point to the secondary 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 alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.fail_over.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + fail_over.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBAuthorizationRuleListResult"] + """Gets the authorization 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 alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules'} # type: ignore + + def get_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Gets an authorization rule 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 alias: The Disaster Recovery configuration name. + :type alias: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Gets the primary and secondary connection strings for the 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 alias: The Disaster Recovery configuration name. + :type alias: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}/listKeys'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_event_hubs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_event_hubs_operations.py similarity index 96% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_event_hubs_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_event_hubs_operations.py index 78ba3b0e8702d..907b14a4edcc2 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_event_hubs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_event_hubs_operations.py @@ -30,7 +30,7 @@ class EventHubsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2017_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -60,7 +60,7 @@ def list_by_namespace( :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventHubListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.EventHubListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.EventHubListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubListResult"] @@ -110,7 +110,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_migration_configs_operations.py similarity index 93% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_migration_configs_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_migration_configs_operations.py index 78a06e45cfb4a..a7074101ba36b 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_migration_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_migration_configs_operations.py @@ -32,7 +32,7 @@ class MigrationConfigsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2017_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -62,7 +62,7 @@ def list( :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MigrationConfigListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.MigrationConfigListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigListResult"] @@ -112,7 +112,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -169,7 +169,7 @@ def _create_and_start_migration_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -199,17 +199,17 @@ def begin_create_and_start_migration( :param namespace_name: The namespace name. :type namespace_name: str :param config_name: The configuration name. Should always be "$default". - :type config_name: str or ~azure.mgmt.servicebus.models.MigrationConfigurationName + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName :param parameters: Parameters required to create Migration Configuration. - :type parameters: ~azure.mgmt.servicebus.models.MigrationConfigProperties + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either MigrationConfigProperties or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.models.MigrationConfigProperties] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] @@ -275,7 +275,7 @@ def delete( :param namespace_name: The namespace name. :type namespace_name: str :param config_name: The configuration name. Should always be "$default". - :type config_name: str or ~azure.mgmt.servicebus.models.MigrationConfigurationName + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -313,7 +313,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -336,10 +336,10 @@ def get( :param namespace_name: The namespace name. :type namespace_name: str :param config_name: The configuration name. Should always be "$default". - :type config_name: str or ~azure.mgmt.servicebus.models.MigrationConfigurationName + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response :return: MigrationConfigProperties, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.MigrationConfigProperties + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigProperties"] @@ -374,7 +374,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) @@ -402,7 +402,7 @@ def complete_migration( :param namespace_name: The namespace name. :type namespace_name: str :param config_name: The configuration name. Should always be "$default". - :type config_name: str or ~azure.mgmt.servicebus.models.MigrationConfigurationName + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -440,7 +440,7 @@ def complete_migration( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -463,7 +463,7 @@ def revert( :param namespace_name: The namespace name. :type namespace_name: str :param config_name: The configuration name. Should always be "$default". - :type config_name: str or ~azure.mgmt.servicebus.models.MigrationConfigurationName + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -501,7 +501,7 @@ def revert( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_namespaces_operations.py new file mode 100644 index 0000000000000..ecc0fd2f131ee --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_namespaces_operations.py @@ -0,0 +1,1305 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class NamespacesOperations(object): + """NamespacesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBAuthorizationRuleListResult"] + """Gets the authorization 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules'} # type: ignore + + def create_or_update_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.SBAuthorizationRule" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Creates or updates an authorization rule 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + def delete_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a namespace authorization rule. + + :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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + def get_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Gets an authorization rule 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Gets the primary and secondary connection strings for the 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys'} # type: ignore + + def regenerate_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.RegenerateAccessKeyParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Regenerates the primary or secondary connection strings for the 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def check_name_availability( + self, + parameters, # type: "_models.CheckNameAvailability" + **kwargs # type: Any + ): + # type: (...) -> "_models.CheckNameAvailabilityResult" + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability'} # type: ignore + + def migrate( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.SBNamespaceMigrate" + **kwargs # type: Any + ): + # type: (...) -> None + """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 parameters: Parameters supplied to migrate namespace type. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceMigrate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.migrate.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespaceMigrate') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + migrate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrate'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBNamespaceListResult"] + """Gets all the available namespaces within the subscription, irrespective of the resource groups. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBNamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBNamespaceListResult"] + """Gets the available namespaces within a resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBNamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.SBNamespace" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.SBNamespace"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SBNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + 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'), + '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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespace') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.SBNamespace" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.SBNamespace"] + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + :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 parameters: Parameters supplied to create a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either SBNamespace or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespace"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes an existing namespace. This operation also removes all associated resources under the + 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBNamespace" + """Gets a description for the specified 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.SBNamespaceUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.SBNamespace"] + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :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 parameters: Parameters supplied to update a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SBNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespaceUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def create_or_update_network_rule_set( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.NetworkRuleSet" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkRuleSet" + """Create or update NetworkRuleSet 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 parameters: The Namespace IpFilterRule. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_network_rule_set.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkRuleSet') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + def get_network_rule_set( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkRuleSet" + """Gets NetworkRuleSet 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get_network_rule_set.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + def list_network_rule_sets( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkRuleSetListResult"] + """Gets list of NetworkRuleSet 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkRuleSetListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_network_rule_sets.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkRuleSetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_network_rule_sets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_operations.py new file mode 100644 index 0000000000000..67226cdd2f809 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_operations.py @@ -0,0 +1,110 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationListResult"] + """Lists all of the available ServiceBus REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.ServiceBus/operations'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_premium_messaging_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_premium_messaging_regions_operations.py similarity index 95% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_premium_messaging_regions_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_premium_messaging_regions_operations.py index 918d9302c34b9..a023c43b81d76 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_premium_messaging_regions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_premium_messaging_regions_operations.py @@ -30,7 +30,7 @@ class PremiumMessagingRegionsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2017_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -54,7 +54,7 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.PremiumMessagingRegionsListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PremiumMessagingRegionsListResult"] @@ -102,7 +102,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_queues_operations.py similarity index 95% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_queues_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_queues_operations.py index 952570b91ae99..b26b3e0d860d1 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_queues_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_queues_operations.py @@ -30,7 +30,7 @@ class QueuesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2017_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -63,7 +63,7 @@ def list_authorization_rules( :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.SBAuthorizationRuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] @@ -114,7 +114,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -146,10 +146,10 @@ def create_or_update_authorization_rule( :param authorization_rule_name: The authorization rule name. :type authorization_rule_name: str :param parameters: The shared access authorization rule. - :type parameters: ~azure.mgmt.servicebus.models.SBAuthorizationRule + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule :keyword callable cls: A custom type or function that will be passed the direct response :return: SBAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBAuthorizationRule + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] @@ -190,7 +190,7 @@ def create_or_update_authorization_rule( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) @@ -258,7 +258,7 @@ def delete_authorization_rule( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -287,7 +287,7 @@ def get_authorization_rule( :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SBAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBAuthorizationRule + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] @@ -323,7 +323,7 @@ def get_authorization_rule( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) @@ -355,7 +355,7 @@ def list_keys( :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessKeys, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.AccessKeys + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] @@ -391,7 +391,7 @@ def list_keys( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AccessKeys', pipeline_response) @@ -423,10 +423,10 @@ def regenerate_keys( :param authorization_rule_name: The authorization rule name. :type authorization_rule_name: str :param parameters: Parameters supplied to regenerate the authorization rule. - :type parameters: ~azure.mgmt.servicebus.models.RegenerateAccessKeyParameters + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessKeys, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.AccessKeys + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] @@ -467,7 +467,7 @@ def regenerate_keys( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AccessKeys', pipeline_response) @@ -501,7 +501,7 @@ def list_by_namespace( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SBQueueListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.SBQueueListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBQueueListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueueListResult"] @@ -555,7 +555,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -584,10 +584,10 @@ def create_or_update( :param queue_name: The queue name. :type queue_name: str :param parameters: Parameters supplied to create or update a queue resource. - :type parameters: ~azure.mgmt.servicebus.models.SBQueue + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue :keyword callable cls: A custom type or function that will be passed the direct response :return: SBQueue, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBQueue + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] @@ -627,7 +627,7 @@ def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBQueue', pipeline_response) @@ -691,7 +691,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -717,7 +717,7 @@ def get( :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SBQueue, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBQueue + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] @@ -752,7 +752,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBQueue', pipeline_response) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_regions_operations.py similarity index 96% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_regions_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_regions_operations.py index b10bb49c94e97..d51da019ed216 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_regions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_regions_operations.py @@ -30,7 +30,7 @@ class RegionsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2017_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -57,7 +57,7 @@ def list_by_sku( :type sku: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.PremiumMessagingRegionsListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PremiumMessagingRegionsListResult"] @@ -106,7 +106,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_rules_operations.py similarity index 96% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_rules_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_rules_operations.py index d57a7c170c6bd..6ac47885d166e 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_rules_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_rules_operations.py @@ -30,7 +30,7 @@ class RulesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2017_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -74,7 +74,7 @@ def list_by_subscriptions( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.RuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.RuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleListResult"] @@ -130,7 +130,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -165,10 +165,10 @@ def create_or_update( :param rule_name: The rule name. :type rule_name: str :param parameters: Parameters supplied to create a rule. - :type parameters: ~azure.mgmt.servicebus.models.Rule + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.Rule :keyword callable cls: A custom type or function that will be passed the direct response :return: Rule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.Rule + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.Rule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] @@ -210,7 +210,7 @@ def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Rule', pipeline_response) @@ -282,7 +282,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -314,7 +314,7 @@ def get( :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Rule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.Rule + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.Rule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] @@ -351,7 +351,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Rule', pipeline_response) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_subscriptions_operations.py similarity index 95% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_subscriptions_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_subscriptions_operations.py index 5891897defaa6..b936d1cb8a0c1 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_subscriptions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_subscriptions_operations.py @@ -30,7 +30,7 @@ class SubscriptionsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2017_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -71,7 +71,7 @@ def list_by_topic( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SBSubscriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.SBSubscriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBSubscriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscriptionListResult"] @@ -126,7 +126,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -158,10 +158,10 @@ def create_or_update( :param subscription_name: The subscription name. :type subscription_name: str :param parameters: Parameters supplied to create a subscription resource. - :type parameters: ~azure.mgmt.servicebus.models.SBSubscription + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription :keyword callable cls: A custom type or function that will be passed the direct response :return: SBSubscription, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBSubscription + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] @@ -202,7 +202,7 @@ def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBSubscription', pipeline_response) @@ -270,7 +270,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -299,7 +299,7 @@ def get( :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SBSubscription, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBSubscription + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] @@ -335,7 +335,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBSubscription', pipeline_response) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_topics_operations.py similarity index 95% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_topics_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_topics_operations.py index 6324fb4f3d4c8..24d62f126806e 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_topics_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_topics_operations.py @@ -30,7 +30,7 @@ class TopicsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2017_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -63,7 +63,7 @@ def list_authorization_rules( :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.SBAuthorizationRuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] @@ -114,7 +114,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -146,10 +146,10 @@ def create_or_update_authorization_rule( :param authorization_rule_name: The authorization rule name. :type authorization_rule_name: str :param parameters: The shared access authorization rule. - :type parameters: ~azure.mgmt.servicebus.models.SBAuthorizationRule + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule :keyword callable cls: A custom type or function that will be passed the direct response :return: SBAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBAuthorizationRule + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] @@ -190,7 +190,7 @@ def create_or_update_authorization_rule( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) @@ -222,7 +222,7 @@ def get_authorization_rule( :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SBAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBAuthorizationRule + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] @@ -258,7 +258,7 @@ def get_authorization_rule( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) @@ -326,7 +326,7 @@ def delete_authorization_rule( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -355,7 +355,7 @@ def list_keys( :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessKeys, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.AccessKeys + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] @@ -391,7 +391,7 @@ def list_keys( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AccessKeys', pipeline_response) @@ -423,10 +423,10 @@ def regenerate_keys( :param authorization_rule_name: The authorization rule name. :type authorization_rule_name: str :param parameters: Parameters supplied to regenerate the authorization rule. - :type parameters: ~azure.mgmt.servicebus.models.RegenerateAccessKeyParameters + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessKeys, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.AccessKeys + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] @@ -467,7 +467,7 @@ def regenerate_keys( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AccessKeys', pipeline_response) @@ -501,7 +501,7 @@ def list_by_namespace( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SBTopicListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.SBTopicListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBTopicListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopicListResult"] @@ -555,7 +555,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -584,10 +584,10 @@ def create_or_update( :param topic_name: The topic name. :type topic_name: str :param parameters: Parameters supplied to create a topic resource. - :type parameters: ~azure.mgmt.servicebus.models.SBTopic + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic :keyword callable cls: A custom type or function that will be passed the direct response :return: SBTopic, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBTopic + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] @@ -627,7 +627,7 @@ def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBTopic', pipeline_response) @@ -691,7 +691,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -717,7 +717,7 @@ def get( :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SBTopic, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBTopic + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] @@ -752,7 +752,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBTopic', pipeline_response) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/py.typed b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/py.typed new file mode 100644 index 0000000000000..e5aff4f83af86 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/__init__.py new file mode 100644 index 0000000000000..f640dac181bb7 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/__init__.py @@ -0,0 +1,16 @@ +# 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 ._service_bus_management_client import ServiceBusManagementClient +__all__ = ['ServiceBusManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_configuration.py new file mode 100644 index 0000000000000..3c8784de19205 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_configuration.py @@ -0,0 +1,70 @@ +# 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 typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class ServiceBusManagementClientConfiguration(Configuration): + """Configuration for ServiceBusManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2018-01-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_metadata.json b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_metadata.json new file mode 100644 index 0000000000000..0a3a5cced2500 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_metadata.json @@ -0,0 +1,115 @@ +{ + "chosen_version": "2018-01-01-preview", + "total_api_version_list": ["2018-01-01-preview"], + "client": { + "name": "ServiceBusManagementClient", + "filename": "_service_bus_management_client", + "description": "Azure Service Bus client for managing Namespace, IPFilter Rules, VirtualNetworkRules and Zone Redundant.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "namespaces": "NamespacesOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations", + "private_link_resources": "PrivateLinkResourcesOperations", + "disaster_recovery_configs": "DisasterRecoveryConfigsOperations", + "queues": "QueuesOperations", + "topics": "TopicsOperations", + "event_hubs": "EventHubsOperations", + "migration_configs": "MigrationConfigsOperations", + "premium_messaging_regions": "PremiumMessagingRegionsOperations", + "regions": "RegionsOperations", + "subscriptions": "SubscriptionsOperations", + "rules": "RulesOperations", + "operations": "Operations" + } +} \ No newline at end of file diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_service_bus_management_client.py new file mode 100644 index 0000000000000..cdf7ad71819f1 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_service_bus_management_client.py @@ -0,0 +1,149 @@ +# 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 typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import ServiceBusManagementClientConfiguration +from .operations import NamespacesOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import PrivateLinkResourcesOperations +from .operations import DisasterRecoveryConfigsOperations +from .operations import QueuesOperations +from .operations import TopicsOperations +from .operations import EventHubsOperations +from .operations import MigrationConfigsOperations +from .operations import PremiumMessagingRegionsOperations +from .operations import RegionsOperations +from .operations import SubscriptionsOperations +from .operations import RulesOperations +from .operations import Operations +from . import models + + +class ServiceBusManagementClient(object): + """Azure Service Bus client for managing Namespace, IPFilter Rules, VirtualNetworkRules and Zone Redundant. + + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: azure.mgmt.servicebus.v2018_01_01_preview.operations.NamespacesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.servicebus.v2018_01_01_preview.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.servicebus.v2018_01_01_preview.operations.PrivateLinkResourcesOperations + :ivar disaster_recovery_configs: DisasterRecoveryConfigsOperations operations + :vartype disaster_recovery_configs: azure.mgmt.servicebus.v2018_01_01_preview.operations.DisasterRecoveryConfigsOperations + :ivar queues: QueuesOperations operations + :vartype queues: azure.mgmt.servicebus.v2018_01_01_preview.operations.QueuesOperations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.servicebus.v2018_01_01_preview.operations.TopicsOperations + :ivar event_hubs: EventHubsOperations operations + :vartype event_hubs: azure.mgmt.servicebus.v2018_01_01_preview.operations.EventHubsOperations + :ivar migration_configs: MigrationConfigsOperations operations + :vartype migration_configs: azure.mgmt.servicebus.v2018_01_01_preview.operations.MigrationConfigsOperations + :ivar premium_messaging_regions: PremiumMessagingRegionsOperations operations + :vartype premium_messaging_regions: azure.mgmt.servicebus.v2018_01_01_preview.operations.PremiumMessagingRegionsOperations + :ivar regions: RegionsOperations operations + :vartype regions: azure.mgmt.servicebus.v2018_01_01_preview.operations.RegionsOperations + :ivar subscriptions: SubscriptionsOperations operations + :vartype subscriptions: azure.mgmt.servicebus.v2018_01_01_preview.operations.SubscriptionsOperations + :ivar rules: RulesOperations operations + :vartype rules: azure.mgmt.servicebus.v2018_01_01_preview.operations.RulesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.servicebus.v2018_01_01_preview.operations.Operations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = ServiceBusManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.namespaces = NamespacesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.queues = QueuesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.event_hubs = EventHubsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.migration_configs = MigrationConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.premium_messaging_regions = PremiumMessagingRegionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.regions = RegionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ServiceBusManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/__init__.py new file mode 100644 index 0000000000000..9016cbc217954 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/__init__.py @@ -0,0 +1,10 @@ +# 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 ._service_bus_management_client import ServiceBusManagementClient +__all__ = ['ServiceBusManagementClient'] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_configuration.py new file mode 100644 index 0000000000000..8adc3cc7abf89 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class ServiceBusManagementClientConfiguration(Configuration): + """Configuration for ServiceBusManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2018-01-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_service_bus_management_client.py new file mode 100644 index 0000000000000..b64408c385171 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_service_bus_management_client.py @@ -0,0 +1,142 @@ +# 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 typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import ServiceBusManagementClientConfiguration +from .operations import NamespacesOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import PrivateLinkResourcesOperations +from .operations import DisasterRecoveryConfigsOperations +from .operations import QueuesOperations +from .operations import TopicsOperations +from .operations import EventHubsOperations +from .operations import MigrationConfigsOperations +from .operations import PremiumMessagingRegionsOperations +from .operations import RegionsOperations +from .operations import SubscriptionsOperations +from .operations import RulesOperations +from .operations import Operations +from .. import models + + +class ServiceBusManagementClient(object): + """Azure Service Bus client for managing Namespace, IPFilter Rules, VirtualNetworkRules and Zone Redundant. + + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.NamespacesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.PrivateLinkResourcesOperations + :ivar disaster_recovery_configs: DisasterRecoveryConfigsOperations operations + :vartype disaster_recovery_configs: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.DisasterRecoveryConfigsOperations + :ivar queues: QueuesOperations operations + :vartype queues: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.QueuesOperations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.TopicsOperations + :ivar event_hubs: EventHubsOperations operations + :vartype event_hubs: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.EventHubsOperations + :ivar migration_configs: MigrationConfigsOperations operations + :vartype migration_configs: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.MigrationConfigsOperations + :ivar premium_messaging_regions: PremiumMessagingRegionsOperations operations + :vartype premium_messaging_regions: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.PremiumMessagingRegionsOperations + :ivar regions: RegionsOperations operations + :vartype regions: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.RegionsOperations + :ivar subscriptions: SubscriptionsOperations operations + :vartype subscriptions: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.SubscriptionsOperations + :ivar rules: RulesOperations operations + :vartype rules: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.RulesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.Operations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = ServiceBusManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.namespaces = NamespacesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.queues = QueuesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.event_hubs = EventHubsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.migration_configs = MigrationConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.premium_messaging_regions = PremiumMessagingRegionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.regions = RegionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ServiceBusManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/__init__.py similarity index 100% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/__init__.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/__init__.py index 629acc6e01a4a..d7920f85ee2cc 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/__init__.py @@ -9,7 +9,6 @@ from ._namespaces_operations import NamespacesOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._operations import Operations from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations from ._queues_operations import QueuesOperations from ._topics_operations import TopicsOperations @@ -19,12 +18,12 @@ from ._regions_operations import RegionsOperations from ._subscriptions_operations import SubscriptionsOperations from ._rules_operations import RulesOperations +from ._operations import Operations __all__ = [ 'NamespacesOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', - 'Operations', 'DisasterRecoveryConfigsOperations', 'QueuesOperations', 'TopicsOperations', @@ -34,4 +33,5 @@ 'RegionsOperations', 'SubscriptionsOperations', 'RulesOperations', + 'Operations', ] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py new file mode 100644 index 0000000000000..84c77d6715051 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py @@ -0,0 +1,725 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DisasterRecoveryConfigsOperations: + """DisasterRecoveryConfigsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.CheckNameAvailability", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": + """Check the give namespace name availability. + + :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 parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability'} # type: ignore + + def list( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ArmDisasterRecoveryListResult"]: + """Gets all Alias(Disaster Recovery configurations). + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecoveryListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecoveryListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ArmDisasterRecoveryListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: "_models.ArmDisasterRecovery", + **kwargs: Any + ) -> Optional["_models.ArmDisasterRecovery"]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :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 alias: The Disaster Recovery configuration name. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ArmDisasterRecovery"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ArmDisasterRecovery') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> None: + """Deletes an Alias(Disaster Recovery configuration). + + :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 alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> "_models.ArmDisasterRecovery": + """Retrieves Alias(Disaster Recovery configuration) for primary or secondary 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 alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecovery"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + async def break_pairing( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> None: + """This operation disables the Disaster Recovery and stops replicating changes from primary to + secondary namespaces. + + :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 alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.break_pairing.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + break_pairing.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing'} # type: ignore + + async def fail_over( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional["_models.FailoverProperties"] = None, + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary 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 alias: The Disaster Recovery configuration name. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.FailoverProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.fail_over.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'FailoverProperties') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + fail_over.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets the authorization 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 alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Gets an authorization rule 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 alias: The Disaster Recovery configuration name. + :type alias: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Gets the primary and secondary connection strings for the 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 alias: The Disaster Recovery configuration name. + :type alias: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_event_hubs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_event_hubs_operations.py new file mode 100644 index 0000000000000..da37d7f759eef --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_event_hubs_operations.py @@ -0,0 +1,117 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class EventHubsOperations: + """EventHubsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_namespace( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.EventHubListResult"]: + """Gets all the Event Hubs in a service bus 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventHubListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.EventHubListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EventHubListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/eventhubs'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_migration_configs_operations.py new file mode 100644 index 0000000000000..0844d0922df09 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_migration_configs_operations.py @@ -0,0 +1,499 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MigrationConfigsOperations: + """MigrationConfigsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.MigrationConfigListResult"]: + """Gets all migrationConfigurations. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MigrationConfigListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('MigrationConfigListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations'} # type: ignore + + async def _create_and_start_migration_initial( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + parameters: "_models.MigrationConfigProperties", + **kwargs: Any + ) -> Optional["_models.MigrationConfigProperties"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MigrationConfigProperties"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_and_start_migration_initial.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'MigrationConfigProperties') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_and_start_migration_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + parameters: "_models.MigrationConfigProperties", + **kwargs: Any + ) -> AsyncLROPoller["_models.MigrationConfigProperties"]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + 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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationConfigProperties or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigProperties"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_and_start_migration_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + config_name=config_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_and_start_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> None: + """Deletes a MigrationConfiguration. + + :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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> "_models.MigrationConfigProperties": + """Retrieves Migration Config. + + :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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigrationConfigProperties, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def complete_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> None: + """This operation Completes Migration of entities by pointing the connection strings to Premium + namespace and any entities created after the operation will be under Premium Namespace. + CompleteMigration operation will fail when entity migration is in-progress. + + :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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.complete_migration.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + complete_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade'} # type: ignore + + async def revert( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> None: + """This operation reverts Migration. + + :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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.revert.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + revert.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_namespaces_operations.py new file mode 100644 index 0000000000000..7b474ace9b7af --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_namespaces_operations.py @@ -0,0 +1,1820 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NamespacesOperations: + """NamespacesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_ip_filter_rules( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.IpFilterRuleListResult"]: + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IpFilterRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IpFilterRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_ip_filter_rules.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IpFilterRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_ip_filter_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules'} # type: ignore + + async def create_or_update_ip_filter_rule( + self, + resource_group_name: str, + namespace_name: str, + ip_filter_rule_name: str, + parameters: "_models.IpFilterRule", + **kwargs: Any + ) -> "_models.IpFilterRule": + """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.v2018_01_01_preview.models.IpFilterRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpFilterRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IpFilterRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_ip_filter_rule.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'IpFilterRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IpFilterRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_ip_filter_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}'} # type: ignore + + async def delete_ip_filter_rule( + self, + resource_group_name: str, + namespace_name: str, + ip_filter_rule_name: str, + **kwargs: Any + ) -> None: + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_ip_filter_rule.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_ip_filter_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}'} # type: ignore + + async def get_ip_filter_rule( + self, + resource_group_name: str, + namespace_name: str, + ip_filter_rule_name: str, + **kwargs: Any + ) -> "_models.IpFilterRule": + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpFilterRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IpFilterRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_ip_filter_rule.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IpFilterRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_ip_filter_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}'} # type: ignore + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.SBNamespaceListResult"]: + """Gets all the available namespaces within the subscription, irrespective of the resource groups. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBNamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBNamespaceListResult"]: + """Gets the available namespaces within a resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBNamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.SBNamespace", + **kwargs: Any + ) -> Optional["_models.SBNamespace"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SBNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + 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'), + '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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespace') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.SBNamespace", + **kwargs: Any + ) -> AsyncLROPoller["_models.SBNamespace"]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + :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 parameters: Parameters supplied to create a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SBNamespace or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespace"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing namespace. This operation also removes all associated resources under the + 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> "_models.SBNamespace": + """Gets a description for the specified 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.SBNamespaceUpdateParameters", + **kwargs: Any + ) -> Optional["_models.SBNamespace"]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :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 parameters: Parameters supplied to update a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SBNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespaceUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def list_virtual_network_rules( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualNetworkRuleListResult"]: + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualNetworkRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_virtual_network_rules.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualNetworkRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_virtual_network_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules'} # type: ignore + + async def create_or_update_virtual_network_rule( + self, + resource_group_name: str, + namespace_name: str, + virtual_network_rule_name: str, + parameters: "_models.VirtualNetworkRule", + **kwargs: Any + ) -> "_models.VirtualNetworkRule": + """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 parameters: The Namespace VirtualNetworkRule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_virtual_network_rule.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VirtualNetworkRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualNetworkRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_virtual_network_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}'} # type: ignore + + async def delete_virtual_network_rule( + self, + resource_group_name: str, + namespace_name: str, + virtual_network_rule_name: str, + **kwargs: Any + ) -> None: + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_virtual_network_rule.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_virtual_network_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}'} # type: ignore + + async def get_virtual_network_rule( + self, + resource_group_name: str, + namespace_name: str, + virtual_network_rule_name: str, + **kwargs: Any + ) -> "_models.VirtualNetworkRule": + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_virtual_network_rule.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualNetworkRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_virtual_network_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets the authorization 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: "_models.SBAuthorizationRule", + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Creates or updates an authorization rule 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a namespace authorization rule. + + :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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Gets an authorization rule 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Gets the primary and secondary connection strings for the 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateAccessKeyParameters", + **kwargs: Any + ) -> "_models.AccessKeys": + """Regenerates the primary or secondary connection strings for the 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + async def check_name_availability( + self, + parameters: "_models.CheckNameAvailability", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability'} # type: ignore + + async def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.NetworkRuleSet", + **kwargs: Any + ) -> "_models.NetworkRuleSet": + """Create or update NetworkRuleSet 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 parameters: The Namespace IpFilterRule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_network_rule_set.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkRuleSet') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + async def get_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> "_models.NetworkRuleSet": + """Gets NetworkRuleSet 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_network_rule_set.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + def list_network_rule_sets( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkRuleSetListResult"]: + """Gets list of NetworkRuleSet 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkRuleSetListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_network_rule_sets.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkRuleSetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_network_rule_sets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets'} # type: ignore + + async def migrate( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.SBNamespaceMigrate", + **kwargs: Any + ) -> None: + """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 parameters: Parameters supplied to migrate namespace type. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceMigrate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.migrate.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespaceMigrate') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + migrate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrate'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_operations.py new file mode 100644 index 0000000000000..e39e4293a66b7 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_operations.py @@ -0,0 +1,105 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists all of the available ServiceBus REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.ServiceBus/operations'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_premium_messaging_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_premium_messaging_regions_operations.py new file mode 100644 index 0000000000000..9cc942bc51083 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_premium_messaging_regions_operations.py @@ -0,0 +1,109 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PremiumMessagingRegionsOperations: + """PremiumMessagingRegionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.PremiumMessagingRegionsListResult"]: + """Gets the available premium messaging regions for servicebus. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PremiumMessagingRegionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PremiumMessagingRegionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/premiumMessagingRegions'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 0000000000000..116e01dd11c1e --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,374 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations: + """PrivateEndpointConnectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: + """Gets the available PrivateEndpointConnections within 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Creates or updates PrivateEndpointConnections of service 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 private_endpoint_connection_name: The PrivateEndpointConnection name. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + '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), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + 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'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing Private Endpoint Connection. + + :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 private_endpoint_connection_name: The PrivateEndpointConnection name. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Gets a description for the specified Private Endpoint Connection. + + :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 private_endpoint_connection_name: The PrivateEndpointConnection name. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_private_link_resources_operations.py new file mode 100644 index 0000000000000..81bc552d4f69a --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,100 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations: + """PrivateLinkResourcesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourcesListResult": + """Gets lists of resources that supports Privatelinks. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourcesListResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateLinkResourcesListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_queues_operations.py new file mode 100644 index 0000000000000..a1bb57addf513 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_queues_operations.py @@ -0,0 +1,750 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class QueuesOperations: + """QueuesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets all authorization rules for a queue. + + :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 queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: "_models.SBAuthorizationRule", + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Creates an authorization rule for a queue. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a queue authorization rule. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Gets an authorization rule for a queue 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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Primary and secondary connection strings to the queue. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateAccessKeyParameters", + **kwargs: Any + ) -> "_models.AccessKeys": + """Regenerates the primary or secondary connection strings to the queue. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def list_by_namespace( + self, + resource_group_name: str, + namespace_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SBQueueListResult"]: + """Gets the queues within 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 skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBQueueListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueueListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueueListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBQueueListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: "_models.SBQueue", + **kwargs: Any + ) -> "_models.SBQueue": + """Creates or updates a Service Bus queue. This operation is idempotent. + + :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 queue_name: The queue name. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBQueue') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> None: + """Deletes a queue from the specified namespace in a resource group. + + :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 queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> "_models.SBQueue": + """Returns a description for the specified queue. + + :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 queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_regions_operations.py new file mode 100644 index 0000000000000..d66ac64fac84e --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_regions_operations.py @@ -0,0 +1,113 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RegionsOperations: + """RegionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_sku( + self, + sku: str, + **kwargs: Any + ) -> AsyncIterable["_models.PremiumMessagingRegionsListResult"]: + """Gets the available Regions for a given sku. + + :param sku: The sku type. + :type sku: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PremiumMessagingRegionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_sku.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'sku': self._serialize.url("sku", sku, 'str', max_length=50, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PremiumMessagingRegionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_sku.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/sku/{sku}/regions'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_rules_operations.py new file mode 100644 index 0000000000000..23ebdb5d088fa --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_rules_operations.py @@ -0,0 +1,355 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RulesOperations: + """RulesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_subscriptions( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.RuleListResult"]: + """List all the rules within given topic-subscription. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.RuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscriptions.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscriptions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: "_models.Rule", + **kwargs: Any + ) -> "_models.Rule": + """Creates a new rule and updates an existing rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Rule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Rule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + **kwargs: Any + ) -> None: + """Deletes an existing rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + **kwargs: Any + ) -> "_models.Rule": + """Retrieves the description for the specified rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Rule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_subscriptions_operations.py new file mode 100644 index 0000000000000..009e1fabce400 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_subscriptions_operations.py @@ -0,0 +1,339 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionsOperations: + """SubscriptionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_topic( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SBSubscriptionListResult"]: + """List all the subscriptions under a specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBSubscriptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_topic.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBSubscriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_topic.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: "_models.SBSubscription", + **kwargs: Any + ) -> "_models.SBSubscription": + """Creates a topic subscription. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBSubscription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + **kwargs: Any + ) -> None: + """Deletes a subscription from the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + **kwargs: Any + ) -> "_models.SBSubscription": + """Returns a subscription description for the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_topics_operations.py new file mode 100644 index 0000000000000..59854f70f6586 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_topics_operations.py @@ -0,0 +1,750 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TopicsOperations: + """TopicsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets authorization rules for a topic. + + :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 topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: "_models.SBAuthorizationRule", + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Creates an authorization rule for the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Returns the specified authorization rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a topic authorization rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Gets the primary and secondary connection strings for the topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateAccessKeyParameters", + **kwargs: Any + ) -> "_models.AccessKeys": + """Regenerates primary or secondary connection strings for the topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def list_by_namespace( + self, + resource_group_name: str, + namespace_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SBTopicListResult"]: + """Gets all the topics in 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 skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBTopicListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopicListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopicListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBTopicListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: "_models.SBTopic", + **kwargs: Any + ) -> "_models.SBTopic": + """Creates a topic in the specified 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 topic_name: The topic name. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBTopic') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> None: + """Deletes a topic from the specified namespace and resource group. + + :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 topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> "_models.SBTopic": + """Returns a description for the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/__init__.py similarity index 98% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models/__init__.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/__init__.py index a2aa3710b8ade..2297b182a4e23 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/__init__.py @@ -34,6 +34,7 @@ from ._models_py3 import NWRuleSetIpRules from ._models_py3 import NWRuleSetVirtualNetworkRules from ._models_py3 import NetworkRuleSet + from ._models_py3 import NetworkRuleSetListResult from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult @@ -97,6 +98,7 @@ from ._models import NWRuleSetIpRules # type: ignore from ._models import NWRuleSetVirtualNetworkRules # type: ignore from ._models import NetworkRuleSet # type: ignore + from ._models import NetworkRuleSetListResult # type: ignore from ._models import Operation # type: ignore from ._models import OperationDisplay # type: ignore from ._models import OperationListResult # type: ignore @@ -181,6 +183,7 @@ 'NWRuleSetIpRules', 'NWRuleSetVirtualNetworkRules', 'NetworkRuleSet', + 'NetworkRuleSetListResult', 'Operation', 'OperationDisplay', 'OperationListResult', diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models/_models.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_models.py similarity index 92% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models/_models.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_models.py index 08f6e4c1fdd9e..ec2121970f1d4 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models/_models.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_models.py @@ -149,7 +149,8 @@ class ArmDisasterRecovery(Resource): :ivar provisioning_state: Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' or 'Succeeded' or 'Failed'. Possible values include: "Accepted", "Succeeded", "Failed". - :vartype provisioning_state: str or ~azure.mgmt.servicebus.models.ProvisioningStateDR + :vartype provisioning_state: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.ProvisioningStateDR :ivar pending_replication_operations_count: Number of entities pending to be replicated. :vartype pending_replication_operations_count: long :param partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is @@ -160,7 +161,7 @@ class ArmDisasterRecovery(Resource): :type alternate_name: str :ivar role: role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' or 'Secondary'. Possible values include: "Primary", "PrimaryNotReplicating", "Secondary". - :vartype role: str or ~azure.mgmt.servicebus.models.RoleDisasterRecovery + :vartype role: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.RoleDisasterRecovery """ _validation = { @@ -201,7 +202,7 @@ class ArmDisasterRecoveryListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: List of Alias(Disaster Recovery configurations). - :type value: list[~azure.mgmt.servicebus.models.ArmDisasterRecovery] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery] :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of Alias(Disaster Recovery configuration). :vartype next_link: str @@ -232,7 +233,8 @@ class CaptureDescription(msrest.serialization.Model): :type enabled: bool :param encoding: Enumerates the possible values for the encoding format of capture description. Possible values include: "Avro", "AvroDeflate". - :type encoding: str or ~azure.mgmt.servicebus.models.EncodingCaptureDescription + :type encoding: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.EncodingCaptureDescription :param interval_in_seconds: The time window allows you to set the frequency with which the capture to Azure Blobs will happen, value should between 60 to 900 seconds. :type interval_in_seconds: int @@ -241,7 +243,7 @@ class CaptureDescription(msrest.serialization.Model): :type size_limit_in_bytes: int :param destination: Properties of Destination where capture will be stored. (Storage Account, Blob Names). - :type destination: ~azure.mgmt.servicebus.models.Destination + :type destination: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Destination """ _validation = { @@ -309,7 +311,7 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): :param reason: The reason for unavailability of a namespace. Possible values include: "None", "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", "TooManyNamespaceInCurrentSubscription". - :type reason: str or ~azure.mgmt.servicebus.models.UnavailableReason + :type reason: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.UnavailableReason """ _validation = { @@ -337,7 +339,8 @@ class ConnectionState(msrest.serialization.Model): :param status: Status of the connection. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". - :type status: str or ~azure.mgmt.servicebus.models.PrivateLinkConnectionStatus + :type status: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateLinkConnectionStatus :param description: Description of the connection state. :type description: str """ @@ -449,32 +452,27 @@ def __init__( class Encryption(msrest.serialization.Model): """Properties to configure Encryption. - Variables are only populated by the server, and will be ignored when sending a request. - :param key_vault_properties: Properties of KeyVault. - :type key_vault_properties: ~azure.mgmt.servicebus.models.KeyVaultProperties - :ivar key_source: Enumerates the possible value of keySource for Encryption. Default value: + :type key_vault_properties: + ~azure.mgmt.servicebus.v2018_01_01_preview.models.KeyVaultProperties + :param key_source: Enumerates the possible value of keySource for Encryption. The only + acceptable values to pass in are None and "Microsoft.KeyVault". The default value is "Microsoft.KeyVault". - :vartype key_source: str + :type key_source: str """ - _validation = { - 'key_source': {'constant': True}, - } - _attribute_map = { 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'}, 'key_source': {'key': 'keySource', 'type': 'str'}, } - key_source = "Microsoft.KeyVault" - def __init__( self, **kwargs ): super(Encryption, self).__init__(**kwargs) self.key_vault_properties = kwargs.get('key_vault_properties', None) + self.key_source = kwargs.get('key_source', "Microsoft.KeyVault") class ErrorAdditionalInfo(msrest.serialization.Model): @@ -485,7 +483,7 @@ class ErrorAdditionalInfo(msrest.serialization.Model): :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: object + :vartype info: any """ _validation = { @@ -511,7 +509,7 @@ class ErrorResponse(msrest.serialization.Model): """The resource management error response. :param error: The error object. - :type error: ~azure.mgmt.servicebus.models.ErrorResponseError + :type error: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ErrorResponseError """ _attribute_map = { @@ -538,9 +536,10 @@ class ErrorResponseError(msrest.serialization.Model): :ivar target: The error target. :vartype target: str :ivar details: The error details. - :vartype details: list[~azure.mgmt.servicebus.models.ErrorResponse] + :vartype details: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.ErrorResponse] :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.servicebus.models.ErrorAdditionalInfo] + :vartype additional_info: + list[~azure.mgmt.servicebus.v2018_01_01_preview.models.ErrorAdditionalInfo] """ _validation = { @@ -597,9 +596,9 @@ class Eventhub(Resource): :param status: Enumerates the possible values for the status of a Event Hub. Possible values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", "Deleting", "Renaming", "Unknown". - :type status: str or ~azure.mgmt.servicebus.models.EntityStatus + :type status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :param capture_description: Properties of capture description. - :type capture_description: ~azure.mgmt.servicebus.models.CaptureDescription + :type capture_description: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CaptureDescription """ _validation = { @@ -646,7 +645,7 @@ class EventHubListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: Result of the List EventHubs operation. - :type value: list[~azure.mgmt.servicebus.models.Eventhub] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.Eventhub] :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of EventHubs. :vartype next_link: str @@ -693,29 +692,22 @@ def __init__( class Identity(msrest.serialization.Model): """Properties to configure Identity for Bring your Own Keys. - Variables are only populated by the server, and will be ignored when sending a request. - :param principal_id: ObjectId from the KeyVault. :type principal_id: str :param tenant_id: TenantId from the KeyVault. :type tenant_id: str - :ivar type: Enumerates the possible value Identity type, which currently supports only - 'SystemAssigned'. Default value: "SystemAssigned". - :vartype type: str + :param type: Enumerates the possible value Identity type, which currently supports only + 'SystemAssigned'. The only acceptable values to pass in are None and "SystemAssigned". The + default value is "SystemAssigned". + :type type: str """ - _validation = { - 'type': {'constant': True}, - } - _attribute_map = { 'principal_id': {'key': 'principalId', 'type': 'str'}, 'tenant_id': {'key': 'tenantId', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, } - type = "SystemAssigned" - def __init__( self, **kwargs @@ -723,6 +715,7 @@ def __init__( super(Identity, self).__init__(**kwargs) self.principal_id = kwargs.get('principal_id', None) self.tenant_id = kwargs.get('tenant_id', None) + self.type = kwargs.get('type', "SystemAssigned") class IpFilterRule(Resource): @@ -739,7 +732,7 @@ class IpFilterRule(Resource): :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 + :type action: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.IPAction :param filter_name: IP Filter name. :type filter_name: str """ @@ -773,7 +766,7 @@ class IpFilterRuleListResult(msrest.serialization.Model): """The response from the List namespace operation. :param value: Result of the List IpFilter Rules operation. - :type value: list[~azure.mgmt.servicebus.models.IpFilterRule] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule] :param next_link: Link to the next set of results. Not empty if Value contains an incomplete list of IpFilter Rules. :type next_link: str @@ -868,7 +861,7 @@ class MigrationConfigListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: List of Migration Configs. - :type value: list[~azure.mgmt.servicebus.models.MigrationConfigProperties] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties] :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of migrationConfigurations. :vartype next_link: str @@ -950,7 +943,7 @@ def __init__( class NetworkRuleSet(Resource): - """Description of topic resource. + """Description of NetworkRuleSet resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -962,11 +955,12 @@ class NetworkRuleSet(Resource): :vartype type: str :param default_action: Default Action for Network Rule Set. Possible values include: "Allow", "Deny". - :type default_action: str or ~azure.mgmt.servicebus.models.DefaultAction + :type default_action: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.DefaultAction :param virtual_network_rules: List VirtualNetwork Rules. - :type virtual_network_rules: list[~azure.mgmt.servicebus.models.NWRuleSetVirtualNetworkRules] + :type virtual_network_rules: + list[~azure.mgmt.servicebus.v2018_01_01_preview.models.NWRuleSetVirtualNetworkRules] :param ip_rules: List of IpRules. - :type ip_rules: list[~azure.mgmt.servicebus.models.NWRuleSetIpRules] + :type ip_rules: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.NWRuleSetIpRules] """ _validation = { @@ -994,13 +988,37 @@ def __init__( self.ip_rules = kwargs.get('ip_rules', None) +class NetworkRuleSetListResult(msrest.serialization.Model): + """The response of the List NetworkRuleSet operation. + + :param value: Result of the List NetworkRuleSet operation. + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of NetworkRuleSet. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkRuleSet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkRuleSetListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + class NWRuleSetIpRules(msrest.serialization.Model): - """The response from the List namespace operation. + """Description of NetWorkRuleSet - IpRules resource. :param ip_mask: IP Mask. :type ip_mask: str - :param action: The IP Filter Action. Possible values include: "Allow". - :type action: str or ~azure.mgmt.servicebus.models.NetworkRuleIPAction + :param action: The IP Filter Action. Possible values include: "Allow". Default value: "Allow". + :type action: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleIPAction """ _attribute_map = { @@ -1014,16 +1032,16 @@ def __init__( ): super(NWRuleSetIpRules, self).__init__(**kwargs) self.ip_mask = kwargs.get('ip_mask', None) - self.action = kwargs.get('action', None) + self.action = kwargs.get('action', "Allow") class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): - """The response from the List namespace operation. + """Description of VirtualNetworkRules - NetworkRules resource. :param subnet: Subnet properties. - :type subnet: ~azure.mgmt.servicebus.models.Subnet + :type subnet: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Subnet :param ignore_missing_vnet_service_endpoint: Value that indicates whether to ignore missing - Vnet Service Endpoint. + VNet Service Endpoint. :type ignore_missing_vnet_service_endpoint: bool """ @@ -1049,7 +1067,7 @@ class Operation(msrest.serialization.Model): :ivar name: Operation name: {provider}/{resource}/{operation}. :vartype name: str :param display: The object that represents the operation. - :type display: ~azure.mgmt.servicebus.models.OperationDisplay + :type display: ~azure.mgmt.servicebus.v2018_01_01_preview.models.OperationDisplay """ _validation = { @@ -1112,7 +1130,7 @@ class OperationListResult(msrest.serialization.Model): :ivar value: List of ServiceBus operations supported by the Microsoft.ServiceBus resource provider. - :vartype value: list[~azure.mgmt.servicebus.models.Operation] + :vartype value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.Operation] :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -1192,7 +1210,8 @@ class PremiumMessagingRegions(ResourceNamespacePatch): :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param properties: - :type properties: ~azure.mgmt.servicebus.models.PremiumMessagingRegionsProperties + :type properties: + ~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegionsProperties """ _validation = { @@ -1224,7 +1243,7 @@ class PremiumMessagingRegionsListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: Result of the List PremiumMessagingRegions type. - :type value: list[~azure.mgmt.servicebus.models.PremiumMessagingRegions] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegions] :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of PremiumMessagingRegions. :vartype next_link: str @@ -1309,12 +1328,14 @@ class PrivateEndpointConnection(Resource): :ivar type: Resource type. :vartype type: str :param private_endpoint: The Private Endpoint resource for this Connection. - :type private_endpoint: ~azure.mgmt.servicebus.models.PrivateEndpoint + :type private_endpoint: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpoint :param private_link_service_connection_state: Details about the state of the connection. - :type private_link_service_connection_state: ~azure.mgmt.servicebus.models.ConnectionState + :type private_link_service_connection_state: + ~azure.mgmt.servicebus.v2018_01_01_preview.models.ConnectionState :param provisioning_state: Provisioning state of the Private Endpoint Connection. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". - :type provisioning_state: str or ~azure.mgmt.servicebus.models.EndPointProvisioningState + :type provisioning_state: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.EndPointProvisioningState """ _validation = { @@ -1346,7 +1367,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """Result of the list of all private endpoint connections operation. :param value: A collection of private endpoint connection resources. - :type value: list[~azure.mgmt.servicebus.models.PrivateEndpointConnection] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection] :param next_link: A link for the next page of private endpoint connection resources. :type next_link: str """ @@ -1408,7 +1429,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """Result of the List private link resources operation. :param value: A collection of private link resources. - :type value: list[~azure.mgmt.servicebus.models.PrivateLinkResource] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateLinkResource] :param next_link: A link for the next page of private link resources. :type next_link: str """ @@ -1434,7 +1455,7 @@ class RegenerateAccessKeyParameters(msrest.serialization.Model): :param key_type: Required. The access key to regenerate. Possible values include: "PrimaryKey", "SecondaryKey". - :type key_type: str or ~azure.mgmt.servicebus.models.KeyType + :type key_type: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.KeyType :param key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key value set for keyType. :type key: str @@ -1471,14 +1492,14 @@ class Rule(Resource): :vartype type: str :param action: Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. - :type action: ~azure.mgmt.servicebus.models.Action + :type action: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Action :param filter_type: Filter type that is evaluated against a BrokeredMessage. Possible values include: "SqlFilter", "CorrelationFilter". - :type filter_type: str or ~azure.mgmt.servicebus.models.FilterType + :type filter_type: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.FilterType :param sql_filter: Properties of sqlFilter. - :type sql_filter: ~azure.mgmt.servicebus.models.SqlFilter + :type sql_filter: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SqlFilter :param correlation_filter: Properties of correlationFilter. - :type correlation_filter: ~azure.mgmt.servicebus.models.CorrelationFilter + :type correlation_filter: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CorrelationFilter """ _validation = { @@ -1512,7 +1533,7 @@ class RuleListResult(msrest.serialization.Model): """The response of the List rule operation. :param value: Result of the List Rules operation. - :type value: list[~azure.mgmt.servicebus.models.Rule] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of rules. :type next_link: str @@ -1544,7 +1565,7 @@ class SBAuthorizationRule(Resource): :ivar type: Resource type. :vartype type: str :param rights: The rights associated with the rule. - :type rights: list[str or ~azure.mgmt.servicebus.models.AccessRights] + :type rights: list[str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessRights] """ _validation = { @@ -1572,7 +1593,7 @@ class SBAuthorizationRuleListResult(msrest.serialization.Model): """The response to the List Namespace operation. :param value: Result of the List Authorization Rules operation. - :type value: list[~azure.mgmt.servicebus.models.SBAuthorizationRule] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of Authorization Rules. :type next_link: str @@ -1653,11 +1674,13 @@ class SBNamespace(TrackedResource): :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param sku: Properties of SKU. - :type sku: ~azure.mgmt.servicebus.models.SBSku + :type sku: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSku :param identity: Properties of BYOK Identity description. - :type identity: ~azure.mgmt.servicebus.models.Identity + :type identity: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Identity :ivar provisioning_state: Provisioning state of the namespace. :vartype provisioning_state: str + :ivar status: Status of the namespace. + :vartype status: str :ivar created_at: The time the namespace was created. :vartype created_at: ~datetime.datetime :ivar updated_at: The time the namespace was updated. @@ -1670,7 +1693,7 @@ class SBNamespace(TrackedResource): regions supported availability zones. :type zone_redundant: bool :param encryption: Properties of BYOK Encryption description. - :type encryption: ~azure.mgmt.servicebus.models.Encryption + :type encryption: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Encryption """ _validation = { @@ -1679,6 +1702,7 @@ class SBNamespace(TrackedResource): 'type': {'readonly': True}, 'location': {'required': True}, 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, 'created_at': {'readonly': True}, 'updated_at': {'readonly': True}, 'service_bus_endpoint': {'readonly': True}, @@ -1694,6 +1718,7 @@ class SBNamespace(TrackedResource): 'sku': {'key': 'sku', 'type': 'SBSku'}, 'identity': {'key': 'identity', 'type': 'Identity'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, @@ -1710,6 +1735,7 @@ def __init__( self.sku = kwargs.get('sku', None) self.identity = kwargs.get('identity', None) self.provisioning_state = None + self.status = None self.created_at = None self.updated_at = None self.service_bus_endpoint = None @@ -1722,7 +1748,7 @@ class SBNamespaceListResult(msrest.serialization.Model): """The response of the List Namespace operation. :param value: Result of the List Namespace operation. - :type value: list[~azure.mgmt.servicebus.models.SBNamespace] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of Namespaces. :type next_link: str @@ -1749,7 +1775,8 @@ class SBNamespaceMigrate(msrest.serialization.Model): :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 + :type target_namespace_type: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.NameSpaceType """ _validation = { @@ -1784,11 +1811,13 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param sku: Properties of SKU. - :type sku: ~azure.mgmt.servicebus.models.SBSku + :type sku: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSku :param identity: Properties of BYOK Identity description. - :type identity: ~azure.mgmt.servicebus.models.Identity + :type identity: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Identity :ivar provisioning_state: Provisioning state of the namespace. :vartype provisioning_state: str + :ivar status: Status of the namespace. + :vartype status: str :ivar created_at: The time the namespace was created. :vartype created_at: ~datetime.datetime :ivar updated_at: The time the namespace was updated. @@ -1801,7 +1830,7 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): regions supported availability zones. :type zone_redundant: bool :param encryption: Properties of BYOK Encryption description. - :type encryption: ~azure.mgmt.servicebus.models.Encryption + :type encryption: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Encryption """ _validation = { @@ -1809,6 +1838,7 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): 'name': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, 'created_at': {'readonly': True}, 'updated_at': {'readonly': True}, 'service_bus_endpoint': {'readonly': True}, @@ -1824,6 +1854,7 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): 'sku': {'key': 'sku', 'type': 'SBSku'}, 'identity': {'key': 'identity', 'type': 'Identity'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, @@ -1840,6 +1871,7 @@ def __init__( self.sku = kwargs.get('sku', None) self.identity = kwargs.get('identity', None) self.provisioning_state = None + self.status = None self.created_at = None self.updated_at = None self.service_bus_endpoint = None @@ -1860,7 +1892,7 @@ class SBQueue(Resource): :ivar type: Resource type. :vartype type: str :ivar count_details: Message Count Details. - :vartype count_details: ~azure.mgmt.servicebus.models.MessageCountDetails + :vartype count_details: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MessageCountDetails :ivar created_at: The exact time the message was created. :vartype created_at: ~datetime.datetime :ivar updated_at: The exact time the message was updated. @@ -1901,7 +1933,7 @@ class SBQueue(Resource): :param status: Enumerates the possible values for the status of a messaging entity. Possible values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", "Deleting", "Renaming", "Unknown". - :type status: str or ~azure.mgmt.servicebus.models.EntityStatus + :type status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :param enable_batched_operations: Value that indicates whether server-side batched operations are enabled. :type enable_batched_operations: bool @@ -1991,7 +2023,7 @@ class SBQueueListResult(msrest.serialization.Model): """The response to the List Queues operation. :param value: Result of the List Queues operation. - :type value: list[~azure.mgmt.servicebus.models.SBQueue] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of queues. :type next_link: str @@ -2018,10 +2050,10 @@ class SBSku(msrest.serialization.Model): :param name: Required. Name of this SKU. Possible values include: "Basic", "Standard", "Premium". - :type name: str or ~azure.mgmt.servicebus.models.SkuName + :type name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.SkuName :param tier: The billing tier of this particular SKU. Possible values include: "Basic", "Standard", "Premium". - :type tier: str or ~azure.mgmt.servicebus.models.SkuTier + :type tier: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.SkuTier :param capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 and 4. :type capacity: int @@ -2067,7 +2099,7 @@ class SBSubscription(Resource): :ivar updated_at: The exact time the message was updated. :vartype updated_at: ~datetime.datetime :ivar count_details: Message count details. - :vartype count_details: ~azure.mgmt.servicebus.models.MessageCountDetails + :vartype count_details: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MessageCountDetails :param lock_duration: ISO 8061 lock duration timespan for the subscription. The default value is 1 minute. :type lock_duration: ~datetime.timedelta @@ -2091,7 +2123,7 @@ class SBSubscription(Resource): :param status: Enumerates the possible values for the status of a messaging entity. Possible values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", "Deleting", "Renaming", "Unknown". - :type status: str or ~azure.mgmt.servicebus.models.EntityStatus + :type status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :param enable_batched_operations: Value that indicates whether server-side batched operations are enabled. :type enable_batched_operations: bool @@ -2166,7 +2198,7 @@ class SBSubscriptionListResult(msrest.serialization.Model): """The response to the List Subscriptions operation. :param value: Result of the List Subscriptions operation. - :type value: list[~azure.mgmt.servicebus.models.SBSubscription] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of subscriptions. :type next_link: str @@ -2208,7 +2240,7 @@ class SBTopic(Resource): :ivar subscription_count: Number of subscriptions. :vartype subscription_count: int :ivar count_details: Message count details. - :vartype count_details: ~azure.mgmt.servicebus.models.MessageCountDetails + :vartype count_details: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MessageCountDetails :param default_message_time_to_live: ISO 8601 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. @@ -2228,7 +2260,7 @@ class SBTopic(Resource): :param status: Enumerates the possible values for the status of a messaging entity. Possible values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", "Deleting", "Renaming", "Unknown". - :type status: str or ~azure.mgmt.servicebus.models.EntityStatus + :type status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :param support_ordering: Value that indicates whether the topic supports ordering. :type support_ordering: bool :param auto_delete_on_idle: ISO 8601 timespan idle interval after which the topic is @@ -2303,7 +2335,7 @@ class SBTopicListResult(msrest.serialization.Model): """The response to the List Topics operation. :param value: Result of the List Topics operation. - :type value: list[~azure.mgmt.servicebus.models.SBTopic] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of topics. :type next_link: str @@ -2385,10 +2417,16 @@ def __init__( class Subnet(msrest.serialization.Model): """Properties supplied for Subnet. - :param id: Resource ID of Virtual Network Subnet. + All required parameters must be populated in order to send to Azure. + + :param id: Required. Resource ID of Virtual Network Subnet. :type id: str """ + _validation = { + 'id': {'required': True}, + } + _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, } @@ -2398,7 +2436,7 @@ def __init__( **kwargs ): super(Subnet, self).__init__(**kwargs) - self.id = kwargs.get('id', None) + self.id = kwargs['id'] class VirtualNetworkRule(Resource): @@ -2441,7 +2479,7 @@ class VirtualNetworkRuleListResult(msrest.serialization.Model): """The response from the List namespace operation. :param value: Result of the List VirtualNetwork Rules operation. - :type value: list[~azure.mgmt.servicebus.models.VirtualNetworkRule] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule] :param next_link: Link to the next set of results. Not empty if Value contains an incomplete list of VirtualNetwork Rules. :type next_link: str diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models/_models_py3.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_models_py3.py similarity index 92% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models/_models_py3.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_models_py3.py index 188b537a7b702..f3c4e3f939625 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models/_models_py3.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_models_py3.py @@ -158,7 +158,8 @@ class ArmDisasterRecovery(Resource): :ivar provisioning_state: Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' or 'Succeeded' or 'Failed'. Possible values include: "Accepted", "Succeeded", "Failed". - :vartype provisioning_state: str or ~azure.mgmt.servicebus.models.ProvisioningStateDR + :vartype provisioning_state: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.ProvisioningStateDR :ivar pending_replication_operations_count: Number of entities pending to be replicated. :vartype pending_replication_operations_count: long :param partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is @@ -169,7 +170,7 @@ class ArmDisasterRecovery(Resource): :type alternate_name: str :ivar role: role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' or 'Secondary'. Possible values include: "Primary", "PrimaryNotReplicating", "Secondary". - :vartype role: str or ~azure.mgmt.servicebus.models.RoleDisasterRecovery + :vartype role: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.RoleDisasterRecovery """ _validation = { @@ -213,7 +214,7 @@ class ArmDisasterRecoveryListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: List of Alias(Disaster Recovery configurations). - :type value: list[~azure.mgmt.servicebus.models.ArmDisasterRecovery] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery] :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of Alias(Disaster Recovery configuration). :vartype next_link: str @@ -246,7 +247,8 @@ class CaptureDescription(msrest.serialization.Model): :type enabled: bool :param encoding: Enumerates the possible values for the encoding format of capture description. Possible values include: "Avro", "AvroDeflate". - :type encoding: str or ~azure.mgmt.servicebus.models.EncodingCaptureDescription + :type encoding: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.EncodingCaptureDescription :param interval_in_seconds: The time window allows you to set the frequency with which the capture to Azure Blobs will happen, value should between 60 to 900 seconds. :type interval_in_seconds: int @@ -255,7 +257,7 @@ class CaptureDescription(msrest.serialization.Model): :type size_limit_in_bytes: int :param destination: Properties of Destination where capture will be stored. (Storage Account, Blob Names). - :type destination: ~azure.mgmt.servicebus.models.Destination + :type destination: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Destination """ _validation = { @@ -331,7 +333,7 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): :param reason: The reason for unavailability of a namespace. Possible values include: "None", "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", "TooManyNamespaceInCurrentSubscription". - :type reason: str or ~azure.mgmt.servicebus.models.UnavailableReason + :type reason: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.UnavailableReason """ _validation = { @@ -362,7 +364,8 @@ class ConnectionState(msrest.serialization.Model): :param status: Status of the connection. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". - :type status: str or ~azure.mgmt.servicebus.models.PrivateLinkConnectionStatus + :type status: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateLinkConnectionStatus :param description: Description of the connection state. :type description: str """ @@ -493,34 +496,30 @@ def __init__( class Encryption(msrest.serialization.Model): """Properties to configure Encryption. - Variables are only populated by the server, and will be ignored when sending a request. - :param key_vault_properties: Properties of KeyVault. - :type key_vault_properties: ~azure.mgmt.servicebus.models.KeyVaultProperties - :ivar key_source: Enumerates the possible value of keySource for Encryption. Default value: + :type key_vault_properties: + ~azure.mgmt.servicebus.v2018_01_01_preview.models.KeyVaultProperties + :param key_source: Enumerates the possible value of keySource for Encryption. The only + acceptable values to pass in are None and "Microsoft.KeyVault". The default value is "Microsoft.KeyVault". - :vartype key_source: str + :type key_source: str """ - _validation = { - 'key_source': {'constant': True}, - } - _attribute_map = { 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'}, 'key_source': {'key': 'keySource', 'type': 'str'}, } - key_source = "Microsoft.KeyVault" - def __init__( self, *, key_vault_properties: Optional["KeyVaultProperties"] = None, + key_source: Optional[str] = "Microsoft.KeyVault", **kwargs ): super(Encryption, self).__init__(**kwargs) self.key_vault_properties = key_vault_properties + self.key_source = key_source class ErrorAdditionalInfo(msrest.serialization.Model): @@ -531,7 +530,7 @@ class ErrorAdditionalInfo(msrest.serialization.Model): :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: object + :vartype info: any """ _validation = { @@ -557,7 +556,7 @@ class ErrorResponse(msrest.serialization.Model): """The resource management error response. :param error: The error object. - :type error: ~azure.mgmt.servicebus.models.ErrorResponseError + :type error: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ErrorResponseError """ _attribute_map = { @@ -586,9 +585,10 @@ class ErrorResponseError(msrest.serialization.Model): :ivar target: The error target. :vartype target: str :ivar details: The error details. - :vartype details: list[~azure.mgmt.servicebus.models.ErrorResponse] + :vartype details: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.ErrorResponse] :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.servicebus.models.ErrorAdditionalInfo] + :vartype additional_info: + list[~azure.mgmt.servicebus.v2018_01_01_preview.models.ErrorAdditionalInfo] """ _validation = { @@ -645,9 +645,9 @@ class Eventhub(Resource): :param status: Enumerates the possible values for the status of a Event Hub. Possible values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", "Deleting", "Renaming", "Unknown". - :type status: str or ~azure.mgmt.servicebus.models.EntityStatus + :type status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :param capture_description: Properties of capture description. - :type capture_description: ~azure.mgmt.servicebus.models.CaptureDescription + :type capture_description: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CaptureDescription """ _validation = { @@ -699,7 +699,7 @@ class EventHubListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: Result of the List EventHubs operation. - :type value: list[~azure.mgmt.servicebus.models.Eventhub] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.Eventhub] :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of EventHubs. :vartype next_link: str @@ -750,39 +750,34 @@ def __init__( class Identity(msrest.serialization.Model): """Properties to configure Identity for Bring your Own Keys. - Variables are only populated by the server, and will be ignored when sending a request. - :param principal_id: ObjectId from the KeyVault. :type principal_id: str :param tenant_id: TenantId from the KeyVault. :type tenant_id: str - :ivar type: Enumerates the possible value Identity type, which currently supports only - 'SystemAssigned'. Default value: "SystemAssigned". - :vartype type: str + :param type: Enumerates the possible value Identity type, which currently supports only + 'SystemAssigned'. The only acceptable values to pass in are None and "SystemAssigned". The + default value is "SystemAssigned". + :type type: str """ - _validation = { - 'type': {'constant': True}, - } - _attribute_map = { 'principal_id': {'key': 'principalId', 'type': 'str'}, 'tenant_id': {'key': 'tenantId', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, } - type = "SystemAssigned" - def __init__( self, *, principal_id: Optional[str] = None, tenant_id: Optional[str] = None, + type: Optional[str] = "SystemAssigned", **kwargs ): super(Identity, self).__init__(**kwargs) self.principal_id = principal_id self.tenant_id = tenant_id + self.type = type class IpFilterRule(Resource): @@ -799,7 +794,7 @@ class IpFilterRule(Resource): :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 + :type action: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.IPAction :param filter_name: IP Filter name. :type filter_name: str """ @@ -837,7 +832,7 @@ class IpFilterRuleListResult(msrest.serialization.Model): """The response from the List namespace operation. :param value: Result of the List IpFilter Rules operation. - :type value: list[~azure.mgmt.servicebus.models.IpFilterRule] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule] :param next_link: Link to the next set of results. Not empty if Value contains an incomplete list of IpFilter Rules. :type next_link: str @@ -938,7 +933,7 @@ class MigrationConfigListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: List of Migration Configs. - :type value: list[~azure.mgmt.servicebus.models.MigrationConfigProperties] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties] :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of migrationConfigurations. :vartype next_link: str @@ -1025,7 +1020,7 @@ def __init__( class NetworkRuleSet(Resource): - """Description of topic resource. + """Description of NetworkRuleSet resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -1037,11 +1032,12 @@ class NetworkRuleSet(Resource): :vartype type: str :param default_action: Default Action for Network Rule Set. Possible values include: "Allow", "Deny". - :type default_action: str or ~azure.mgmt.servicebus.models.DefaultAction + :type default_action: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.DefaultAction :param virtual_network_rules: List VirtualNetwork Rules. - :type virtual_network_rules: list[~azure.mgmt.servicebus.models.NWRuleSetVirtualNetworkRules] + :type virtual_network_rules: + list[~azure.mgmt.servicebus.v2018_01_01_preview.models.NWRuleSetVirtualNetworkRules] :param ip_rules: List of IpRules. - :type ip_rules: list[~azure.mgmt.servicebus.models.NWRuleSetIpRules] + :type ip_rules: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.NWRuleSetIpRules] """ _validation = { @@ -1073,13 +1069,40 @@ def __init__( self.ip_rules = ip_rules +class NetworkRuleSetListResult(msrest.serialization.Model): + """The response of the List NetworkRuleSet operation. + + :param value: Result of the List NetworkRuleSet operation. + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of NetworkRuleSet. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkRuleSet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NetworkRuleSet"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(NetworkRuleSetListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + class NWRuleSetIpRules(msrest.serialization.Model): - """The response from the List namespace operation. + """Description of NetWorkRuleSet - IpRules resource. :param ip_mask: IP Mask. :type ip_mask: str - :param action: The IP Filter Action. Possible values include: "Allow". - :type action: str or ~azure.mgmt.servicebus.models.NetworkRuleIPAction + :param action: The IP Filter Action. Possible values include: "Allow". Default value: "Allow". + :type action: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleIPAction """ _attribute_map = { @@ -1091,7 +1114,7 @@ def __init__( self, *, ip_mask: Optional[str] = None, - action: Optional[Union[str, "NetworkRuleIPAction"]] = None, + action: Optional[Union[str, "NetworkRuleIPAction"]] = "Allow", **kwargs ): super(NWRuleSetIpRules, self).__init__(**kwargs) @@ -1100,12 +1123,12 @@ def __init__( class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): - """The response from the List namespace operation. + """Description of VirtualNetworkRules - NetworkRules resource. :param subnet: Subnet properties. - :type subnet: ~azure.mgmt.servicebus.models.Subnet + :type subnet: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Subnet :param ignore_missing_vnet_service_endpoint: Value that indicates whether to ignore missing - Vnet Service Endpoint. + VNet Service Endpoint. :type ignore_missing_vnet_service_endpoint: bool """ @@ -1134,7 +1157,7 @@ class Operation(msrest.serialization.Model): :ivar name: Operation name: {provider}/{resource}/{operation}. :vartype name: str :param display: The object that represents the operation. - :type display: ~azure.mgmt.servicebus.models.OperationDisplay + :type display: ~azure.mgmt.servicebus.v2018_01_01_preview.models.OperationDisplay """ _validation = { @@ -1199,7 +1222,7 @@ class OperationListResult(msrest.serialization.Model): :ivar value: List of ServiceBus operations supported by the Microsoft.ServiceBus resource provider. - :vartype value: list[~azure.mgmt.servicebus.models.Operation] + :vartype value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.Operation] :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -1282,7 +1305,8 @@ class PremiumMessagingRegions(ResourceNamespacePatch): :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param properties: - :type properties: ~azure.mgmt.servicebus.models.PremiumMessagingRegionsProperties + :type properties: + ~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegionsProperties """ _validation = { @@ -1318,7 +1342,7 @@ class PremiumMessagingRegionsListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: Result of the List PremiumMessagingRegions type. - :type value: list[~azure.mgmt.servicebus.models.PremiumMessagingRegions] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegions] :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of PremiumMessagingRegions. :vartype next_link: str @@ -1407,12 +1431,14 @@ class PrivateEndpointConnection(Resource): :ivar type: Resource type. :vartype type: str :param private_endpoint: The Private Endpoint resource for this Connection. - :type private_endpoint: ~azure.mgmt.servicebus.models.PrivateEndpoint + :type private_endpoint: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpoint :param private_link_service_connection_state: Details about the state of the connection. - :type private_link_service_connection_state: ~azure.mgmt.servicebus.models.ConnectionState + :type private_link_service_connection_state: + ~azure.mgmt.servicebus.v2018_01_01_preview.models.ConnectionState :param provisioning_state: Provisioning state of the Private Endpoint Connection. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". - :type provisioning_state: str or ~azure.mgmt.servicebus.models.EndPointProvisioningState + :type provisioning_state: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.EndPointProvisioningState """ _validation = { @@ -1448,7 +1474,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """Result of the list of all private endpoint connections operation. :param value: A collection of private endpoint connection resources. - :type value: list[~azure.mgmt.servicebus.models.PrivateEndpointConnection] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection] :param next_link: A link for the next page of private endpoint connection resources. :type next_link: str """ @@ -1520,7 +1546,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """Result of the List private link resources operation. :param value: A collection of private link resources. - :type value: list[~azure.mgmt.servicebus.models.PrivateLinkResource] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateLinkResource] :param next_link: A link for the next page of private link resources. :type next_link: str """ @@ -1549,7 +1575,7 @@ class RegenerateAccessKeyParameters(msrest.serialization.Model): :param key_type: Required. The access key to regenerate. Possible values include: "PrimaryKey", "SecondaryKey". - :type key_type: str or ~azure.mgmt.servicebus.models.KeyType + :type key_type: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.KeyType :param key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key value set for keyType. :type key: str @@ -1589,14 +1615,14 @@ class Rule(Resource): :vartype type: str :param action: Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. - :type action: ~azure.mgmt.servicebus.models.Action + :type action: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Action :param filter_type: Filter type that is evaluated against a BrokeredMessage. Possible values include: "SqlFilter", "CorrelationFilter". - :type filter_type: str or ~azure.mgmt.servicebus.models.FilterType + :type filter_type: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.FilterType :param sql_filter: Properties of sqlFilter. - :type sql_filter: ~azure.mgmt.servicebus.models.SqlFilter + :type sql_filter: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SqlFilter :param correlation_filter: Properties of correlationFilter. - :type correlation_filter: ~azure.mgmt.servicebus.models.CorrelationFilter + :type correlation_filter: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CorrelationFilter """ _validation = { @@ -1635,7 +1661,7 @@ class RuleListResult(msrest.serialization.Model): """The response of the List rule operation. :param value: Result of the List Rules operation. - :type value: list[~azure.mgmt.servicebus.models.Rule] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of rules. :type next_link: str @@ -1670,7 +1696,7 @@ class SBAuthorizationRule(Resource): :ivar type: Resource type. :vartype type: str :param rights: The rights associated with the rule. - :type rights: list[str or ~azure.mgmt.servicebus.models.AccessRights] + :type rights: list[str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessRights] """ _validation = { @@ -1700,7 +1726,7 @@ class SBAuthorizationRuleListResult(msrest.serialization.Model): """The response to the List Namespace operation. :param value: Result of the List Authorization Rules operation. - :type value: list[~azure.mgmt.servicebus.models.SBAuthorizationRule] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of Authorization Rules. :type next_link: str @@ -1787,11 +1813,13 @@ class SBNamespace(TrackedResource): :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param sku: Properties of SKU. - :type sku: ~azure.mgmt.servicebus.models.SBSku + :type sku: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSku :param identity: Properties of BYOK Identity description. - :type identity: ~azure.mgmt.servicebus.models.Identity + :type identity: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Identity :ivar provisioning_state: Provisioning state of the namespace. :vartype provisioning_state: str + :ivar status: Status of the namespace. + :vartype status: str :ivar created_at: The time the namespace was created. :vartype created_at: ~datetime.datetime :ivar updated_at: The time the namespace was updated. @@ -1804,7 +1832,7 @@ class SBNamespace(TrackedResource): regions supported availability zones. :type zone_redundant: bool :param encryption: Properties of BYOK Encryption description. - :type encryption: ~azure.mgmt.servicebus.models.Encryption + :type encryption: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Encryption """ _validation = { @@ -1813,6 +1841,7 @@ class SBNamespace(TrackedResource): 'type': {'readonly': True}, 'location': {'required': True}, 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, 'created_at': {'readonly': True}, 'updated_at': {'readonly': True}, 'service_bus_endpoint': {'readonly': True}, @@ -1828,6 +1857,7 @@ class SBNamespace(TrackedResource): 'sku': {'key': 'sku', 'type': 'SBSku'}, 'identity': {'key': 'identity', 'type': 'Identity'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, @@ -1851,6 +1881,7 @@ def __init__( self.sku = sku self.identity = identity self.provisioning_state = None + self.status = None self.created_at = None self.updated_at = None self.service_bus_endpoint = None @@ -1863,7 +1894,7 @@ class SBNamespaceListResult(msrest.serialization.Model): """The response of the List Namespace operation. :param value: Result of the List Namespace operation. - :type value: list[~azure.mgmt.servicebus.models.SBNamespace] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of Namespaces. :type next_link: str @@ -1893,7 +1924,8 @@ class SBNamespaceMigrate(msrest.serialization.Model): :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 + :type target_namespace_type: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.NameSpaceType """ _validation = { @@ -1930,11 +1962,13 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param sku: Properties of SKU. - :type sku: ~azure.mgmt.servicebus.models.SBSku + :type sku: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSku :param identity: Properties of BYOK Identity description. - :type identity: ~azure.mgmt.servicebus.models.Identity + :type identity: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Identity :ivar provisioning_state: Provisioning state of the namespace. :vartype provisioning_state: str + :ivar status: Status of the namespace. + :vartype status: str :ivar created_at: The time the namespace was created. :vartype created_at: ~datetime.datetime :ivar updated_at: The time the namespace was updated. @@ -1947,7 +1981,7 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): regions supported availability zones. :type zone_redundant: bool :param encryption: Properties of BYOK Encryption description. - :type encryption: ~azure.mgmt.servicebus.models.Encryption + :type encryption: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Encryption """ _validation = { @@ -1955,6 +1989,7 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): 'name': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, 'created_at': {'readonly': True}, 'updated_at': {'readonly': True}, 'service_bus_endpoint': {'readonly': True}, @@ -1970,6 +2005,7 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): 'sku': {'key': 'sku', 'type': 'SBSku'}, 'identity': {'key': 'identity', 'type': 'Identity'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, @@ -1993,6 +2029,7 @@ def __init__( self.sku = sku self.identity = identity self.provisioning_state = None + self.status = None self.created_at = None self.updated_at = None self.service_bus_endpoint = None @@ -2013,7 +2050,7 @@ class SBQueue(Resource): :ivar type: Resource type. :vartype type: str :ivar count_details: Message Count Details. - :vartype count_details: ~azure.mgmt.servicebus.models.MessageCountDetails + :vartype count_details: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MessageCountDetails :ivar created_at: The exact time the message was created. :vartype created_at: ~datetime.datetime :ivar updated_at: The exact time the message was updated. @@ -2054,7 +2091,7 @@ class SBQueue(Resource): :param status: Enumerates the possible values for the status of a messaging entity. Possible values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", "Deleting", "Renaming", "Unknown". - :type status: str or ~azure.mgmt.servicebus.models.EntityStatus + :type status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :param enable_batched_operations: Value that indicates whether server-side batched operations are enabled. :type enable_batched_operations: bool @@ -2160,7 +2197,7 @@ class SBQueueListResult(msrest.serialization.Model): """The response to the List Queues operation. :param value: Result of the List Queues operation. - :type value: list[~azure.mgmt.servicebus.models.SBQueue] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of queues. :type next_link: str @@ -2190,10 +2227,10 @@ class SBSku(msrest.serialization.Model): :param name: Required. Name of this SKU. Possible values include: "Basic", "Standard", "Premium". - :type name: str or ~azure.mgmt.servicebus.models.SkuName + :type name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.SkuName :param tier: The billing tier of this particular SKU. Possible values include: "Basic", "Standard", "Premium". - :type tier: str or ~azure.mgmt.servicebus.models.SkuTier + :type tier: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.SkuTier :param capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 and 4. :type capacity: int @@ -2243,7 +2280,7 @@ class SBSubscription(Resource): :ivar updated_at: The exact time the message was updated. :vartype updated_at: ~datetime.datetime :ivar count_details: Message count details. - :vartype count_details: ~azure.mgmt.servicebus.models.MessageCountDetails + :vartype count_details: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MessageCountDetails :param lock_duration: ISO 8061 lock duration timespan for the subscription. The default value is 1 minute. :type lock_duration: ~datetime.timedelta @@ -2267,7 +2304,7 @@ class SBSubscription(Resource): :param status: Enumerates the possible values for the status of a messaging entity. Possible values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", "Deleting", "Renaming", "Unknown". - :type status: str or ~azure.mgmt.servicebus.models.EntityStatus + :type status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :param enable_batched_operations: Value that indicates whether server-side batched operations are enabled. :type enable_batched_operations: bool @@ -2355,7 +2392,7 @@ class SBSubscriptionListResult(msrest.serialization.Model): """The response to the List Subscriptions operation. :param value: Result of the List Subscriptions operation. - :type value: list[~azure.mgmt.servicebus.models.SBSubscription] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of subscriptions. :type next_link: str @@ -2400,7 +2437,7 @@ class SBTopic(Resource): :ivar subscription_count: Number of subscriptions. :vartype subscription_count: int :ivar count_details: Message count details. - :vartype count_details: ~azure.mgmt.servicebus.models.MessageCountDetails + :vartype count_details: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MessageCountDetails :param default_message_time_to_live: ISO 8601 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. @@ -2420,7 +2457,7 @@ class SBTopic(Resource): :param status: Enumerates the possible values for the status of a messaging entity. Possible values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", "Deleting", "Renaming", "Unknown". - :type status: str or ~azure.mgmt.servicebus.models.EntityStatus + :type status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :param support_ordering: Value that indicates whether the topic supports ordering. :type support_ordering: bool :param auto_delete_on_idle: ISO 8601 timespan idle interval after which the topic is @@ -2506,7 +2543,7 @@ class SBTopicListResult(msrest.serialization.Model): """The response to the List Topics operation. :param value: Result of the List Topics operation. - :type value: list[~azure.mgmt.servicebus.models.SBTopic] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of topics. :type next_link: str @@ -2599,10 +2636,16 @@ def __init__( class Subnet(msrest.serialization.Model): """Properties supplied for Subnet. - :param id: Resource ID of Virtual Network Subnet. + All required parameters must be populated in order to send to Azure. + + :param id: Required. Resource ID of Virtual Network Subnet. :type id: str """ + _validation = { + 'id': {'required': True}, + } + _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, } @@ -2610,7 +2653,7 @@ class Subnet(msrest.serialization.Model): def __init__( self, *, - id: Optional[str] = None, + id: str, **kwargs ): super(Subnet, self).__init__(**kwargs) @@ -2659,7 +2702,7 @@ class VirtualNetworkRuleListResult(msrest.serialization.Model): """The response from the List namespace operation. :param value: Result of the List VirtualNetwork Rules operation. - :type value: list[~azure.mgmt.servicebus.models.VirtualNetworkRule] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule] :param next_link: Link to the next set of results. Not empty if Value contains an incomplete list of VirtualNetwork Rules. :type next_link: str diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models/_service_bus_management_client_enums.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_service_bus_management_client_enums.py similarity index 100% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models/_service_bus_management_client_enums.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_service_bus_management_client_enums.py diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/__init__.py new file mode 100644 index 0000000000000..d7920f85ee2cc --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/__init__.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 ._namespaces_operations import NamespacesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations +from ._queues_operations import QueuesOperations +from ._topics_operations import TopicsOperations +from ._event_hubs_operations import EventHubsOperations +from ._migration_configs_operations import MigrationConfigsOperations +from ._premium_messaging_regions_operations import PremiumMessagingRegionsOperations +from ._regions_operations import RegionsOperations +from ._subscriptions_operations import SubscriptionsOperations +from ._rules_operations import RulesOperations +from ._operations import Operations + +__all__ = [ + 'NamespacesOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'DisasterRecoveryConfigsOperations', + 'QueuesOperations', + 'TopicsOperations', + 'EventHubsOperations', + 'MigrationConfigsOperations', + 'PremiumMessagingRegionsOperations', + 'RegionsOperations', + 'SubscriptionsOperations', + 'RulesOperations', + 'Operations', +] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_disaster_recovery_configs_operations.py similarity index 95% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_disaster_recovery_configs_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_disaster_recovery_configs_operations.py index 5d41e56d49d04..8c9a32491e716 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_disaster_recovery_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_disaster_recovery_configs_operations.py @@ -30,7 +30,7 @@ class DisasterRecoveryConfigsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -60,10 +60,10 @@ def check_name_availability( :param namespace_name: The namespace name. :type namespace_name: str :param parameters: Parameters to check availability of the given namespace name. - :type parameters: ~azure.mgmt.servicebus.models.CheckNameAvailability + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailability :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.CheckNameAvailabilityResult + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] @@ -102,7 +102,7 @@ def check_name_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) @@ -128,7 +128,7 @@ def list( :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.ArmDisasterRecoveryListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecoveryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecoveryListResult"] @@ -178,7 +178,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -207,10 +207,10 @@ def create_or_update( :param alias: The Disaster Recovery configuration name. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). - :type parameters: ~azure.mgmt.servicebus.models.ArmDisasterRecovery + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery :keyword callable cls: A custom type or function that will be passed the direct response :return: ArmDisasterRecovery, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.ArmDisasterRecovery or None + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery or None :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ArmDisasterRecovery"]] @@ -250,7 +250,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -316,7 +316,7 @@ def delete( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -342,7 +342,7 @@ def get( :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ArmDisasterRecovery, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.ArmDisasterRecovery + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecovery"] @@ -377,7 +377,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) @@ -442,7 +442,7 @@ def break_pairing( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -468,7 +468,7 @@ def fail_over( :param alias: The Disaster Recovery configuration name. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). - :type parameters: ~azure.mgmt.servicebus.models.FailoverProperties + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.FailoverProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -514,7 +514,7 @@ def fail_over( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -540,7 +540,7 @@ def list_authorization_rules( :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.SBAuthorizationRuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] @@ -591,7 +591,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -623,7 +623,7 @@ def get_authorization_rule( :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SBAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBAuthorizationRule + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] @@ -659,7 +659,7 @@ def get_authorization_rule( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) @@ -691,7 +691,7 @@ def list_keys( :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessKeys, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.AccessKeys + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] @@ -727,7 +727,7 @@ def list_keys( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AccessKeys', pipeline_response) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_event_hubs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_event_hubs_operations.py new file mode 100644 index 0000000000000..02f7e9039ab8c --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_event_hubs_operations.py @@ -0,0 +1,122 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class EventHubsOperations(object): + """EventHubsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_namespace( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.EventHubListResult"] + """Gets all the Event Hubs in a service bus 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventHubListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.EventHubListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('EventHubListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/eventhubs'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_migration_configs_operations.py new file mode 100644 index 0000000000000..c8ab4f1f1b0e2 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_migration_configs_operations.py @@ -0,0 +1,510 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class MigrationConfigsOperations(object): + """MigrationConfigsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.MigrationConfigListResult"] + """Gets all migrationConfigurations. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MigrationConfigListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('MigrationConfigListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations'} # type: ignore + + def _create_and_start_migration_initial( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + parameters, # type: "_models.MigrationConfigProperties" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.MigrationConfigProperties"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MigrationConfigProperties"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_and_start_migration_initial.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'MigrationConfigProperties') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_and_start_migration_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + def begin_create_and_start_migration( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + parameters, # type: "_models.MigrationConfigProperties" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.MigrationConfigProperties"] + """Creates Migration configuration and starts migration of entities from Standard to Premium + 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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationConfigProperties or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigProperties"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_and_start_migration_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + config_name=config_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_and_start_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a MigrationConfiguration. + + :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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + **kwargs # type: Any + ): + # type: (...) -> "_models.MigrationConfigProperties" + """Retrieves Migration Config. + + :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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigrationConfigProperties, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + def complete_migration( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + **kwargs # type: Any + ): + # type: (...) -> None + """This operation Completes Migration of entities by pointing the connection strings to Premium + namespace and any entities created after the operation will be under Premium Namespace. + CompleteMigration operation will fail when entity migration is in-progress. + + :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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.complete_migration.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + complete_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade'} # type: ignore + + def revert( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + **kwargs # type: Any + ): + # type: (...) -> None + """This operation reverts Migration. + + :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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.revert.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + revert.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_namespaces_operations.py similarity index 90% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_namespaces_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_namespaces_operations.py index 5626e55561857..ac5186a54fd3d 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_namespaces_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_namespaces_operations.py @@ -32,7 +32,7 @@ class NamespacesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -62,7 +62,7 @@ def list_ip_filter_rules( :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IpFilterRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.IpFilterRuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IpFilterRuleListResult"] @@ -112,7 +112,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -141,10 +141,10 @@ def create_or_update_ip_filter_rule( :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 + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule :keyword callable cls: A custom type or function that will be passed the direct response :return: IpFilterRule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.IpFilterRule + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IpFilterRule"] @@ -184,7 +184,7 @@ def create_or_update_ip_filter_rule( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IpFilterRule', pipeline_response) @@ -248,7 +248,7 @@ def delete_ip_filter_rule( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -274,7 +274,7 @@ def get_ip_filter_rule( :type ip_filter_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IpFilterRule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.IpFilterRule + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IpFilterRule"] @@ -309,7 +309,7 @@ def get_ip_filter_rule( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IpFilterRule', pipeline_response) @@ -329,7 +329,7 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.SBNamespaceListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] @@ -377,7 +377,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -400,7 +400,7 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.SBNamespaceListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] @@ -449,7 +449,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -504,7 +504,7 @@ def _create_or_update_initial( if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -536,15 +536,15 @@ def begin_create_or_update( :param namespace_name: The namespace name. :type namespace_name: str :param parameters: Parameters supplied to create a namespace resource. - :type parameters: ~azure.mgmt.servicebus.models.SBNamespace + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either SBNamespace or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.models.SBNamespace] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] @@ -631,7 +631,7 @@ def _delete_initial( if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -655,8 +655,8 @@ def begin_delete( :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -720,7 +720,7 @@ def get( :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SBNamespace, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBNamespace + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespace"] @@ -754,7 +754,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBNamespace', pipeline_response) @@ -781,10 +781,10 @@ def update( :param namespace_name: The namespace name. :type namespace_name: str :param parameters: Parameters supplied to update a namespace resource. - :type parameters: ~azure.mgmt.servicebus.models.SBNamespaceUpdateParameters + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: SBNamespace, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBNamespace or None + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace or None :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SBNamespace"]] @@ -823,7 +823,7 @@ def update( if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -839,134 +839,6 @@ def update( return deserialized update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore - def create_or_update_network_rule_set( - self, - resource_group_name, # type: str - namespace_name, # type: str - parameters, # type: "_models.NetworkRuleSet" - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkRuleSet" - """Gets NetworkRuleSet 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 parameters: The Namespace NetworkRuleSet. - :type parameters: ~azure.mgmt.servicebus.models.NetworkRuleSet - :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_network_rule_set.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NetworkRuleSet') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create_or_update_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkrulesets/default'} # type: ignore - - def get_network_rule_set( - self, - resource_group_name, # type: str - namespace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkRuleSet" - """Gets NetworkRuleSet 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_network_rule_set.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkrulesets/default'} # type: ignore - def list_virtual_network_rules( self, resource_group_name, # type: str @@ -982,7 +854,7 @@ def list_virtual_network_rules( :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VirtualNetworkRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.VirtualNetworkRuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkRuleListResult"] @@ -1032,7 +904,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1061,10 +933,10 @@ def create_or_update_virtual_network_rule( :param virtual_network_rule_name: The Virtual Network Rule name. :type virtual_network_rule_name: str :param parameters: The Namespace VirtualNetworkRule. - :type parameters: ~azure.mgmt.servicebus.models.VirtualNetworkRule + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualNetworkRule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.VirtualNetworkRule + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkRule"] @@ -1104,7 +976,7 @@ def create_or_update_virtual_network_rule( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VirtualNetworkRule', pipeline_response) @@ -1168,7 +1040,7 @@ def delete_virtual_network_rule( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -1194,7 +1066,7 @@ def get_virtual_network_rule( :type virtual_network_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualNetworkRule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.VirtualNetworkRule + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkRule"] @@ -1229,7 +1101,7 @@ def get_virtual_network_rule( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VirtualNetworkRule', pipeline_response) @@ -1255,7 +1127,7 @@ def list_authorization_rules( :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.SBAuthorizationRuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] @@ -1263,7 +1135,7 @@ def list_authorization_rules( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" + api_version = "2018-01-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -1305,7 +1177,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1334,10 +1206,10 @@ def create_or_update_authorization_rule( :param authorization_rule_name: The authorization rule name. :type authorization_rule_name: str :param parameters: The shared access authorization rule. - :type parameters: ~azure.mgmt.servicebus.models.SBAuthorizationRule + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule :keyword callable cls: A custom type or function that will be passed the direct response :return: SBAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBAuthorizationRule + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] @@ -1345,7 +1217,7 @@ def create_or_update_authorization_rule( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" + api_version = "2018-01-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1377,7 +1249,7 @@ def create_or_update_authorization_rule( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) @@ -1414,7 +1286,7 @@ def delete_authorization_rule( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" + api_version = "2018-01-01-preview" accept = "application/json" # Construct URL @@ -1441,7 +1313,7 @@ def delete_authorization_rule( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -1467,7 +1339,7 @@ def get_authorization_rule( :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SBAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBAuthorizationRule + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] @@ -1475,7 +1347,7 @@ def get_authorization_rule( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" + api_version = "2018-01-01-preview" accept = "application/json" # Construct URL @@ -1502,7 +1374,7 @@ def get_authorization_rule( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) @@ -1531,7 +1403,7 @@ def list_keys( :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessKeys, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.AccessKeys + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] @@ -1539,7 +1411,7 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" + api_version = "2018-01-01-preview" accept = "application/json" # Construct URL @@ -1566,7 +1438,7 @@ def list_keys( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AccessKeys', pipeline_response) @@ -1595,10 +1467,10 @@ def regenerate_keys( :param authorization_rule_name: The authorization rule name. :type authorization_rule_name: str :param parameters: Parameters supplied to regenerate the authorization rule. - :type parameters: ~azure.mgmt.servicebus.models.RegenerateAccessKeyParameters + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessKeys, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.AccessKeys + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] @@ -1606,7 +1478,7 @@ def regenerate_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" + api_version = "2018-01-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1638,7 +1510,7 @@ def regenerate_keys( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AccessKeys', pipeline_response) @@ -1658,10 +1530,10 @@ def check_name_availability( """Check the give namespace name availability. :param parameters: Parameters to check availability of the given namespace name. - :type parameters: ~azure.mgmt.servicebus.models.CheckNameAvailability + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailability :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.CheckNameAvailabilityResult + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] @@ -1669,7 +1541,7 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" + api_version = "2018-01-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1698,7 +1570,7 @@ def check_name_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) @@ -1709,6 +1581,210 @@ def check_name_availability( return deserialized check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability'} # type: ignore + def create_or_update_network_rule_set( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.NetworkRuleSet" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkRuleSet" + """Create or update NetworkRuleSet 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 parameters: The Namespace IpFilterRule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_network_rule_set.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkRuleSet') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + def get_network_rule_set( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkRuleSet" + """Gets NetworkRuleSet 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_network_rule_set.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + def list_network_rule_sets( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkRuleSetListResult"] + """Gets list of NetworkRuleSet 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkRuleSetListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_network_rule_sets.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkRuleSetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_network_rule_sets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets'} # type: ignore + def migrate( self, resource_group_name, # type: str @@ -1724,7 +1800,7 @@ def migrate( :param namespace_name: The namespace name. :type namespace_name: str :param parameters: Parameters supplied to migrate namespace type. - :type parameters: ~azure.mgmt.servicebus.models.SBNamespaceMigrate + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceMigrate :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1735,7 +1811,7 @@ def migrate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" + api_version = "2018-01-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1766,7 +1842,7 @@ def migrate( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_operations.py similarity index 95% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_operations.py index 1651be860b1c8..a2299672a4265 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_operations.py @@ -30,7 +30,7 @@ class Operations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -54,7 +54,7 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.OperationListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -98,7 +98,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_premium_messaging_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_premium_messaging_regions_operations.py new file mode 100644 index 0000000000000..a0234237b68b6 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_premium_messaging_regions_operations.py @@ -0,0 +1,114 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PremiumMessagingRegionsOperations(object): + """PremiumMessagingRegionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PremiumMessagingRegionsListResult"] + """Gets the available premium messaging regions for servicebus. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PremiumMessagingRegionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PremiumMessagingRegionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/premiumMessagingRegions'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_private_endpoint_connections_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_private_endpoint_connections_operations.py similarity index 95% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_private_endpoint_connections_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_private_endpoint_connections_operations.py index 8b8132b1266a7..4caf5090bd216 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_private_endpoint_connections_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_private_endpoint_connections_operations.py @@ -32,7 +32,7 @@ class PrivateEndpointConnectionsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -62,7 +62,7 @@ def list( :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.PrivateEndpointConnectionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -112,7 +112,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -142,10 +142,10 @@ def create_or_update( :type private_endpoint_connection_name: str :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to namespace resource. - :type parameters: ~azure.mgmt.servicebus.models.PrivateEndpointConnection + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.PrivateEndpointConnection + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] @@ -185,7 +185,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -240,7 +240,7 @@ def _delete_initial( if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -266,8 +266,8 @@ def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -336,7 +336,7 @@ def get( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.PrivateEndpointConnection + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] @@ -371,7 +371,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_private_link_resources_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_private_link_resources_operations.py similarity index 94% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_private_link_resources_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_private_link_resources_operations.py index db5b8a8f30bbd..31b03f9077ebd 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_private_link_resources_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_private_link_resources_operations.py @@ -29,7 +29,7 @@ class PrivateLinkResourcesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -59,7 +59,7 @@ def get( :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResourcesListResult, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.PrivateLinkResourcesListResult + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] @@ -93,7 +93,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_queues_operations.py new file mode 100644 index 0000000000000..27e537b793a3e --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_queues_operations.py @@ -0,0 +1,764 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class QueuesOperations(object): + """QueuesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBAuthorizationRuleListResult"] + """Gets all authorization rules for a queue. + + :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 queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules'} # type: ignore + + def create_or_update_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.SBAuthorizationRule" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Creates an authorization rule for a queue. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def delete_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a queue authorization rule. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def get_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Gets an authorization rule for a queue 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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Primary and secondary connection strings to the queue. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + def regenerate_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.RegenerateAccessKeyParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Regenerates the primary or secondary connection strings to the queue. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def list_by_namespace( + self, + resource_group_name, # type: str + namespace_name, # type: str + skip=None, # type: Optional[int] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBQueueListResult"] + """Gets the queues within 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 skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBQueueListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueueListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueueListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBQueueListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + parameters, # type: "_models.SBQueue" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBQueue" + """Creates or updates a Service Bus queue. This operation is idempotent. + + :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 queue_name: The queue name. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBQueue') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a queue from the specified namespace in a resource group. + + :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 queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBQueue" + """Returns a description for the specified queue. + + :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 queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_regions_operations.py new file mode 100644 index 0000000000000..ace530c758f40 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_regions_operations.py @@ -0,0 +1,118 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class RegionsOperations(object): + """RegionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_sku( + self, + sku, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PremiumMessagingRegionsListResult"] + """Gets the available Regions for a given sku. + + :param sku: The sku type. + :type sku: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PremiumMessagingRegionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_sku.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'sku': self._serialize.url("sku", sku, 'str', max_length=50, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PremiumMessagingRegionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_sku.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/sku/{sku}/regions'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_rules_operations.py new file mode 100644 index 0000000000000..95a2757bad7ad --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_rules_operations.py @@ -0,0 +1,363 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class RulesOperations(object): + """RulesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_subscriptions( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + skip=None, # type: Optional[int] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.RuleListResult"] + """List all the rules within given topic-subscription. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.RuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscriptions.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('RuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscriptions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + rule_name, # type: str + parameters, # type: "_models.Rule" + **kwargs # type: Any + ): + # type: (...) -> "_models.Rule" + """Creates a new rule and updates an existing rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Rule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Rule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes an existing rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Rule" + """Retrieves the description for the specified rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Rule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_subscriptions_operations.py new file mode 100644 index 0000000000000..47771b2005d1e --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_subscriptions_operations.py @@ -0,0 +1,347 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionsOperations(object): + """SubscriptionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_topic( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + skip=None, # type: Optional[int] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBSubscriptionListResult"] + """List all the subscriptions under a specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBSubscriptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_topic.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBSubscriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_topic.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + parameters, # type: "_models.SBSubscription" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBSubscription" + """Creates a topic subscription. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBSubscription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a subscription from the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBSubscription" + """Returns a subscription description for the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_topics_operations.py new file mode 100644 index 0000000000000..b054849d6640e --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_topics_operations.py @@ -0,0 +1,764 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class TopicsOperations(object): + """TopicsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBAuthorizationRuleListResult"] + """Gets authorization rules for a topic. + + :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 topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules'} # type: ignore + + def create_or_update_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.SBAuthorizationRule" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Creates an authorization rule for the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def get_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Returns the specified authorization rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def delete_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a topic authorization rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Gets the primary and secondary connection strings for the topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + def regenerate_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.RegenerateAccessKeyParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Regenerates primary or secondary connection strings for the topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def list_by_namespace( + self, + resource_group_name, # type: str + namespace_name, # type: str + skip=None, # type: Optional[int] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBTopicListResult"] + """Gets all the topics in 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 skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBTopicListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopicListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopicListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBTopicListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + parameters, # type: "_models.SBTopic" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBTopic" + """Creates a topic in the specified 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 topic_name: The topic name. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBTopic') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a topic from the specified namespace and resource group. + + :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 topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBTopic" + """Returns a description for the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/py.typed b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/py.typed new file mode 100644 index 0000000000000..e5aff4f83af86 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/__init__.py new file mode 100644 index 0000000000000..f640dac181bb7 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/__init__.py @@ -0,0 +1,16 @@ +# 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 ._service_bus_management_client import ServiceBusManagementClient +__all__ = ['ServiceBusManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_configuration.py new file mode 100644 index 0000000000000..8541e4ad80146 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_configuration.py @@ -0,0 +1,70 @@ +# 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 typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class ServiceBusManagementClientConfiguration(Configuration): + """Configuration for ServiceBusManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-01-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_metadata.json b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_metadata.json new file mode 100644 index 0000000000000..5d9ae13b9d1e9 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_metadata.json @@ -0,0 +1,112 @@ +{ + "chosen_version": "2021-01-01-preview", + "total_api_version_list": ["2021-01-01-preview"], + "client": { + "name": "ServiceBusManagementClient", + "filename": "_service_bus_management_client", + "description": "Azure Service Bus client for managing Namespace.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "namespaces": "NamespacesOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations", + "private_link_resources": "PrivateLinkResourcesOperations", + "operations": "Operations", + "disaster_recovery_configs": "DisasterRecoveryConfigsOperations", + "migration_configs": "MigrationConfigsOperations", + "queues": "QueuesOperations", + "topics": "TopicsOperations", + "rules": "RulesOperations", + "subscriptions": "SubscriptionsOperations" + } +} \ No newline at end of file diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_service_bus_management_client.py new file mode 100644 index 0000000000000..cead781c4999b --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_service_bus_management_client.py @@ -0,0 +1,134 @@ +# 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 typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import ServiceBusManagementClientConfiguration +from .operations import NamespacesOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import PrivateLinkResourcesOperations +from .operations import Operations +from .operations import DisasterRecoveryConfigsOperations +from .operations import MigrationConfigsOperations +from .operations import QueuesOperations +from .operations import TopicsOperations +from .operations import RulesOperations +from .operations import SubscriptionsOperations +from . import models + + +class ServiceBusManagementClient(object): + """Azure Service Bus client for managing Namespace. + + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: azure.mgmt.servicebus.v2021_01_01_preview.operations.NamespacesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.servicebus.v2021_01_01_preview.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.servicebus.v2021_01_01_preview.operations.PrivateLinkResourcesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.servicebus.v2021_01_01_preview.operations.Operations + :ivar disaster_recovery_configs: DisasterRecoveryConfigsOperations operations + :vartype disaster_recovery_configs: azure.mgmt.servicebus.v2021_01_01_preview.operations.DisasterRecoveryConfigsOperations + :ivar migration_configs: MigrationConfigsOperations operations + :vartype migration_configs: azure.mgmt.servicebus.v2021_01_01_preview.operations.MigrationConfigsOperations + :ivar queues: QueuesOperations operations + :vartype queues: azure.mgmt.servicebus.v2021_01_01_preview.operations.QueuesOperations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.servicebus.v2021_01_01_preview.operations.TopicsOperations + :ivar rules: RulesOperations operations + :vartype rules: azure.mgmt.servicebus.v2021_01_01_preview.operations.RulesOperations + :ivar subscriptions: SubscriptionsOperations operations + :vartype subscriptions: azure.mgmt.servicebus.v2021_01_01_preview.operations.SubscriptionsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = ServiceBusManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.namespaces = NamespacesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.migration_configs = MigrationConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.queues = QueuesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ServiceBusManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/__init__.py new file mode 100644 index 0000000000000..9016cbc217954 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/__init__.py @@ -0,0 +1,10 @@ +# 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 ._service_bus_management_client import ServiceBusManagementClient +__all__ = ['ServiceBusManagementClient'] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_configuration.py new file mode 100644 index 0000000000000..0678c98b24d86 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class ServiceBusManagementClientConfiguration(Configuration): + """Configuration for ServiceBusManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-01-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_service_bus_management_client.py new file mode 100644 index 0000000000000..19ce1a02e97d5 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_service_bus_management_client.py @@ -0,0 +1,127 @@ +# 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 typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import ServiceBusManagementClientConfiguration +from .operations import NamespacesOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import PrivateLinkResourcesOperations +from .operations import Operations +from .operations import DisasterRecoveryConfigsOperations +from .operations import MigrationConfigsOperations +from .operations import QueuesOperations +from .operations import TopicsOperations +from .operations import RulesOperations +from .operations import SubscriptionsOperations +from .. import models + + +class ServiceBusManagementClient(object): + """Azure Service Bus client for managing Namespace. + + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: azure.mgmt.servicebus.v2021_01_01_preview.aio.operations.NamespacesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.servicebus.v2021_01_01_preview.aio.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.servicebus.v2021_01_01_preview.aio.operations.PrivateLinkResourcesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.servicebus.v2021_01_01_preview.aio.operations.Operations + :ivar disaster_recovery_configs: DisasterRecoveryConfigsOperations operations + :vartype disaster_recovery_configs: azure.mgmt.servicebus.v2021_01_01_preview.aio.operations.DisasterRecoveryConfigsOperations + :ivar migration_configs: MigrationConfigsOperations operations + :vartype migration_configs: azure.mgmt.servicebus.v2021_01_01_preview.aio.operations.MigrationConfigsOperations + :ivar queues: QueuesOperations operations + :vartype queues: azure.mgmt.servicebus.v2021_01_01_preview.aio.operations.QueuesOperations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.servicebus.v2021_01_01_preview.aio.operations.TopicsOperations + :ivar rules: RulesOperations operations + :vartype rules: azure.mgmt.servicebus.v2021_01_01_preview.aio.operations.RulesOperations + :ivar subscriptions: SubscriptionsOperations operations + :vartype subscriptions: azure.mgmt.servicebus.v2021_01_01_preview.aio.operations.SubscriptionsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = ServiceBusManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.namespaces = NamespacesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.migration_configs = MigrationConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.queues = QueuesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ServiceBusManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/__init__.py new file mode 100644 index 0000000000000..e278debc144f6 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/__init__.py @@ -0,0 +1,31 @@ +# 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 ._namespaces_operations import NamespacesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._operations import Operations +from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations +from ._migration_configs_operations import MigrationConfigsOperations +from ._queues_operations import QueuesOperations +from ._topics_operations import TopicsOperations +from ._rules_operations import RulesOperations +from ._subscriptions_operations import SubscriptionsOperations + +__all__ = [ + 'NamespacesOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'Operations', + 'DisasterRecoveryConfigsOperations', + 'MigrationConfigsOperations', + 'QueuesOperations', + 'TopicsOperations', + 'RulesOperations', + 'SubscriptionsOperations', +] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py new file mode 100644 index 0000000000000..bea5494b1ccdf --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py @@ -0,0 +1,725 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DisasterRecoveryConfigsOperations: + """DisasterRecoveryConfigsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.CheckNameAvailability", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": + """Check the give namespace name availability. + + :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 parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability'} # type: ignore + + def list( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ArmDisasterRecoveryListResult"]: + """Gets all Alias(Disaster Recovery configurations). + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecoveryListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecoveryListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ArmDisasterRecoveryListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: "_models.ArmDisasterRecovery", + **kwargs: Any + ) -> Optional["_models.ArmDisasterRecovery"]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :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 alias: The Disaster Recovery configuration name. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ArmDisasterRecovery"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ArmDisasterRecovery') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> None: + """Deletes an Alias(Disaster Recovery configuration). + + :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 alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> "_models.ArmDisasterRecovery": + """Retrieves Alias(Disaster Recovery configuration) for primary or secondary 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 alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecovery"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + async def break_pairing( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> None: + """This operation disables the Disaster Recovery and stops replicating changes from primary to + secondary namespaces. + + :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 alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.break_pairing.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + break_pairing.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing'} # type: ignore + + async def fail_over( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional["_models.FailoverProperties"] = None, + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary 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 alias: The Disaster Recovery configuration name. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.FailoverProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.fail_over.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'FailoverProperties') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + fail_over.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets the authorization 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 alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Gets an authorization rule 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 alias: The Disaster Recovery configuration name. + :type alias: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Gets the primary and secondary connection strings for the 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 alias: The Disaster Recovery configuration name. + :type alias: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_migration_configs_operations.py new file mode 100644 index 0000000000000..af381736c780c --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_migration_configs_operations.py @@ -0,0 +1,499 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MigrationConfigsOperations: + """MigrationConfigsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.MigrationConfigListResult"]: + """Gets all migrationConfigurations. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MigrationConfigListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('MigrationConfigListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations'} # type: ignore + + async def _create_and_start_migration_initial( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + parameters: "_models.MigrationConfigProperties", + **kwargs: Any + ) -> Optional["_models.MigrationConfigProperties"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MigrationConfigProperties"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_and_start_migration_initial.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'MigrationConfigProperties') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_and_start_migration_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + parameters: "_models.MigrationConfigProperties", + **kwargs: Any + ) -> AsyncLROPoller["_models.MigrationConfigProperties"]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + 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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationConfigProperties or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigProperties"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_and_start_migration_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + config_name=config_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_and_start_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> None: + """Deletes a MigrationConfiguration. + + :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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> "_models.MigrationConfigProperties": + """Retrieves Migration Config. + + :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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigrationConfigProperties, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def complete_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> None: + """This operation Completes Migration of entities by pointing the connection strings to Premium + namespace and any entities created after the operation will be under Premium Namespace. + CompleteMigration operation will fail when entity migration is in-progress. + + :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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.complete_migration.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + complete_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade'} # type: ignore + + async def revert( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> None: + """This operation reverts Migration. + + :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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.revert.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + revert.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_namespaces_operations.py new file mode 100644 index 0000000000000..506193bae4f70 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_namespaces_operations.py @@ -0,0 +1,1218 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NamespacesOperations: + """NamespacesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.SBNamespaceListResult"]: + """Gets all the available namespaces within the subscription, irrespective of the resource groups. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBNamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBNamespaceListResult"]: + """Gets the available namespaces within a resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBNamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.SBNamespace", + **kwargs: Any + ) -> Optional["_models.SBNamespace"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SBNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + 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'), + '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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespace') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.SBNamespace", + **kwargs: Any + ) -> AsyncLROPoller["_models.SBNamespace"]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + :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 parameters: Parameters supplied to create a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SBNamespace or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespace"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing namespace. This operation also removes all associated resources under the + 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> "_models.SBNamespace": + """Gets a description for the specified 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.SBNamespaceUpdateParameters", + **kwargs: Any + ) -> Optional["_models.SBNamespace"]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :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 parameters: Parameters supplied to update a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespaceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SBNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespaceUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.NetworkRuleSet", + **kwargs: Any + ) -> "_models.NetworkRuleSet": + """Create or update NetworkRuleSet 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 parameters: The Namespace IpFilterRule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_network_rule_set.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkRuleSet') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + async def get_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> "_models.NetworkRuleSet": + """Gets NetworkRuleSet 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_network_rule_set.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + def list_network_rule_sets( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkRuleSetListResult"]: + """Gets list of NetworkRuleSet 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkRuleSetListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_network_rule_sets.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkRuleSetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_network_rule_sets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets the authorization 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: "_models.SBAuthorizationRule", + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Creates or updates an authorization rule 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a namespace authorization rule. + + :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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Gets an authorization rule 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Gets the primary and secondary connection strings for the 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateAccessKeyParameters", + **kwargs: Any + ) -> "_models.AccessKeys": + """Regenerates the primary or secondary connection strings for the 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + async def check_name_availability( + self, + parameters: "_models.CheckNameAvailability", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_operations.py new file mode 100644 index 0000000000000..e6ea2cbe3aec6 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_operations.py @@ -0,0 +1,105 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists all of the available ServiceBus REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.ServiceBus/operations'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 0000000000000..c45008bfb2bbb --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,374 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations: + """PrivateEndpointConnectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: + """Gets the available PrivateEndpointConnections within 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Creates or updates PrivateEndpointConnections of service 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 private_endpoint_connection_name: The PrivateEndpointConnection name. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + '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), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + 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'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing Private Endpoint Connection. + + :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 private_endpoint_connection_name: The PrivateEndpointConnection name. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Gets a description for the specified Private Endpoint Connection. + + :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 private_endpoint_connection_name: The PrivateEndpointConnection name. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_private_link_resources_operations.py new file mode 100644 index 0000000000000..9cd5c0958ba18 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,100 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations: + """PrivateLinkResourcesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourcesListResult": + """Gets lists of resources that supports Privatelinks. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourcesListResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateLinkResourcesListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_queues_operations.py new file mode 100644 index 0000000000000..7e68a14f91302 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_queues_operations.py @@ -0,0 +1,750 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class QueuesOperations: + """QueuesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets all authorization rules for a queue. + + :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 queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: "_models.SBAuthorizationRule", + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Creates an authorization rule for a queue. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a queue authorization rule. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Gets an authorization rule for a queue 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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Primary and secondary connection strings to the queue. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateAccessKeyParameters", + **kwargs: Any + ) -> "_models.AccessKeys": + """Regenerates the primary or secondary connection strings to the queue. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def list_by_namespace( + self, + resource_group_name: str, + namespace_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SBQueueListResult"]: + """Gets the queues within 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 skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBQueueListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueueListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueueListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBQueueListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: "_models.SBQueue", + **kwargs: Any + ) -> "_models.SBQueue": + """Creates or updates a Service Bus queue. This operation is idempotent. + + :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 queue_name: The queue name. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBQueue') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> None: + """Deletes a queue from the specified namespace in a resource group. + + :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 queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> "_models.SBQueue": + """Returns a description for the specified queue. + + :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 queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_rules_operations.py new file mode 100644 index 0000000000000..ac8359450bc90 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_rules_operations.py @@ -0,0 +1,355 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RulesOperations: + """RulesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_subscriptions( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.RuleListResult"]: + """List all the rules within given topic-subscription. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.RuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscriptions.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscriptions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: "_models.Rule", + **kwargs: Any + ) -> "_models.Rule": + """Creates a new rule and updates an existing rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Rule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Rule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + **kwargs: Any + ) -> None: + """Deletes an existing rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + **kwargs: Any + ) -> "_models.Rule": + """Retrieves the description for the specified rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Rule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_subscriptions_operations.py new file mode 100644 index 0000000000000..bfe16b0bb5f3d --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_subscriptions_operations.py @@ -0,0 +1,339 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionsOperations: + """SubscriptionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_topic( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SBSubscriptionListResult"]: + """List all the subscriptions under a specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBSubscriptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_topic.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBSubscriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_topic.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: "_models.SBSubscription", + **kwargs: Any + ) -> "_models.SBSubscription": + """Creates a topic subscription. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBSubscription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + **kwargs: Any + ) -> None: + """Deletes a subscription from the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + **kwargs: Any + ) -> "_models.SBSubscription": + """Returns a subscription description for the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_topics_operations.py new file mode 100644 index 0000000000000..e48cb8ef382ab --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_topics_operations.py @@ -0,0 +1,750 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TopicsOperations: + """TopicsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets authorization rules for a topic. + + :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 topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: "_models.SBAuthorizationRule", + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Creates an authorization rule for the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Returns the specified authorization rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a topic authorization rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Gets the primary and secondary connection strings for the topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateAccessKeyParameters", + **kwargs: Any + ) -> "_models.AccessKeys": + """Regenerates primary or secondary connection strings for the topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def list_by_namespace( + self, + resource_group_name: str, + namespace_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SBTopicListResult"]: + """Gets all the topics in 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 skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBTopicListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopicListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopicListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBTopicListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: "_models.SBTopic", + **kwargs: Any + ) -> "_models.SBTopic": + """Creates a topic in the specified 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 topic_name: The topic name. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBTopic') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> None: + """Deletes a topic from the specified namespace and resource group. + + :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 topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> "_models.SBTopic": + """Returns a description for the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/__init__.py new file mode 100644 index 0000000000000..4497cba424430 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/__init__.py @@ -0,0 +1,210 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AccessKeys + from ._models_py3 import Action + from ._models_py3 import ArmDisasterRecovery + from ._models_py3 import ArmDisasterRecoveryListResult + from ._models_py3 import CheckNameAvailability + from ._models_py3 import CheckNameAvailabilityResult + from ._models_py3 import ConnectionState + from ._models_py3 import CorrelationFilter + from ._models_py3 import DictionaryValue + from ._models_py3 import Encryption + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorResponse + from ._models_py3 import ErrorResponseError + from ._models_py3 import FailoverProperties + from ._models_py3 import Identity + from ._models_py3 import KeyVaultProperties + from ._models_py3 import MessageCountDetails + from ._models_py3 import MigrationConfigListResult + from ._models_py3 import MigrationConfigProperties + from ._models_py3 import NWRuleSetIpRules + from ._models_py3 import NWRuleSetVirtualNetworkRules + from ._models_py3 import NetworkRuleSet + from ._models_py3 import NetworkRuleSetListResult + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult + from ._models_py3 import PrivateEndpoint + from ._models_py3 import PrivateEndpointConnection + from ._models_py3 import PrivateEndpointConnectionListResult + from ._models_py3 import PrivateLinkResource + from ._models_py3 import PrivateLinkResourcesListResult + from ._models_py3 import RegenerateAccessKeyParameters + from ._models_py3 import Resource + from ._models_py3 import ResourceNamespacePatch + from ._models_py3 import Rule + from ._models_py3 import RuleListResult + from ._models_py3 import SBAuthorizationRule + from ._models_py3 import SBAuthorizationRuleListResult + from ._models_py3 import SBNamespace + from ._models_py3 import SBNamespaceListResult + from ._models_py3 import SBNamespaceUpdateParameters + from ._models_py3 import SBQueue + from ._models_py3 import SBQueueListResult + from ._models_py3 import SBSku + from ._models_py3 import SBSubscription + from ._models_py3 import SBSubscriptionListResult + from ._models_py3 import SBTopic + from ._models_py3 import SBTopicListResult + from ._models_py3 import SqlFilter + from ._models_py3 import SqlRuleAction + from ._models_py3 import Subnet + from ._models_py3 import SystemData + from ._models_py3 import TrackedResource + from ._models_py3 import UserAssignedIdentityProperties +except (SyntaxError, ImportError): + from ._models import AccessKeys # type: ignore + from ._models import Action # type: ignore + from ._models import ArmDisasterRecovery # type: ignore + from ._models import ArmDisasterRecoveryListResult # type: ignore + from ._models import CheckNameAvailability # type: ignore + from ._models import CheckNameAvailabilityResult # type: ignore + from ._models import ConnectionState # type: ignore + from ._models import CorrelationFilter # type: ignore + from ._models import DictionaryValue # type: ignore + from ._models import Encryption # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import ErrorResponseError # type: ignore + from ._models import FailoverProperties # type: ignore + from ._models import Identity # type: ignore + from ._models import KeyVaultProperties # type: ignore + from ._models import MessageCountDetails # type: ignore + from ._models import MigrationConfigListResult # type: ignore + from ._models import MigrationConfigProperties # type: ignore + from ._models import NWRuleSetIpRules # type: ignore + from ._models import NWRuleSetVirtualNetworkRules # type: ignore + from ._models import NetworkRuleSet # type: ignore + from ._models import NetworkRuleSetListResult # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import PrivateEndpoint # type: ignore + from ._models import PrivateEndpointConnection # type: ignore + from ._models import PrivateEndpointConnectionListResult # type: ignore + from ._models import PrivateLinkResource # type: ignore + from ._models import PrivateLinkResourcesListResult # type: ignore + from ._models import RegenerateAccessKeyParameters # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceNamespacePatch # type: ignore + from ._models import Rule # type: ignore + from ._models import RuleListResult # type: ignore + from ._models import SBAuthorizationRule # type: ignore + from ._models import SBAuthorizationRuleListResult # type: ignore + from ._models import SBNamespace # type: ignore + from ._models import SBNamespaceListResult # type: ignore + from ._models import SBNamespaceUpdateParameters # type: ignore + from ._models import SBQueue # type: ignore + from ._models import SBQueueListResult # type: ignore + from ._models import SBSku # type: ignore + from ._models import SBSubscription # type: ignore + from ._models import SBSubscriptionListResult # type: ignore + from ._models import SBTopic # type: ignore + from ._models import SBTopicListResult # type: ignore + from ._models import SqlFilter # type: ignore + from ._models import SqlRuleAction # type: ignore + from ._models import Subnet # type: ignore + from ._models import SystemData # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import UserAssignedIdentityProperties # type: ignore + +from ._service_bus_management_client_enums import ( + AccessRights, + CreatedByType, + DefaultAction, + EndPointProvisioningState, + EntityStatus, + FilterType, + KeyType, + ManagedServiceIdentityType, + MigrationConfigurationName, + NetworkRuleIPAction, + PrivateLinkConnectionStatus, + ProvisioningStateDR, + RoleDisasterRecovery, + SkuName, + SkuTier, + UnavailableReason, +) + +__all__ = [ + 'AccessKeys', + 'Action', + 'ArmDisasterRecovery', + 'ArmDisasterRecoveryListResult', + 'CheckNameAvailability', + 'CheckNameAvailabilityResult', + 'ConnectionState', + 'CorrelationFilter', + 'DictionaryValue', + 'Encryption', + 'ErrorAdditionalInfo', + 'ErrorResponse', + 'ErrorResponseError', + 'FailoverProperties', + 'Identity', + 'KeyVaultProperties', + 'MessageCountDetails', + 'MigrationConfigListResult', + 'MigrationConfigProperties', + 'NWRuleSetIpRules', + 'NWRuleSetVirtualNetworkRules', + 'NetworkRuleSet', + 'NetworkRuleSetListResult', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionListResult', + 'PrivateLinkResource', + 'PrivateLinkResourcesListResult', + 'RegenerateAccessKeyParameters', + 'Resource', + 'ResourceNamespacePatch', + 'Rule', + 'RuleListResult', + 'SBAuthorizationRule', + 'SBAuthorizationRuleListResult', + 'SBNamespace', + 'SBNamespaceListResult', + 'SBNamespaceUpdateParameters', + 'SBQueue', + 'SBQueueListResult', + 'SBSku', + 'SBSubscription', + 'SBSubscriptionListResult', + 'SBTopic', + 'SBTopicListResult', + 'SqlFilter', + 'SqlRuleAction', + 'Subnet', + 'SystemData', + 'TrackedResource', + 'UserAssignedIdentityProperties', + 'AccessRights', + 'CreatedByType', + 'DefaultAction', + 'EndPointProvisioningState', + 'EntityStatus', + 'FilterType', + 'KeyType', + 'ManagedServiceIdentityType', + 'MigrationConfigurationName', + 'NetworkRuleIPAction', + 'PrivateLinkConnectionStatus', + 'ProvisioningStateDR', + 'RoleDisasterRecovery', + 'SkuName', + 'SkuTier', + 'UnavailableReason', +] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_models.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_models.py new file mode 100644 index 0000000000000..31655ef47e07e --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_models.py @@ -0,0 +1,2238 @@ +# 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 azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class AccessKeys(msrest.serialization.Model): + """Namespace/ServiceBus Connection String. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar primary_connection_string: Primary connection string of the created namespace + authorization rule. + :vartype primary_connection_string: str + :ivar secondary_connection_string: Secondary connection string of the created namespace + authorization rule. + :vartype secondary_connection_string: str + :ivar alias_primary_connection_string: Primary connection string of the alias if GEO DR is + enabled. + :vartype alias_primary_connection_string: str + :ivar alias_secondary_connection_string: Secondary connection string of the alias if GEO DR is + enabled. + :vartype alias_secondary_connection_string: str + :ivar primary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :vartype primary_key: str + :ivar secondary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :vartype secondary_key: str + :ivar key_name: A string that describes the authorization rule. + :vartype key_name: str + """ + + _validation = { + 'primary_connection_string': {'readonly': True}, + 'secondary_connection_string': {'readonly': True}, + 'alias_primary_connection_string': {'readonly': True}, + 'alias_secondary_connection_string': {'readonly': True}, + 'primary_key': {'readonly': True}, + 'secondary_key': {'readonly': True}, + 'key_name': {'readonly': True}, + } + + _attribute_map = { + 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, + 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, + 'alias_primary_connection_string': {'key': 'aliasPrimaryConnectionString', 'type': 'str'}, + 'alias_secondary_connection_string': {'key': 'aliasSecondaryConnectionString', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'key_name': {'key': 'keyName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AccessKeys, self).__init__(**kwargs) + self.primary_connection_string = None + self.secondary_connection_string = None + self.alias_primary_connection_string = None + self.alias_secondary_connection_string = None + self.primary_key = None + self.secondary_key = None + self.key_name = None + + +class Action(msrest.serialization.Model): + """Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. + + :param sql_expression: SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(Action, self).__init__(**kwargs) + self.sql_expression = kwargs.get('sql_expression', None) + self.compatibility_level = kwargs.get('compatibility_level', None) + self.requires_preprocessing = kwargs.get('requires_preprocessing', True) + + +class Resource(msrest.serialization.Model): + """The Resource definition for other than namespace. + + 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 + """ + + _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'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ArmDisasterRecovery(Resource): + """Single item in List or Get Alias(Disaster Recovery configuration) 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 + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar provisioning_state: Provisioning state of the Alias(Disaster Recovery configuration) - + possible values 'Accepted' or 'Succeeded' or 'Failed'. Possible values include: "Accepted", + "Succeeded", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.servicebus.v2021_01_01_preview.models.ProvisioningStateDR + :ivar pending_replication_operations_count: Number of entities pending to be replicated. + :vartype pending_replication_operations_count: long + :param partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is + part of GEO DR pairing. + :type partner_namespace: str + :param alternate_name: Primary/Secondary eventhub namespace name, which is part of GEO DR + pairing. + :type alternate_name: str + :ivar role: role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' + or 'Secondary'. Possible values include: "Primary", "PrimaryNotReplicating", "Secondary". + :vartype role: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.RoleDisasterRecovery + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'pending_replication_operations_count': {'readonly': True}, + 'role': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, + 'partner_namespace': {'key': 'properties.partnerNamespace', 'type': 'str'}, + 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, + 'role': {'key': 'properties.role', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ArmDisasterRecovery, self).__init__(**kwargs) + self.system_data = None + self.provisioning_state = None + self.pending_replication_operations_count = None + self.partner_namespace = kwargs.get('partner_namespace', None) + self.alternate_name = kwargs.get('alternate_name', None) + self.role = None + + +class ArmDisasterRecoveryListResult(msrest.serialization.Model): + """The result of the List Alias(Disaster Recovery configuration) operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Alias(Disaster Recovery configurations). + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Alias(Disaster Recovery configuration). + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ArmDisasterRecovery]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ArmDisasterRecoveryListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class CheckNameAvailability(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The Name to check the namespace name availability and The namespace name + can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it + must end with a letter or number. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailability, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class CheckNameAvailabilityResult(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar message: The detailed info regarding the reason associated with the namespace. + :vartype message: str + :param name_available: Value indicating namespace is availability, true if the namespace is + available; otherwise, false. + :type name_available: bool + :param reason: The reason for unavailability of a namespace. Possible values include: "None", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "TooManyNamespaceInCurrentSubscription". + :type reason: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.UnavailableReason + """ + + _validation = { + 'message': {'readonly': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.message = None + self.name_available = kwargs.get('name_available', None) + self.reason = kwargs.get('reason', None) + + +class ConnectionState(msrest.serialization.Model): + """ConnectionState information. + + :param status: Status of the connection. Possible values include: "Pending", "Approved", + "Rejected", "Disconnected". + :type status: str or + ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateLinkConnectionStatus + :param description: Description of the connection state. + :type description: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ConnectionState, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.description = kwargs.get('description', None) + + +class CorrelationFilter(msrest.serialization.Model): + """Represents the correlation filter expression. + + :param properties: dictionary object for custom filters. + :type properties: dict[str, str] + :param correlation_id: Identifier of the correlation. + :type correlation_id: str + :param message_id: Identifier of the message. + :type message_id: str + :param to: Address to send to. + :type to: str + :param reply_to: Address of the queue to reply to. + :type reply_to: str + :param label: Application specific label. + :type label: str + :param session_id: Session identifier. + :type session_id: str + :param reply_to_session_id: Session identifier to reply to. + :type reply_to_session_id: str + :param content_type: Content type of the message. + :type content_type: str + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': '{str}'}, + 'correlation_id': {'key': 'correlationId', 'type': 'str'}, + 'message_id': {'key': 'messageId', 'type': 'str'}, + 'to': {'key': 'to', 'type': 'str'}, + 'reply_to': {'key': 'replyTo', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'session_id': {'key': 'sessionId', 'type': 'str'}, + 'reply_to_session_id': {'key': 'replyToSessionId', 'type': 'str'}, + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(CorrelationFilter, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.correlation_id = kwargs.get('correlation_id', None) + self.message_id = kwargs.get('message_id', None) + self.to = kwargs.get('to', None) + self.reply_to = kwargs.get('reply_to', None) + self.label = kwargs.get('label', None) + self.session_id = kwargs.get('session_id', None) + self.reply_to_session_id = kwargs.get('reply_to_session_id', None) + self.content_type = kwargs.get('content_type', None) + self.requires_preprocessing = kwargs.get('requires_preprocessing', True) + + +class DictionaryValue(msrest.serialization.Model): + """Recognized Dictionary value. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Principal Id of user assigned identity. + :vartype principal_id: str + :ivar client_id: Client Id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DictionaryValue, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class Encryption(msrest.serialization.Model): + """Properties to configure Encryption. + + :param key_vault_properties: Properties of KeyVault. + :type key_vault_properties: + list[~azure.mgmt.servicebus.v2021_01_01_preview.models.KeyVaultProperties] + :param key_source: Enumerates the possible value of keySource for Encryption. The only + acceptable values to pass in are None and "Microsoft.KeyVault". The default value is + "Microsoft.KeyVault". + :type key_source: str + :param require_infrastructure_encryption: Enable Infrastructure Encryption (Double Encryption). + :type require_infrastructure_encryption: bool + """ + + _attribute_map = { + 'key_vault_properties': {'key': 'keyVaultProperties', 'type': '[KeyVaultProperties]'}, + 'key_source': {'key': 'keySource', 'type': 'str'}, + 'require_infrastructure_encryption': {'key': 'requireInfrastructureEncryption', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(Encryption, self).__init__(**kwargs) + self.key_vault_properties = kwargs.get('key_vault_properties', None) + self.key_source = kwargs.get('key_source', "Microsoft.KeyVault") + self.require_infrastructure_encryption = kwargs.get('require_infrastructure_encryption', None) + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """The resource management error response. + + :param error: The error object. + :type error: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ErrorResponseError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseError(msrest.serialization.Model): + """The error object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.servicebus.v2021_01_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseError, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class FailoverProperties(msrest.serialization.Model): + """Safe failover is to indicate the service should wait for pending replication to finish before switching to the secondary. + + :param is_safe_failover: Safe failover is to indicate the service should wait for pending + replication to finish before switching to the secondary. + :type is_safe_failover: bool + """ + + _attribute_map = { + 'is_safe_failover': {'key': 'properties.IsSafeFailover', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(FailoverProperties, self).__init__(**kwargs) + self.is_safe_failover = kwargs.get('is_safe_failover', None) + + +class Identity(msrest.serialization.Model): + """Properties to configure User Assigned Identities for Bring your Own Keys. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: ObjectId from the KeyVault. + :vartype principal_id: str + :ivar tenant_id: TenantId from the KeyVault. + :vartype tenant_id: str + :param type: Type of managed service identity. Possible values include: "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.ManagedServiceIdentityType + :param user_assigned_identities: Properties for User Assigned Identities. + :type user_assigned_identities: dict[str, + ~azure.mgmt.servicebus.v2021_01_01_preview.models.DictionaryValue] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{DictionaryValue}'}, + } + + def __init__( + self, + **kwargs + ): + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs.get('type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + + +class KeyVaultProperties(msrest.serialization.Model): + """Properties to configure keyVault Properties. + + :param key_name: Name of the Key from KeyVault. + :type key_name: str + :param key_vault_uri: Uri of KeyVault. + :type key_vault_uri: str + :param key_version: Version of KeyVault. + :type key_version: str + :param identity: + :type identity: + ~azure.mgmt.servicebus.v2021_01_01_preview.models.UserAssignedIdentityProperties + """ + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, + 'key_version': {'key': 'keyVersion', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'UserAssignedIdentityProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyVaultProperties, self).__init__(**kwargs) + self.key_name = kwargs.get('key_name', None) + self.key_vault_uri = kwargs.get('key_vault_uri', None) + self.key_version = kwargs.get('key_version', None) + self.identity = kwargs.get('identity', None) + + +class MessageCountDetails(msrest.serialization.Model): + """Message Count Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar active_message_count: Number of active messages in the queue, topic, or subscription. + :vartype active_message_count: long + :ivar dead_letter_message_count: Number of messages that are dead lettered. + :vartype dead_letter_message_count: long + :ivar scheduled_message_count: Number of scheduled messages. + :vartype scheduled_message_count: long + :ivar transfer_message_count: Number of messages transferred to another queue, topic, or + subscription. + :vartype transfer_message_count: long + :ivar transfer_dead_letter_message_count: Number of messages transferred into dead letters. + :vartype transfer_dead_letter_message_count: long + """ + + _validation = { + 'active_message_count': {'readonly': True}, + 'dead_letter_message_count': {'readonly': True}, + 'scheduled_message_count': {'readonly': True}, + 'transfer_message_count': {'readonly': True}, + 'transfer_dead_letter_message_count': {'readonly': True}, + } + + _attribute_map = { + 'active_message_count': {'key': 'activeMessageCount', 'type': 'long'}, + 'dead_letter_message_count': {'key': 'deadLetterMessageCount', 'type': 'long'}, + 'scheduled_message_count': {'key': 'scheduledMessageCount', 'type': 'long'}, + 'transfer_message_count': {'key': 'transferMessageCount', 'type': 'long'}, + 'transfer_dead_letter_message_count': {'key': 'transferDeadLetterMessageCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(MessageCountDetails, self).__init__(**kwargs) + self.active_message_count = None + self.dead_letter_message_count = None + self.scheduled_message_count = None + self.transfer_message_count = None + self.transfer_dead_letter_message_count = None + + +class MigrationConfigListResult(msrest.serialization.Model): + """The result of the List migrationConfigurations operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Migration Configs. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of migrationConfigurations. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MigrationConfigProperties]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrationConfigListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class MigrationConfigProperties(Resource): + """Single item in List or Get Migration Config 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 + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar provisioning_state: Provisioning state of Migration Configuration. + :vartype provisioning_state: str + :ivar pending_replication_operations_count: Number of entities pending to be replicated. + :vartype pending_replication_operations_count: long + :param target_namespace: Existing premium Namespace ARM Id name which has no entities, will be + used for migration. + :type target_namespace: str + :param post_migration_name: Name to access Standard Namespace after migration. + :type post_migration_name: str + :ivar migration_state: State in which Standard to Premium Migration is, possible values : + Unknown, Reverting, Completing, Initiating, Syncing, Active. + :vartype migration_state: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'pending_replication_operations_count': {'readonly': True}, + 'migration_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, + 'target_namespace': {'key': 'properties.targetNamespace', 'type': 'str'}, + 'post_migration_name': {'key': 'properties.postMigrationName', 'type': 'str'}, + 'migration_state': {'key': 'properties.migrationState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrationConfigProperties, self).__init__(**kwargs) + self.system_data = None + self.provisioning_state = None + self.pending_replication_operations_count = None + self.target_namespace = kwargs.get('target_namespace', None) + self.post_migration_name = kwargs.get('post_migration_name', None) + self.migration_state = None + + +class NetworkRuleSet(Resource): + """Description of NetworkRuleSet 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 + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :param default_action: Default Action for Network Rule Set. Possible values include: "Allow", + "Deny". + :type default_action: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.DefaultAction + :param virtual_network_rules: List VirtualNetwork Rules. + :type virtual_network_rules: + list[~azure.mgmt.servicebus.v2021_01_01_preview.models.NWRuleSetVirtualNetworkRules] + :param ip_rules: List of IpRules. + :type ip_rules: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.NWRuleSetIpRules] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'default_action': {'key': 'properties.defaultAction', 'type': 'str'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[NWRuleSetVirtualNetworkRules]'}, + 'ip_rules': {'key': 'properties.ipRules', 'type': '[NWRuleSetIpRules]'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkRuleSet, self).__init__(**kwargs) + self.system_data = None + self.default_action = kwargs.get('default_action', None) + self.virtual_network_rules = kwargs.get('virtual_network_rules', None) + self.ip_rules = kwargs.get('ip_rules', None) + + +class NetworkRuleSetListResult(msrest.serialization.Model): + """The response of the List NetworkRuleSet operation. + + :param value: Result of the List NetworkRuleSet operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of NetworkRuleSet. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkRuleSet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkRuleSetListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class NWRuleSetIpRules(msrest.serialization.Model): + """Description of NetWorkRuleSet - IpRules resource. + + :param ip_mask: IP Mask. + :type ip_mask: str + :param action: The IP Filter Action. Possible values include: "Allow". Default value: "Allow". + :type action: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleIPAction + """ + + _attribute_map = { + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NWRuleSetIpRules, self).__init__(**kwargs) + self.ip_mask = kwargs.get('ip_mask', None) + self.action = kwargs.get('action', "Allow") + + +class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): + """Description of VirtualNetworkRules - NetworkRules resource. + + :param subnet: Subnet properties. + :type subnet: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Subnet + :param ignore_missing_vnet_service_endpoint: Value that indicates whether to ignore missing + VNet Service Endpoint. + :type ignore_missing_vnet_service_endpoint: bool + """ + + _attribute_map = { + 'subnet': {'key': 'subnet', 'type': 'Subnet'}, + 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(NWRuleSetVirtualNetworkRules, self).__init__(**kwargs) + self.subnet = kwargs.get('subnet', None) + self.ignore_missing_vnet_service_endpoint = kwargs.get('ignore_missing_vnet_service_endpoint', None) + + +class Operation(msrest.serialization.Model): + """A ServiceBus REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.servicebus.v2021_01_01_preview.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = kwargs.get('display', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft.ServiceBus. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Invoice, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list ServiceBus operations. It contains a list of operations and a URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of ServiceBus operations supported by the Microsoft.ServiceBus resource + provider. + :vartype value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PrivateEndpoint(msrest.serialization.Model): + """PrivateEndpoint information. + + :param id: The ARM identifier for Private Endpoint. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class PrivateEndpointConnection(Resource): + """Properties of the PrivateEndpointConnection. + + 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 + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :param private_endpoint: The Private Endpoint resource for this Connection. + :type private_endpoint: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpoint + :param private_link_service_connection_state: Details about the state of the connection. + :type private_link_service_connection_state: + ~azure.mgmt.servicebus.v2021_01_01_preview.models.ConnectionState + :param provisioning_state: Provisioning state of the Private Endpoint Connection. Possible + values include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + :type provisioning_state: str or + ~azure.mgmt.servicebus.v2021_01_01_preview.models.EndPointProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'ConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.system_data = None + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) + self.provisioning_state = kwargs.get('provisioning_state', None) + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """Result of the list of all private endpoint connections operation. + + :param value: A collection of private endpoint connection resources. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection] + :param next_link: A link for the next page of private endpoint connection resources. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class PrivateLinkResource(msrest.serialization.Model): + """Information of the private link resource. + + :param id: Fully qualified identifier of the resource. + :type id: str + :param name: Name of the resource. + :type name: str + :param type: Type of the resource. + :type type: str + :param group_id: + :type group_id: str + :param required_members: Required Members. + :type required_members: list[str] + :param required_zone_names: Required Zone Names. + :type required_zone_names: list[str] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + self.group_id = kwargs.get('group_id', None) + self.required_members = kwargs.get('required_members', None) + self.required_zone_names = kwargs.get('required_zone_names', None) + + +class PrivateLinkResourcesListResult(msrest.serialization.Model): + """Result of the List private link resources operation. + + :param value: A collection of private link resources. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateLinkResource] + :param next_link: A link for the next page of private link resources. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class RegenerateAccessKeyParameters(msrest.serialization.Model): + """Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs to be reset. + + All required parameters must be populated in order to send to Azure. + + :param key_type: Required. The access key to regenerate. Possible values include: "PrimaryKey", + "SecondaryKey". + :type key_type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.KeyType + :param key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key + value set for keyType. + :type key: str + """ + + _validation = { + 'key_type': {'required': True}, + } + + _attribute_map = { + 'key_type': {'key': 'keyType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RegenerateAccessKeyParameters, self).__init__(**kwargs) + self.key_type = kwargs['key_type'] + self.key = kwargs.get('key', None) + + +class ResourceNamespacePatch(Resource): + """The Resource definition. + + 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: A set of tags. Resource tags. + :type tags: dict[str, 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}'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceNamespacePatch, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class Rule(Resource): + """Description of Rule 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 + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :param action: Represents the filter actions which are allowed for the transformation of a + message that have been matched by a filter expression. + :type action: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Action + :param filter_type: Filter type that is evaluated against a BrokeredMessage. Possible values + include: "SqlFilter", "CorrelationFilter". + :type filter_type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.FilterType + :param sql_filter: Properties of sqlFilter. + :type sql_filter: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SqlFilter + :param correlation_filter: Properties of correlationFilter. + :type correlation_filter: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CorrelationFilter + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'action': {'key': 'properties.action', 'type': 'Action'}, + 'filter_type': {'key': 'properties.filterType', 'type': 'str'}, + 'sql_filter': {'key': 'properties.sqlFilter', 'type': 'SqlFilter'}, + 'correlation_filter': {'key': 'properties.correlationFilter', 'type': 'CorrelationFilter'}, + } + + def __init__( + self, + **kwargs + ): + super(Rule, self).__init__(**kwargs) + self.system_data = None + self.action = kwargs.get('action', None) + self.filter_type = kwargs.get('filter_type', None) + self.sql_filter = kwargs.get('sql_filter', None) + self.correlation_filter = kwargs.get('correlation_filter', None) + + +class RuleListResult(msrest.serialization.Model): + """The response of the List rule operation. + + :param value: Result of the List Rules operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of rules. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Rule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RuleListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SBAuthorizationRule(Resource): + """Description of a namespace authorization rule. + + 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 + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :param rights: The rights associated with the rule. + :type rights: list[str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessRights] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'rights': {'key': 'properties.rights', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(SBAuthorizationRule, self).__init__(**kwargs) + self.system_data = None + self.rights = kwargs.get('rights', None) + + +class SBAuthorizationRuleListResult(msrest.serialization.Model): + """The response to the List Namespace operation. + + :param value: Result of the List Authorization Rules operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Authorization Rules. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBAuthorizationRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class TrackedResource(Resource): + """The Resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. The Geo-location where the resource lives. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': 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}'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) + + +class SBNamespace(TrackedResource): + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. The Geo-location where the resource lives. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Properties of SKU. + :type sku: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSku + :param identity: Properties of BYOK Identity description. + :type identity: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Identity + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :ivar status: Status of the namespace. + :vartype status: str + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :ivar metric_id: Identifier for Azure Insights metrics. + :vartype metric_id: str + :param zone_redundant: Enabling this property creates a Premium Service Bus Namespace in + regions supported availability zones. + :type zone_redundant: bool + :param encryption: Properties of BYOK Encryption description. + :type encryption: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Encryption + :param private_endpoint_connections: List of private endpoint connections. + :type private_endpoint_connections: + list[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + 'metric_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SBSku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, + 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + } + + def __init__( + self, + **kwargs + ): + super(SBNamespace, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.identity = kwargs.get('identity', None) + self.system_data = None + self.provisioning_state = None + self.status = None + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.metric_id = None + self.zone_redundant = kwargs.get('zone_redundant', None) + self.encryption = kwargs.get('encryption', None) + self.private_endpoint_connections = kwargs.get('private_endpoint_connections', None) + + +class SBNamespaceListResult(msrest.serialization.Model): + """The response of the List Namespace operation. + + :param value: Result of the List Namespace operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Namespaces. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBNamespace]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBNamespaceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SBNamespaceUpdateParameters(ResourceNamespacePatch): + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Properties of SKU. + :type sku: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSku + :param identity: Properties of BYOK Identity description. + :type identity: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Identity + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :ivar status: Status of the namespace. + :vartype status: str + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :ivar metric_id: Identifier for Azure Insights metrics. + :vartype metric_id: str + :param zone_redundant: Enabling this property creates a Premium Service Bus Namespace in + regions supported availability zones. + :type zone_redundant: bool + :param encryption: Properties of BYOK Encryption description. + :type encryption: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Encryption + :param private_endpoint_connections: List of private endpoint connections. + :type private_endpoint_connections: + list[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + 'metric_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SBSku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, + 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + } + + def __init__( + self, + **kwargs + ): + super(SBNamespaceUpdateParameters, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.identity = kwargs.get('identity', None) + self.provisioning_state = None + self.status = None + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.metric_id = None + self.zone_redundant = kwargs.get('zone_redundant', None) + self.encryption = kwargs.get('encryption', None) + self.private_endpoint_connections = kwargs.get('private_endpoint_connections', None) + + +class SBQueue(Resource): + """Description of queue 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 + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MessageCountDetails + :ivar created_at: The exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar accessed_at: Last time a message was sent, or the last time there was a receive request + to this queue. + :vartype accessed_at: ~datetime.datetime + :ivar size_in_bytes: The size of the queue, in bytes. + :vartype size_in_bytes: long + :ivar message_count: The number of messages in the queue. + :vartype message_count: long + :param lock_duration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time + that the message is locked for other receivers. The maximum value for LockDuration is 5 + minutes; the default value is 1 minute. + :type lock_duration: ~datetime.timedelta + :param max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size of + memory allocated for the queue. Default is 1024. + :type max_size_in_megabytes: int + :param requires_duplicate_detection: A value indicating if this queue requires duplicate + detection. + :type requires_duplicate_detection: bool + :param requires_session: A value that indicates whether the queue supports the concept of + sessions. + :type requires_session: bool + :param default_message_time_to_live: ISO 8601 default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param dead_lettering_on_message_expiration: A value that indicates whether this queue has dead + letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param duplicate_detection_history_time_window: ISO 8601 timeSpan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param max_delivery_count: The maximum delivery count. A message is automatically deadlettered + after this number of deliveries. default value is 10. + :type max_delivery_count: int + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.EntityStatus + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param auto_delete_on_idle: ISO 8061 timeSpan idle interval after which the queue is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param enable_partitioning: A value that indicates whether the queue is to be partitioned + across multiple message brokers. + :type enable_partitioning: bool + :param enable_express: A value that indicates whether Express Entities are enabled. An express + queue holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param forward_to: Queue/Topic name to forward the messages. + :type forward_to: str + :param forward_dead_lettered_messages_to: Queue/Topic name to forward the Dead Letter message. + :type forward_dead_lettered_messages_to: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'count_details': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'message_count': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, + 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBQueue, self).__init__(**kwargs) + self.system_data = None + self.count_details = None + self.created_at = None + self.updated_at = None + self.accessed_at = None + self.size_in_bytes = None + self.message_count = None + self.lock_duration = kwargs.get('lock_duration', None) + self.max_size_in_megabytes = kwargs.get('max_size_in_megabytes', None) + self.requires_duplicate_detection = kwargs.get('requires_duplicate_detection', None) + self.requires_session = kwargs.get('requires_session', None) + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.dead_lettering_on_message_expiration = kwargs.get('dead_lettering_on_message_expiration', None) + self.duplicate_detection_history_time_window = kwargs.get('duplicate_detection_history_time_window', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + self.status = kwargs.get('status', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.enable_partitioning = kwargs.get('enable_partitioning', None) + self.enable_express = kwargs.get('enable_express', None) + self.forward_to = kwargs.get('forward_to', None) + self.forward_dead_lettered_messages_to = kwargs.get('forward_dead_lettered_messages_to', None) + + +class SBQueueListResult(msrest.serialization.Model): + """The response to the List Queues operation. + + :param value: Result of the List Queues operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of queues. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBQueue]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBQueueListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SBSku(msrest.serialization.Model): + """SKU of the namespace. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of this SKU. Possible values include: "Basic", "Standard", + "Premium". + :type name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.SkuName + :param tier: The billing tier of this particular SKU. Possible values include: "Basic", + "Standard", "Premium". + :type tier: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.SkuTier + :param capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 + and 4. + :type capacity: int + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(SBSku, self).__init__(**kwargs) + self.name = kwargs['name'] + self.tier = kwargs.get('tier', None) + self.capacity = kwargs.get('capacity', None) + + +class SBSubscription(Resource): + """Description of subscription 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 + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar message_count: Number of messages. + :vartype message_count: long + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar accessed_at: Last time there was a receive request to this subscription. + :vartype accessed_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar count_details: Message count details. + :vartype count_details: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MessageCountDetails + :param lock_duration: ISO 8061 lock duration timespan for the subscription. The default value + is 1 minute. + :type lock_duration: ~datetime.timedelta + :param requires_session: Value indicating if a subscription supports the concept of sessions. + :type requires_session: bool + :param default_message_time_to_live: ISO 8061 Default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param dead_lettering_on_filter_evaluation_exceptions: Value that indicates whether a + subscription has dead letter support on filter evaluation exceptions. + :type dead_lettering_on_filter_evaluation_exceptions: bool + :param dead_lettering_on_message_expiration: Value that indicates whether a subscription has + dead letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param duplicate_detection_history_time_window: ISO 8601 timeSpan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param max_delivery_count: Number of maximum deliveries. + :type max_delivery_count: int + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.EntityStatus + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param auto_delete_on_idle: ISO 8061 timeSpan idle interval after which the topic is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param forward_to: Queue/Topic name to forward the messages. + :type forward_to: str + :param forward_dead_lettered_messages_to: Queue/Topic name to forward the Dead Letter message. + :type forward_dead_lettered_messages_to: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'message_count': {'readonly': True}, + 'created_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'count_details': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, + 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBSubscription, self).__init__(**kwargs) + self.system_data = None + self.message_count = None + self.created_at = None + self.accessed_at = None + self.updated_at = None + self.count_details = None + self.lock_duration = kwargs.get('lock_duration', None) + self.requires_session = kwargs.get('requires_session', None) + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.dead_lettering_on_filter_evaluation_exceptions = kwargs.get('dead_lettering_on_filter_evaluation_exceptions', None) + self.dead_lettering_on_message_expiration = kwargs.get('dead_lettering_on_message_expiration', None) + self.duplicate_detection_history_time_window = kwargs.get('duplicate_detection_history_time_window', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + self.status = kwargs.get('status', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.forward_to = kwargs.get('forward_to', None) + self.forward_dead_lettered_messages_to = kwargs.get('forward_dead_lettered_messages_to', None) + + +class SBSubscriptionListResult(msrest.serialization.Model): + """The response to the List Subscriptions operation. + + :param value: Result of the List Subscriptions operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of subscriptions. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBSubscription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBSubscriptionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SBTopic(Resource): + """Description of topic 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 + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar size_in_bytes: Size of the topic, in bytes. + :vartype size_in_bytes: long + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar accessed_at: Last time the message was sent, or a request was received, for this topic. + :vartype accessed_at: ~datetime.datetime + :ivar subscription_count: Number of subscriptions. + :vartype subscription_count: int + :ivar count_details: Message count details. + :vartype count_details: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MessageCountDetails + :param default_message_time_to_live: ISO 8601 Default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param max_size_in_megabytes: Maximum size of the topic in megabytes, which is the size of the + memory allocated for the topic. Default is 1024. + :type max_size_in_megabytes: int + :param requires_duplicate_detection: Value indicating if this topic requires duplicate + detection. + :type requires_duplicate_detection: bool + :param duplicate_detection_history_time_window: ISO8601 timespan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.EntityStatus + :param support_ordering: Value that indicates whether the topic supports ordering. + :type support_ordering: bool + :param auto_delete_on_idle: ISO 8601 timespan idle interval after which the topic is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param enable_partitioning: Value that indicates whether the topic to be partitioned across + multiple message brokers is enabled. + :type enable_partitioning: bool + :param enable_express: Value that indicates whether Express Entities are enabled. An express + topic holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'subscription_count': {'readonly': True}, + 'count_details': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(SBTopic, self).__init__(**kwargs) + self.system_data = None + self.size_in_bytes = None + self.created_at = None + self.updated_at = None + self.accessed_at = None + self.subscription_count = None + self.count_details = None + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.max_size_in_megabytes = kwargs.get('max_size_in_megabytes', None) + self.requires_duplicate_detection = kwargs.get('requires_duplicate_detection', None) + self.duplicate_detection_history_time_window = kwargs.get('duplicate_detection_history_time_window', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.status = kwargs.get('status', None) + self.support_ordering = kwargs.get('support_ordering', None) + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.enable_partitioning = kwargs.get('enable_partitioning', None) + self.enable_express = kwargs.get('enable_express', None) + + +class SBTopicListResult(msrest.serialization.Model): + """The response to the List Topics operation. + + :param value: Result of the List Topics operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of topics. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBTopic]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBTopicListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SqlFilter(msrest.serialization.Model): + """Represents a filter which is a composition of an expression and an action that is executed in the pub/sub pipeline. + + :param sql_expression: The SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _validation = { + 'compatibility_level': {'maximum': 20, 'minimum': 20}, + } + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(SqlFilter, self).__init__(**kwargs) + self.sql_expression = kwargs.get('sql_expression', None) + self.compatibility_level = kwargs.get('compatibility_level', 20) + self.requires_preprocessing = kwargs.get('requires_preprocessing', True) + + +class SqlRuleAction(Action): + """Represents set of actions written in SQL language-based syntax that is performed against a ServiceBus.Messaging.BrokeredMessage. + + :param sql_expression: SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(SqlRuleAction, self).__init__(**kwargs) + + +class Subnet(msrest.serialization.Model): + """Properties supplied for Subnet. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Resource ID of Virtual Network Subnet. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Subnet, self).__init__(**kwargs) + self.id = kwargs['id'] + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or + ~azure.mgmt.servicebus.v2021_01_01_preview.models.CreatedByType + :param last_modified_at: The type of identity that last modified the resource. + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + +class UserAssignedIdentityProperties(msrest.serialization.Model): + """UserAssignedIdentityProperties. + + :param user_assigned_identity: ARM ID of user Identity selected for encryption. + :type user_assigned_identity: str + """ + + _attribute_map = { + 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserAssignedIdentityProperties, self).__init__(**kwargs) + self.user_assigned_identity = kwargs.get('user_assigned_identity', None) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_models_py3.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_models_py3.py new file mode 100644 index 0000000000000..fb1f26cfa3856 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_models_py3.py @@ -0,0 +1,2439 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._service_bus_management_client_enums import * + + +class AccessKeys(msrest.serialization.Model): + """Namespace/ServiceBus Connection String. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar primary_connection_string: Primary connection string of the created namespace + authorization rule. + :vartype primary_connection_string: str + :ivar secondary_connection_string: Secondary connection string of the created namespace + authorization rule. + :vartype secondary_connection_string: str + :ivar alias_primary_connection_string: Primary connection string of the alias if GEO DR is + enabled. + :vartype alias_primary_connection_string: str + :ivar alias_secondary_connection_string: Secondary connection string of the alias if GEO DR is + enabled. + :vartype alias_secondary_connection_string: str + :ivar primary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :vartype primary_key: str + :ivar secondary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :vartype secondary_key: str + :ivar key_name: A string that describes the authorization rule. + :vartype key_name: str + """ + + _validation = { + 'primary_connection_string': {'readonly': True}, + 'secondary_connection_string': {'readonly': True}, + 'alias_primary_connection_string': {'readonly': True}, + 'alias_secondary_connection_string': {'readonly': True}, + 'primary_key': {'readonly': True}, + 'secondary_key': {'readonly': True}, + 'key_name': {'readonly': True}, + } + + _attribute_map = { + 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, + 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, + 'alias_primary_connection_string': {'key': 'aliasPrimaryConnectionString', 'type': 'str'}, + 'alias_secondary_connection_string': {'key': 'aliasSecondaryConnectionString', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'key_name': {'key': 'keyName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AccessKeys, self).__init__(**kwargs) + self.primary_connection_string = None + self.secondary_connection_string = None + self.alias_primary_connection_string = None + self.alias_secondary_connection_string = None + self.primary_key = None + self.secondary_key = None + self.key_name = None + + +class Action(msrest.serialization.Model): + """Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. + + :param sql_expression: SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + *, + sql_expression: Optional[str] = None, + compatibility_level: Optional[int] = None, + requires_preprocessing: Optional[bool] = True, + **kwargs + ): + super(Action, self).__init__(**kwargs) + self.sql_expression = sql_expression + self.compatibility_level = compatibility_level + self.requires_preprocessing = requires_preprocessing + + +class Resource(msrest.serialization.Model): + """The Resource definition for other than namespace. + + 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 + """ + + _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'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ArmDisasterRecovery(Resource): + """Single item in List or Get Alias(Disaster Recovery configuration) 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 + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar provisioning_state: Provisioning state of the Alias(Disaster Recovery configuration) - + possible values 'Accepted' or 'Succeeded' or 'Failed'. Possible values include: "Accepted", + "Succeeded", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.servicebus.v2021_01_01_preview.models.ProvisioningStateDR + :ivar pending_replication_operations_count: Number of entities pending to be replicated. + :vartype pending_replication_operations_count: long + :param partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is + part of GEO DR pairing. + :type partner_namespace: str + :param alternate_name: Primary/Secondary eventhub namespace name, which is part of GEO DR + pairing. + :type alternate_name: str + :ivar role: role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' + or 'Secondary'. Possible values include: "Primary", "PrimaryNotReplicating", "Secondary". + :vartype role: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.RoleDisasterRecovery + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'pending_replication_operations_count': {'readonly': True}, + 'role': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, + 'partner_namespace': {'key': 'properties.partnerNamespace', 'type': 'str'}, + 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, + 'role': {'key': 'properties.role', 'type': 'str'}, + } + + def __init__( + self, + *, + partner_namespace: Optional[str] = None, + alternate_name: Optional[str] = None, + **kwargs + ): + super(ArmDisasterRecovery, self).__init__(**kwargs) + self.system_data = None + self.provisioning_state = None + self.pending_replication_operations_count = None + self.partner_namespace = partner_namespace + self.alternate_name = alternate_name + self.role = None + + +class ArmDisasterRecoveryListResult(msrest.serialization.Model): + """The result of the List Alias(Disaster Recovery configuration) operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Alias(Disaster Recovery configurations). + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Alias(Disaster Recovery configuration). + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ArmDisasterRecovery]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ArmDisasterRecovery"]] = None, + **kwargs + ): + super(ArmDisasterRecoveryListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class CheckNameAvailability(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The Name to check the namespace name availability and The namespace name + can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it + must end with a letter or number. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(CheckNameAvailability, self).__init__(**kwargs) + self.name = name + + +class CheckNameAvailabilityResult(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar message: The detailed info regarding the reason associated with the namespace. + :vartype message: str + :param name_available: Value indicating namespace is availability, true if the namespace is + available; otherwise, false. + :type name_available: bool + :param reason: The reason for unavailability of a namespace. Possible values include: "None", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "TooManyNamespaceInCurrentSubscription". + :type reason: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.UnavailableReason + """ + + _validation = { + 'message': {'readonly': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + } + + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[Union[str, "UnavailableReason"]] = None, + **kwargs + ): + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.message = None + self.name_available = name_available + self.reason = reason + + +class ConnectionState(msrest.serialization.Model): + """ConnectionState information. + + :param status: Status of the connection. Possible values include: "Pending", "Approved", + "Rejected", "Disconnected". + :type status: str or + ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateLinkConnectionStatus + :param description: Description of the connection state. + :type description: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "PrivateLinkConnectionStatus"]] = None, + description: Optional[str] = None, + **kwargs + ): + super(ConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + + +class CorrelationFilter(msrest.serialization.Model): + """Represents the correlation filter expression. + + :param properties: dictionary object for custom filters. + :type properties: dict[str, str] + :param correlation_id: Identifier of the correlation. + :type correlation_id: str + :param message_id: Identifier of the message. + :type message_id: str + :param to: Address to send to. + :type to: str + :param reply_to: Address of the queue to reply to. + :type reply_to: str + :param label: Application specific label. + :type label: str + :param session_id: Session identifier. + :type session_id: str + :param reply_to_session_id: Session identifier to reply to. + :type reply_to_session_id: str + :param content_type: Content type of the message. + :type content_type: str + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': '{str}'}, + 'correlation_id': {'key': 'correlationId', 'type': 'str'}, + 'message_id': {'key': 'messageId', 'type': 'str'}, + 'to': {'key': 'to', 'type': 'str'}, + 'reply_to': {'key': 'replyTo', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'session_id': {'key': 'sessionId', 'type': 'str'}, + 'reply_to_session_id': {'key': 'replyToSessionId', 'type': 'str'}, + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + *, + properties: Optional[Dict[str, str]] = None, + correlation_id: Optional[str] = None, + message_id: Optional[str] = None, + to: Optional[str] = None, + reply_to: Optional[str] = None, + label: Optional[str] = None, + session_id: Optional[str] = None, + reply_to_session_id: Optional[str] = None, + content_type: Optional[str] = None, + requires_preprocessing: Optional[bool] = True, + **kwargs + ): + super(CorrelationFilter, self).__init__(**kwargs) + self.properties = properties + self.correlation_id = correlation_id + self.message_id = message_id + self.to = to + self.reply_to = reply_to + self.label = label + self.session_id = session_id + self.reply_to_session_id = reply_to_session_id + self.content_type = content_type + self.requires_preprocessing = requires_preprocessing + + +class DictionaryValue(msrest.serialization.Model): + """Recognized Dictionary value. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Principal Id of user assigned identity. + :vartype principal_id: str + :ivar client_id: Client Id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DictionaryValue, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class Encryption(msrest.serialization.Model): + """Properties to configure Encryption. + + :param key_vault_properties: Properties of KeyVault. + :type key_vault_properties: + list[~azure.mgmt.servicebus.v2021_01_01_preview.models.KeyVaultProperties] + :param key_source: Enumerates the possible value of keySource for Encryption. The only + acceptable values to pass in are None and "Microsoft.KeyVault". The default value is + "Microsoft.KeyVault". + :type key_source: str + :param require_infrastructure_encryption: Enable Infrastructure Encryption (Double Encryption). + :type require_infrastructure_encryption: bool + """ + + _attribute_map = { + 'key_vault_properties': {'key': 'keyVaultProperties', 'type': '[KeyVaultProperties]'}, + 'key_source': {'key': 'keySource', 'type': 'str'}, + 'require_infrastructure_encryption': {'key': 'requireInfrastructureEncryption', 'type': 'bool'}, + } + + def __init__( + self, + *, + key_vault_properties: Optional[List["KeyVaultProperties"]] = None, + key_source: Optional[str] = "Microsoft.KeyVault", + require_infrastructure_encryption: Optional[bool] = None, + **kwargs + ): + super(Encryption, self).__init__(**kwargs) + self.key_vault_properties = key_vault_properties + self.key_source = key_source + self.require_infrastructure_encryption = require_infrastructure_encryption + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """The resource management error response. + + :param error: The error object. + :type error: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ErrorResponseError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + } + + def __init__( + self, + *, + error: Optional["ErrorResponseError"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseError(msrest.serialization.Model): + """The error object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.servicebus.v2021_01_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseError, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class FailoverProperties(msrest.serialization.Model): + """Safe failover is to indicate the service should wait for pending replication to finish before switching to the secondary. + + :param is_safe_failover: Safe failover is to indicate the service should wait for pending + replication to finish before switching to the secondary. + :type is_safe_failover: bool + """ + + _attribute_map = { + 'is_safe_failover': {'key': 'properties.IsSafeFailover', 'type': 'bool'}, + } + + def __init__( + self, + *, + is_safe_failover: Optional[bool] = None, + **kwargs + ): + super(FailoverProperties, self).__init__(**kwargs) + self.is_safe_failover = is_safe_failover + + +class Identity(msrest.serialization.Model): + """Properties to configure User Assigned Identities for Bring your Own Keys. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: ObjectId from the KeyVault. + :vartype principal_id: str + :ivar tenant_id: TenantId from the KeyVault. + :vartype tenant_id: str + :param type: Type of managed service identity. Possible values include: "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.ManagedServiceIdentityType + :param user_assigned_identities: Properties for User Assigned Identities. + :type user_assigned_identities: dict[str, + ~azure.mgmt.servicebus.v2021_01_01_preview.models.DictionaryValue] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{DictionaryValue}'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ManagedServiceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "DictionaryValue"]] = None, + **kwargs + ): + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class KeyVaultProperties(msrest.serialization.Model): + """Properties to configure keyVault Properties. + + :param key_name: Name of the Key from KeyVault. + :type key_name: str + :param key_vault_uri: Uri of KeyVault. + :type key_vault_uri: str + :param key_version: Version of KeyVault. + :type key_version: str + :param identity: + :type identity: + ~azure.mgmt.servicebus.v2021_01_01_preview.models.UserAssignedIdentityProperties + """ + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, + 'key_version': {'key': 'keyVersion', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'UserAssignedIdentityProperties'}, + } + + def __init__( + self, + *, + key_name: Optional[str] = None, + key_vault_uri: Optional[str] = None, + key_version: Optional[str] = None, + identity: Optional["UserAssignedIdentityProperties"] = None, + **kwargs + ): + super(KeyVaultProperties, self).__init__(**kwargs) + self.key_name = key_name + self.key_vault_uri = key_vault_uri + self.key_version = key_version + self.identity = identity + + +class MessageCountDetails(msrest.serialization.Model): + """Message Count Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar active_message_count: Number of active messages in the queue, topic, or subscription. + :vartype active_message_count: long + :ivar dead_letter_message_count: Number of messages that are dead lettered. + :vartype dead_letter_message_count: long + :ivar scheduled_message_count: Number of scheduled messages. + :vartype scheduled_message_count: long + :ivar transfer_message_count: Number of messages transferred to another queue, topic, or + subscription. + :vartype transfer_message_count: long + :ivar transfer_dead_letter_message_count: Number of messages transferred into dead letters. + :vartype transfer_dead_letter_message_count: long + """ + + _validation = { + 'active_message_count': {'readonly': True}, + 'dead_letter_message_count': {'readonly': True}, + 'scheduled_message_count': {'readonly': True}, + 'transfer_message_count': {'readonly': True}, + 'transfer_dead_letter_message_count': {'readonly': True}, + } + + _attribute_map = { + 'active_message_count': {'key': 'activeMessageCount', 'type': 'long'}, + 'dead_letter_message_count': {'key': 'deadLetterMessageCount', 'type': 'long'}, + 'scheduled_message_count': {'key': 'scheduledMessageCount', 'type': 'long'}, + 'transfer_message_count': {'key': 'transferMessageCount', 'type': 'long'}, + 'transfer_dead_letter_message_count': {'key': 'transferDeadLetterMessageCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(MessageCountDetails, self).__init__(**kwargs) + self.active_message_count = None + self.dead_letter_message_count = None + self.scheduled_message_count = None + self.transfer_message_count = None + self.transfer_dead_letter_message_count = None + + +class MigrationConfigListResult(msrest.serialization.Model): + """The result of the List migrationConfigurations operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Migration Configs. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of migrationConfigurations. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MigrationConfigProperties]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["MigrationConfigProperties"]] = None, + **kwargs + ): + super(MigrationConfigListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class MigrationConfigProperties(Resource): + """Single item in List or Get Migration Config 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 + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar provisioning_state: Provisioning state of Migration Configuration. + :vartype provisioning_state: str + :ivar pending_replication_operations_count: Number of entities pending to be replicated. + :vartype pending_replication_operations_count: long + :param target_namespace: Existing premium Namespace ARM Id name which has no entities, will be + used for migration. + :type target_namespace: str + :param post_migration_name: Name to access Standard Namespace after migration. + :type post_migration_name: str + :ivar migration_state: State in which Standard to Premium Migration is, possible values : + Unknown, Reverting, Completing, Initiating, Syncing, Active. + :vartype migration_state: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'pending_replication_operations_count': {'readonly': True}, + 'migration_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, + 'target_namespace': {'key': 'properties.targetNamespace', 'type': 'str'}, + 'post_migration_name': {'key': 'properties.postMigrationName', 'type': 'str'}, + 'migration_state': {'key': 'properties.migrationState', 'type': 'str'}, + } + + def __init__( + self, + *, + target_namespace: Optional[str] = None, + post_migration_name: Optional[str] = None, + **kwargs + ): + super(MigrationConfigProperties, self).__init__(**kwargs) + self.system_data = None + self.provisioning_state = None + self.pending_replication_operations_count = None + self.target_namespace = target_namespace + self.post_migration_name = post_migration_name + self.migration_state = None + + +class NetworkRuleSet(Resource): + """Description of NetworkRuleSet 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 + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :param default_action: Default Action for Network Rule Set. Possible values include: "Allow", + "Deny". + :type default_action: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.DefaultAction + :param virtual_network_rules: List VirtualNetwork Rules. + :type virtual_network_rules: + list[~azure.mgmt.servicebus.v2021_01_01_preview.models.NWRuleSetVirtualNetworkRules] + :param ip_rules: List of IpRules. + :type ip_rules: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.NWRuleSetIpRules] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'default_action': {'key': 'properties.defaultAction', 'type': 'str'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[NWRuleSetVirtualNetworkRules]'}, + 'ip_rules': {'key': 'properties.ipRules', 'type': '[NWRuleSetIpRules]'}, + } + + def __init__( + self, + *, + default_action: Optional[Union[str, "DefaultAction"]] = None, + virtual_network_rules: Optional[List["NWRuleSetVirtualNetworkRules"]] = None, + ip_rules: Optional[List["NWRuleSetIpRules"]] = None, + **kwargs + ): + super(NetworkRuleSet, self).__init__(**kwargs) + self.system_data = None + self.default_action = default_action + self.virtual_network_rules = virtual_network_rules + self.ip_rules = ip_rules + + +class NetworkRuleSetListResult(msrest.serialization.Model): + """The response of the List NetworkRuleSet operation. + + :param value: Result of the List NetworkRuleSet operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of NetworkRuleSet. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkRuleSet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NetworkRuleSet"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(NetworkRuleSetListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NWRuleSetIpRules(msrest.serialization.Model): + """Description of NetWorkRuleSet - IpRules resource. + + :param ip_mask: IP Mask. + :type ip_mask: str + :param action: The IP Filter Action. Possible values include: "Allow". Default value: "Allow". + :type action: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleIPAction + """ + + _attribute_map = { + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + } + + def __init__( + self, + *, + ip_mask: Optional[str] = None, + action: Optional[Union[str, "NetworkRuleIPAction"]] = "Allow", + **kwargs + ): + super(NWRuleSetIpRules, self).__init__(**kwargs) + self.ip_mask = ip_mask + self.action = action + + +class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): + """Description of VirtualNetworkRules - NetworkRules resource. + + :param subnet: Subnet properties. + :type subnet: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Subnet + :param ignore_missing_vnet_service_endpoint: Value that indicates whether to ignore missing + VNet Service Endpoint. + :type ignore_missing_vnet_service_endpoint: bool + """ + + _attribute_map = { + 'subnet': {'key': 'subnet', 'type': 'Subnet'}, + 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, + } + + def __init__( + self, + *, + subnet: Optional["Subnet"] = None, + ignore_missing_vnet_service_endpoint: Optional[bool] = None, + **kwargs + ): + super(NWRuleSetVirtualNetworkRules, self).__init__(**kwargs) + self.subnet = subnet + self.ignore_missing_vnet_service_endpoint = ignore_missing_vnet_service_endpoint + + +class Operation(msrest.serialization.Model): + """A ServiceBus REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.servicebus.v2021_01_01_preview.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = display + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft.ServiceBus. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Invoice, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list ServiceBus operations. It contains a list of operations and a URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of ServiceBus operations supported by the Microsoft.ServiceBus resource + provider. + :vartype value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PrivateEndpoint(msrest.serialization.Model): + """PrivateEndpoint information. + + :param id: The ARM identifier for Private Endpoint. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = id + + +class PrivateEndpointConnection(Resource): + """Properties of the PrivateEndpointConnection. + + 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 + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :param private_endpoint: The Private Endpoint resource for this Connection. + :type private_endpoint: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpoint + :param private_link_service_connection_state: Details about the state of the connection. + :type private_link_service_connection_state: + ~azure.mgmt.servicebus.v2021_01_01_preview.models.ConnectionState + :param provisioning_state: Provisioning state of the Private Endpoint Connection. Possible + values include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + :type provisioning_state: str or + ~azure.mgmt.servicebus.v2021_01_01_preview.models.EndPointProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'ConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["ConnectionState"] = None, + provisioning_state: Optional[Union[str, "EndPointProvisioningState"]] = None, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.system_data = None + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = provisioning_state + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """Result of the list of all private endpoint connections operation. + + :param value: A collection of private endpoint connection resources. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection] + :param next_link: A link for the next page of private endpoint connection resources. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateEndpointConnection"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PrivateLinkResource(msrest.serialization.Model): + """Information of the private link resource. + + :param id: Fully qualified identifier of the resource. + :type id: str + :param name: Name of the resource. + :type name: str + :param type: Type of the resource. + :type type: str + :param group_id: + :type group_id: str + :param required_members: Required Members. + :type required_members: list[str] + :param required_zone_names: Required Zone Names. + :type required_zone_names: list[str] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + type: Optional[str] = None, + group_id: Optional[str] = None, + required_members: Optional[List[str]] = None, + required_zone_names: Optional[List[str]] = None, + **kwargs + ): + super(PrivateLinkResource, self).__init__(**kwargs) + self.id = id + self.name = name + self.type = type + self.group_id = group_id + self.required_members = required_members + self.required_zone_names = required_zone_names + + +class PrivateLinkResourcesListResult(msrest.serialization.Model): + """Result of the List private link resources operation. + + :param value: A collection of private link resources. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateLinkResource] + :param next_link: A link for the next page of private link resources. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateLinkResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class RegenerateAccessKeyParameters(msrest.serialization.Model): + """Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs to be reset. + + All required parameters must be populated in order to send to Azure. + + :param key_type: Required. The access key to regenerate. Possible values include: "PrimaryKey", + "SecondaryKey". + :type key_type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.KeyType + :param key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key + value set for keyType. + :type key: str + """ + + _validation = { + 'key_type': {'required': True}, + } + + _attribute_map = { + 'key_type': {'key': 'keyType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + } + + def __init__( + self, + *, + key_type: Union[str, "KeyType"], + key: Optional[str] = None, + **kwargs + ): + super(RegenerateAccessKeyParameters, self).__init__(**kwargs) + self.key_type = key_type + self.key = key + + +class ResourceNamespacePatch(Resource): + """The Resource definition. + + 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: A set of tags. Resource tags. + :type tags: dict[str, 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}'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ResourceNamespacePatch, self).__init__(**kwargs) + self.location = location + self.tags = tags + + +class Rule(Resource): + """Description of Rule 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 + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :param action: Represents the filter actions which are allowed for the transformation of a + message that have been matched by a filter expression. + :type action: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Action + :param filter_type: Filter type that is evaluated against a BrokeredMessage. Possible values + include: "SqlFilter", "CorrelationFilter". + :type filter_type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.FilterType + :param sql_filter: Properties of sqlFilter. + :type sql_filter: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SqlFilter + :param correlation_filter: Properties of correlationFilter. + :type correlation_filter: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CorrelationFilter + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'action': {'key': 'properties.action', 'type': 'Action'}, + 'filter_type': {'key': 'properties.filterType', 'type': 'str'}, + 'sql_filter': {'key': 'properties.sqlFilter', 'type': 'SqlFilter'}, + 'correlation_filter': {'key': 'properties.correlationFilter', 'type': 'CorrelationFilter'}, + } + + def __init__( + self, + *, + action: Optional["Action"] = None, + filter_type: Optional[Union[str, "FilterType"]] = None, + sql_filter: Optional["SqlFilter"] = None, + correlation_filter: Optional["CorrelationFilter"] = None, + **kwargs + ): + super(Rule, self).__init__(**kwargs) + self.system_data = None + self.action = action + self.filter_type = filter_type + self.sql_filter = sql_filter + self.correlation_filter = correlation_filter + + +class RuleListResult(msrest.serialization.Model): + """The response of the List rule operation. + + :param value: Result of the List Rules operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of rules. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Rule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Rule"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(RuleListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SBAuthorizationRule(Resource): + """Description of a namespace authorization rule. + + 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 + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :param rights: The rights associated with the rule. + :type rights: list[str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessRights] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'rights': {'key': 'properties.rights', 'type': '[str]'}, + } + + def __init__( + self, + *, + rights: Optional[List[Union[str, "AccessRights"]]] = None, + **kwargs + ): + super(SBAuthorizationRule, self).__init__(**kwargs) + self.system_data = None + self.rights = rights + + +class SBAuthorizationRuleListResult(msrest.serialization.Model): + """The response to the List Namespace operation. + + :param value: Result of the List Authorization Rules operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Authorization Rules. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBAuthorizationRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SBAuthorizationRule"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SBAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class TrackedResource(Resource): + """The Resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. The Geo-location where the resource lives. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': 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}'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.location = location + self.tags = tags + + +class SBNamespace(TrackedResource): + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. The Geo-location where the resource lives. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Properties of SKU. + :type sku: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSku + :param identity: Properties of BYOK Identity description. + :type identity: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Identity + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :ivar status: Status of the namespace. + :vartype status: str + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :ivar metric_id: Identifier for Azure Insights metrics. + :vartype metric_id: str + :param zone_redundant: Enabling this property creates a Premium Service Bus Namespace in + regions supported availability zones. + :type zone_redundant: bool + :param encryption: Properties of BYOK Encryption description. + :type encryption: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Encryption + :param private_endpoint_connections: List of private endpoint connections. + :type private_endpoint_connections: + list[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + 'metric_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SBSku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, + 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + sku: Optional["SBSku"] = None, + identity: Optional["Identity"] = None, + zone_redundant: Optional[bool] = None, + encryption: Optional["Encryption"] = None, + private_endpoint_connections: Optional[List["PrivateEndpointConnection"]] = None, + **kwargs + ): + super(SBNamespace, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.identity = identity + self.system_data = None + self.provisioning_state = None + self.status = None + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.metric_id = None + self.zone_redundant = zone_redundant + self.encryption = encryption + self.private_endpoint_connections = private_endpoint_connections + + +class SBNamespaceListResult(msrest.serialization.Model): + """The response of the List Namespace operation. + + :param value: Result of the List Namespace operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Namespaces. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBNamespace]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SBNamespace"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SBNamespaceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SBNamespaceUpdateParameters(ResourceNamespacePatch): + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Properties of SKU. + :type sku: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSku + :param identity: Properties of BYOK Identity description. + :type identity: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Identity + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :ivar status: Status of the namespace. + :vartype status: str + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :ivar metric_id: Identifier for Azure Insights metrics. + :vartype metric_id: str + :param zone_redundant: Enabling this property creates a Premium Service Bus Namespace in + regions supported availability zones. + :type zone_redundant: bool + :param encryption: Properties of BYOK Encryption description. + :type encryption: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Encryption + :param private_endpoint_connections: List of private endpoint connections. + :type private_endpoint_connections: + list[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + 'metric_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SBSku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, + 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["SBSku"] = None, + identity: Optional["Identity"] = None, + zone_redundant: Optional[bool] = None, + encryption: Optional["Encryption"] = None, + private_endpoint_connections: Optional[List["PrivateEndpointConnection"]] = None, + **kwargs + ): + super(SBNamespaceUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.identity = identity + self.provisioning_state = None + self.status = None + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.metric_id = None + self.zone_redundant = zone_redundant + self.encryption = encryption + self.private_endpoint_connections = private_endpoint_connections + + +class SBQueue(Resource): + """Description of queue 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 + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MessageCountDetails + :ivar created_at: The exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar accessed_at: Last time a message was sent, or the last time there was a receive request + to this queue. + :vartype accessed_at: ~datetime.datetime + :ivar size_in_bytes: The size of the queue, in bytes. + :vartype size_in_bytes: long + :ivar message_count: The number of messages in the queue. + :vartype message_count: long + :param lock_duration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time + that the message is locked for other receivers. The maximum value for LockDuration is 5 + minutes; the default value is 1 minute. + :type lock_duration: ~datetime.timedelta + :param max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size of + memory allocated for the queue. Default is 1024. + :type max_size_in_megabytes: int + :param requires_duplicate_detection: A value indicating if this queue requires duplicate + detection. + :type requires_duplicate_detection: bool + :param requires_session: A value that indicates whether the queue supports the concept of + sessions. + :type requires_session: bool + :param default_message_time_to_live: ISO 8601 default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param dead_lettering_on_message_expiration: A value that indicates whether this queue has dead + letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param duplicate_detection_history_time_window: ISO 8601 timeSpan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param max_delivery_count: The maximum delivery count. A message is automatically deadlettered + after this number of deliveries. default value is 10. + :type max_delivery_count: int + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.EntityStatus + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param auto_delete_on_idle: ISO 8061 timeSpan idle interval after which the queue is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param enable_partitioning: A value that indicates whether the queue is to be partitioned + across multiple message brokers. + :type enable_partitioning: bool + :param enable_express: A value that indicates whether Express Entities are enabled. An express + queue holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param forward_to: Queue/Topic name to forward the messages. + :type forward_to: str + :param forward_dead_lettered_messages_to: Queue/Topic name to forward the Dead Letter message. + :type forward_dead_lettered_messages_to: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'count_details': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'message_count': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, + 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, + } + + def __init__( + self, + *, + lock_duration: Optional[datetime.timedelta] = None, + max_size_in_megabytes: Optional[int] = None, + requires_duplicate_detection: Optional[bool] = None, + requires_session: Optional[bool] = None, + default_message_time_to_live: Optional[datetime.timedelta] = None, + dead_lettering_on_message_expiration: Optional[bool] = None, + duplicate_detection_history_time_window: Optional[datetime.timedelta] = None, + max_delivery_count: Optional[int] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + enable_batched_operations: Optional[bool] = None, + auto_delete_on_idle: Optional[datetime.timedelta] = None, + enable_partitioning: Optional[bool] = None, + enable_express: Optional[bool] = None, + forward_to: Optional[str] = None, + forward_dead_lettered_messages_to: Optional[str] = None, + **kwargs + ): + super(SBQueue, self).__init__(**kwargs) + self.system_data = None + self.count_details = None + self.created_at = None + self.updated_at = None + self.accessed_at = None + self.size_in_bytes = None + self.message_count = None + self.lock_duration = lock_duration + self.max_size_in_megabytes = max_size_in_megabytes + self.requires_duplicate_detection = requires_duplicate_detection + self.requires_session = requires_session + self.default_message_time_to_live = default_message_time_to_live + self.dead_lettering_on_message_expiration = dead_lettering_on_message_expiration + self.duplicate_detection_history_time_window = duplicate_detection_history_time_window + self.max_delivery_count = max_delivery_count + self.status = status + self.enable_batched_operations = enable_batched_operations + self.auto_delete_on_idle = auto_delete_on_idle + self.enable_partitioning = enable_partitioning + self.enable_express = enable_express + self.forward_to = forward_to + self.forward_dead_lettered_messages_to = forward_dead_lettered_messages_to + + +class SBQueueListResult(msrest.serialization.Model): + """The response to the List Queues operation. + + :param value: Result of the List Queues operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of queues. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBQueue]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SBQueue"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SBQueueListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SBSku(msrest.serialization.Model): + """SKU of the namespace. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of this SKU. Possible values include: "Basic", "Standard", + "Premium". + :type name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.SkuName + :param tier: The billing tier of this particular SKU. Possible values include: "Basic", + "Standard", "Premium". + :type tier: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.SkuTier + :param capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 + and 4. + :type capacity: int + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + *, + name: Union[str, "SkuName"], + tier: Optional[Union[str, "SkuTier"]] = None, + capacity: Optional[int] = None, + **kwargs + ): + super(SBSku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.capacity = capacity + + +class SBSubscription(Resource): + """Description of subscription 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 + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar message_count: Number of messages. + :vartype message_count: long + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar accessed_at: Last time there was a receive request to this subscription. + :vartype accessed_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar count_details: Message count details. + :vartype count_details: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MessageCountDetails + :param lock_duration: ISO 8061 lock duration timespan for the subscription. The default value + is 1 minute. + :type lock_duration: ~datetime.timedelta + :param requires_session: Value indicating if a subscription supports the concept of sessions. + :type requires_session: bool + :param default_message_time_to_live: ISO 8061 Default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param dead_lettering_on_filter_evaluation_exceptions: Value that indicates whether a + subscription has dead letter support on filter evaluation exceptions. + :type dead_lettering_on_filter_evaluation_exceptions: bool + :param dead_lettering_on_message_expiration: Value that indicates whether a subscription has + dead letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param duplicate_detection_history_time_window: ISO 8601 timeSpan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param max_delivery_count: Number of maximum deliveries. + :type max_delivery_count: int + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.EntityStatus + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param auto_delete_on_idle: ISO 8061 timeSpan idle interval after which the topic is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param forward_to: Queue/Topic name to forward the messages. + :type forward_to: str + :param forward_dead_lettered_messages_to: Queue/Topic name to forward the Dead Letter message. + :type forward_dead_lettered_messages_to: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'message_count': {'readonly': True}, + 'created_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'count_details': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, + 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, + } + + def __init__( + self, + *, + lock_duration: Optional[datetime.timedelta] = None, + requires_session: Optional[bool] = None, + default_message_time_to_live: Optional[datetime.timedelta] = None, + dead_lettering_on_filter_evaluation_exceptions: Optional[bool] = None, + dead_lettering_on_message_expiration: Optional[bool] = None, + duplicate_detection_history_time_window: Optional[datetime.timedelta] = None, + max_delivery_count: Optional[int] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + enable_batched_operations: Optional[bool] = None, + auto_delete_on_idle: Optional[datetime.timedelta] = None, + forward_to: Optional[str] = None, + forward_dead_lettered_messages_to: Optional[str] = None, + **kwargs + ): + super(SBSubscription, self).__init__(**kwargs) + self.system_data = None + self.message_count = None + self.created_at = None + self.accessed_at = None + self.updated_at = None + self.count_details = None + self.lock_duration = lock_duration + self.requires_session = requires_session + self.default_message_time_to_live = default_message_time_to_live + self.dead_lettering_on_filter_evaluation_exceptions = dead_lettering_on_filter_evaluation_exceptions + self.dead_lettering_on_message_expiration = dead_lettering_on_message_expiration + self.duplicate_detection_history_time_window = duplicate_detection_history_time_window + self.max_delivery_count = max_delivery_count + self.status = status + self.enable_batched_operations = enable_batched_operations + self.auto_delete_on_idle = auto_delete_on_idle + self.forward_to = forward_to + self.forward_dead_lettered_messages_to = forward_dead_lettered_messages_to + + +class SBSubscriptionListResult(msrest.serialization.Model): + """The response to the List Subscriptions operation. + + :param value: Result of the List Subscriptions operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of subscriptions. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBSubscription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SBSubscription"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SBSubscriptionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SBTopic(Resource): + """Description of topic 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 + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar size_in_bytes: Size of the topic, in bytes. + :vartype size_in_bytes: long + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar accessed_at: Last time the message was sent, or a request was received, for this topic. + :vartype accessed_at: ~datetime.datetime + :ivar subscription_count: Number of subscriptions. + :vartype subscription_count: int + :ivar count_details: Message count details. + :vartype count_details: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MessageCountDetails + :param default_message_time_to_live: ISO 8601 Default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param max_size_in_megabytes: Maximum size of the topic in megabytes, which is the size of the + memory allocated for the topic. Default is 1024. + :type max_size_in_megabytes: int + :param requires_duplicate_detection: Value indicating if this topic requires duplicate + detection. + :type requires_duplicate_detection: bool + :param duplicate_detection_history_time_window: ISO8601 timespan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.EntityStatus + :param support_ordering: Value that indicates whether the topic supports ordering. + :type support_ordering: bool + :param auto_delete_on_idle: ISO 8601 timespan idle interval after which the topic is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param enable_partitioning: Value that indicates whether the topic to be partitioned across + multiple message brokers is enabled. + :type enable_partitioning: bool + :param enable_express: Value that indicates whether Express Entities are enabled. An express + topic holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'subscription_count': {'readonly': True}, + 'count_details': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + } + + def __init__( + self, + *, + default_message_time_to_live: Optional[datetime.timedelta] = None, + max_size_in_megabytes: Optional[int] = None, + requires_duplicate_detection: Optional[bool] = None, + duplicate_detection_history_time_window: Optional[datetime.timedelta] = None, + enable_batched_operations: Optional[bool] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + support_ordering: Optional[bool] = None, + auto_delete_on_idle: Optional[datetime.timedelta] = None, + enable_partitioning: Optional[bool] = None, + enable_express: Optional[bool] = None, + **kwargs + ): + super(SBTopic, self).__init__(**kwargs) + self.system_data = None + self.size_in_bytes = None + self.created_at = None + self.updated_at = None + self.accessed_at = None + self.subscription_count = None + self.count_details = None + self.default_message_time_to_live = default_message_time_to_live + self.max_size_in_megabytes = max_size_in_megabytes + self.requires_duplicate_detection = requires_duplicate_detection + self.duplicate_detection_history_time_window = duplicate_detection_history_time_window + self.enable_batched_operations = enable_batched_operations + self.status = status + self.support_ordering = support_ordering + self.auto_delete_on_idle = auto_delete_on_idle + self.enable_partitioning = enable_partitioning + self.enable_express = enable_express + + +class SBTopicListResult(msrest.serialization.Model): + """The response to the List Topics operation. + + :param value: Result of the List Topics operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of topics. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBTopic]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SBTopic"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SBTopicListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SqlFilter(msrest.serialization.Model): + """Represents a filter which is a composition of an expression and an action that is executed in the pub/sub pipeline. + + :param sql_expression: The SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _validation = { + 'compatibility_level': {'maximum': 20, 'minimum': 20}, + } + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + *, + sql_expression: Optional[str] = None, + compatibility_level: Optional[int] = 20, + requires_preprocessing: Optional[bool] = True, + **kwargs + ): + super(SqlFilter, self).__init__(**kwargs) + self.sql_expression = sql_expression + self.compatibility_level = compatibility_level + self.requires_preprocessing = requires_preprocessing + + +class SqlRuleAction(Action): + """Represents set of actions written in SQL language-based syntax that is performed against a ServiceBus.Messaging.BrokeredMessage. + + :param sql_expression: SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + *, + sql_expression: Optional[str] = None, + compatibility_level: Optional[int] = None, + requires_preprocessing: Optional[bool] = True, + **kwargs + ): + super(SqlRuleAction, self).__init__(sql_expression=sql_expression, compatibility_level=compatibility_level, requires_preprocessing=requires_preprocessing, **kwargs) + + +class Subnet(msrest.serialization.Model): + """Properties supplied for Subnet. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Resource ID of Virtual Network Subnet. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: str, + **kwargs + ): + super(Subnet, self).__init__(**kwargs) + self.id = id + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or + ~azure.mgmt.servicebus.v2021_01_01_preview.models.CreatedByType + :param last_modified_at: The type of identity that last modified the resource. + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class UserAssignedIdentityProperties(msrest.serialization.Model): + """UserAssignedIdentityProperties. + + :param user_assigned_identity: ARM ID of user Identity selected for encryption. + :type user_assigned_identity: str + """ + + _attribute_map = { + 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, + } + + def __init__( + self, + *, + user_assigned_identity: Optional[str] = None, + **kwargs + ): + super(UserAssignedIdentityProperties, self).__init__(**kwargs) + self.user_assigned_identity = user_assigned_identity diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_service_bus_management_client_enums.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_service_bus_management_client_enums.py new file mode 100644 index 0000000000000..a6add4bc73f73 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_service_bus_management_client_enums.py @@ -0,0 +1,161 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AccessRights(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + MANAGE = "Manage" + SEND = "Send" + LISTEN = "Listen" + +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Default Action for Network Rule Set + """ + + ALLOW = "Allow" + DENY = "Deny" + +class EndPointProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Private Endpoint Connection. + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" + +class EntityStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Entity status. + """ + + ACTIVE = "Active" + DISABLED = "Disabled" + RESTORING = "Restoring" + SEND_DISABLED = "SendDisabled" + RECEIVE_DISABLED = "ReceiveDisabled" + CREATING = "Creating" + DELETING = "Deleting" + RENAMING = "Renaming" + UNKNOWN = "Unknown" + +class FilterType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Rule filter types + """ + + SQL_FILTER = "SqlFilter" + CORRELATION_FILTER = "CorrelationFilter" + +class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The access key to regenerate. + """ + + PRIMARY_KEY = "PrimaryKey" + SECONDARY_KEY = "SecondaryKey" + +class ManagedServiceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of managed service identity. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + NONE = "None" + +class MigrationConfigurationName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + _DEFAULT = "$default" + +class NetworkRuleIPAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The IP Filter Action + """ + + ALLOW = "Allow" + +class PrivateLinkConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of the connection. + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + +class ProvisioningStateDR(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' + or 'Succeeded' or 'Failed' + """ + + ACCEPTED = "Accepted" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + +class RoleDisasterRecovery(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' or + 'Secondary' + """ + + PRIMARY = "Primary" + PRIMARY_NOT_REPLICATING = "PrimaryNotReplicating" + SECONDARY = "Secondary" + +class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Name of this SKU. + """ + + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + +class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The billing tier of this particular SKU. + """ + + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + +class UnavailableReason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the reason for the unavailability of the service. + """ + + NONE = "None" + INVALID_NAME = "InvalidName" + SUBSCRIPTION_IS_DISABLED = "SubscriptionIsDisabled" + NAME_IN_USE = "NameInUse" + NAME_IN_LOCKDOWN = "NameInLockdown" + TOO_MANY_NAMESPACE_IN_CURRENT_SUBSCRIPTION = "TooManyNamespaceInCurrentSubscription" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/__init__.py new file mode 100644 index 0000000000000..e278debc144f6 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/__init__.py @@ -0,0 +1,31 @@ +# 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 ._namespaces_operations import NamespacesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._operations import Operations +from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations +from ._migration_configs_operations import MigrationConfigsOperations +from ._queues_operations import QueuesOperations +from ._topics_operations import TopicsOperations +from ._rules_operations import RulesOperations +from ._subscriptions_operations import SubscriptionsOperations + +__all__ = [ + 'NamespacesOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'Operations', + 'DisasterRecoveryConfigsOperations', + 'MigrationConfigsOperations', + 'QueuesOperations', + 'TopicsOperations', + 'RulesOperations', + 'SubscriptionsOperations', +] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_disaster_recovery_configs_operations.py new file mode 100644 index 0000000000000..1742d9b97f0fd --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_disaster_recovery_configs_operations.py @@ -0,0 +1,739 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DisasterRecoveryConfigsOperations(object): + """DisasterRecoveryConfigsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def check_name_availability( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.CheckNameAvailability" + **kwargs # type: Any + ): + # type: (...) -> "_models.CheckNameAvailabilityResult" + """Check the give namespace name availability. + + :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 parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability'} # type: ignore + + def list( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ArmDisasterRecoveryListResult"] + """Gets all Alias(Disaster Recovery configurations). + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecoveryListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecoveryListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ArmDisasterRecoveryListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + parameters, # type: "_models.ArmDisasterRecovery" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.ArmDisasterRecovery"] + """Creates or updates a new Alias(Disaster Recovery configuration). + + :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 alias: The Disaster Recovery configuration name. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ArmDisasterRecovery"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ArmDisasterRecovery') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes an Alias(Disaster Recovery configuration). + + :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 alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ArmDisasterRecovery" + """Retrieves Alias(Disaster Recovery configuration) for primary or secondary 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 alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecovery"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + def break_pairing( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """This operation disables the Disaster Recovery and stops replicating changes from primary to + secondary namespaces. + + :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 alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.break_pairing.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + break_pairing.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing'} # type: ignore + + def fail_over( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + parameters=None, # type: Optional["_models.FailoverProperties"] + **kwargs # type: Any + ): + # type: (...) -> None + """Invokes GEO DR failover and reconfigure the alias to point to the secondary 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 alias: The Disaster Recovery configuration name. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.FailoverProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.fail_over.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'FailoverProperties') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + fail_over.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBAuthorizationRuleListResult"] + """Gets the authorization 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 alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules'} # type: ignore + + def get_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Gets an authorization rule 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 alias: The Disaster Recovery configuration name. + :type alias: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Gets the primary and secondary connection strings for the 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 alias: The Disaster Recovery configuration name. + :type alias: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_migration_configs_operations.py new file mode 100644 index 0000000000000..28b7801c1315a --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_migration_configs_operations.py @@ -0,0 +1,510 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class MigrationConfigsOperations(object): + """MigrationConfigsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.MigrationConfigListResult"] + """Gets all migrationConfigurations. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MigrationConfigListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('MigrationConfigListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations'} # type: ignore + + def _create_and_start_migration_initial( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + parameters, # type: "_models.MigrationConfigProperties" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.MigrationConfigProperties"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MigrationConfigProperties"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_and_start_migration_initial.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'MigrationConfigProperties') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_and_start_migration_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + def begin_create_and_start_migration( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + parameters, # type: "_models.MigrationConfigProperties" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.MigrationConfigProperties"] + """Creates Migration configuration and starts migration of entities from Standard to Premium + 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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationConfigProperties or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigProperties"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_and_start_migration_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + config_name=config_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_and_start_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a MigrationConfiguration. + + :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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + **kwargs # type: Any + ): + # type: (...) -> "_models.MigrationConfigProperties" + """Retrieves Migration Config. + + :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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigrationConfigProperties, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + def complete_migration( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + **kwargs # type: Any + ): + # type: (...) -> None + """This operation Completes Migration of entities by pointing the connection strings to Premium + namespace and any entities created after the operation will be under Premium Namespace. + CompleteMigration operation will fail when entity migration is in-progress. + + :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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.complete_migration.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + complete_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade'} # type: ignore + + def revert( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + **kwargs # type: Any + ): + # type: (...) -> None + """This operation reverts Migration. + + :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 config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.revert.metadata['url'] # type: ignore + 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), + 'configName': self._serialize.url("config_name", config_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + revert.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_namespaces_operations.py new file mode 100644 index 0000000000000..f2a96e6c5ffd0 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_namespaces_operations.py @@ -0,0 +1,1240 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class NamespacesOperations(object): + """NamespacesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBNamespaceListResult"] + """Gets all the available namespaces within the subscription, irrespective of the resource groups. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBNamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBNamespaceListResult"] + """Gets the available namespaces within a resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBNamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.SBNamespace" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.SBNamespace"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SBNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + 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'), + '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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespace') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.SBNamespace" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.SBNamespace"] + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + :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 parameters: Parameters supplied to create a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either SBNamespace or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespace"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes an existing namespace. This operation also removes all associated resources under the + 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBNamespace" + """Gets a description for the specified 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.SBNamespaceUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.SBNamespace"] + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :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 parameters: Parameters supplied to update a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespaceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SBNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespaceUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def create_or_update_network_rule_set( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.NetworkRuleSet" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkRuleSet" + """Create or update NetworkRuleSet 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 parameters: The Namespace IpFilterRule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_network_rule_set.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkRuleSet') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + def get_network_rule_set( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkRuleSet" + """Gets NetworkRuleSet 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_network_rule_set.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + def list_network_rule_sets( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkRuleSetListResult"] + """Gets list of NetworkRuleSet 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkRuleSetListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_network_rule_sets.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkRuleSetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_network_rule_sets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBAuthorizationRuleListResult"] + """Gets the authorization 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules'} # type: ignore + + def create_or_update_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.SBAuthorizationRule" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Creates or updates an authorization rule 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + def delete_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a namespace authorization rule. + + :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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + def get_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Gets an authorization rule 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Gets the primary and secondary connection strings for the 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys'} # type: ignore + + def regenerate_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.RegenerateAccessKeyParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Regenerates the primary or secondary connection strings for the 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + 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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def check_name_availability( + self, + parameters, # type: "_models.CheckNameAvailability" + **kwargs # type: Any + ): + # type: (...) -> "_models.CheckNameAvailabilityResult" + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_operations.py new file mode 100644 index 0000000000000..94f904c4fa17b --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_operations.py @@ -0,0 +1,110 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationListResult"] + """Lists all of the available ServiceBus REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.ServiceBus/operations'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_private_endpoint_connections_operations.py new file mode 100644 index 0000000000000..2e35b3bb49f79 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,383 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations(object): + """PrivateEndpointConnectionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + """Gets the available PrivateEndpointConnections within 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + private_endpoint_connection_name, # type: str + parameters, # type: "_models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnection" + """Creates or updates PrivateEndpointConnections of service 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 private_endpoint_connection_name: The PrivateEndpointConnection name. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + '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), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + namespace_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + 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'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes an existing Private Endpoint Connection. + + :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 private_endpoint_connection_name: The PrivateEndpointConnection name. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnection" + """Gets a description for the specified Private Endpoint Connection. + + :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 private_endpoint_connection_name: The PrivateEndpointConnection name. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_private_link_resources_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_private_link_resources_operations.py new file mode 100644 index 0000000000000..da52a0b09b348 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_private_link_resources_operations.py @@ -0,0 +1,105 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations(object): + """PrivateLinkResourcesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateLinkResourcesListResult" + """Gets lists of resources that supports Privatelinks. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourcesListResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateLinkResourcesListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_queues_operations.py new file mode 100644 index 0000000000000..c1af17fdfa9b5 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_queues_operations.py @@ -0,0 +1,764 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class QueuesOperations(object): + """QueuesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBAuthorizationRuleListResult"] + """Gets all authorization rules for a queue. + + :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 queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules'} # type: ignore + + def create_or_update_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.SBAuthorizationRule" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Creates an authorization rule for a queue. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def delete_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a queue authorization rule. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def get_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Gets an authorization rule for a queue 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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Primary and secondary connection strings to the queue. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + def regenerate_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.RegenerateAccessKeyParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Regenerates the primary or secondary connection strings to the queue. + + :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 queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def list_by_namespace( + self, + resource_group_name, # type: str + namespace_name, # type: str + skip=None, # type: Optional[int] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBQueueListResult"] + """Gets the queues within 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 skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBQueueListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueueListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueueListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBQueueListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + parameters, # type: "_models.SBQueue" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBQueue" + """Creates or updates a Service Bus queue. This operation is idempotent. + + :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 queue_name: The queue name. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBQueue') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a queue from the specified namespace in a resource group. + + :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 queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBQueue" + """Returns a description for the specified queue. + + :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 queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'queueName': self._serialize.url("queue_name", queue_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_rules_operations.py new file mode 100644 index 0000000000000..24184888dfe32 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_rules_operations.py @@ -0,0 +1,363 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class RulesOperations(object): + """RulesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_subscriptions( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + skip=None, # type: Optional[int] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.RuleListResult"] + """List all the rules within given topic-subscription. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.RuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscriptions.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('RuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscriptions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + rule_name, # type: str + parameters, # type: "_models.Rule" + **kwargs # type: Any + ): + # type: (...) -> "_models.Rule" + """Creates a new rule and updates an existing rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Rule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Rule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes an existing rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Rule" + """Retrieves the description for the specified rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Rule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_subscriptions_operations.py new file mode 100644 index 0000000000000..3fe7d2ae0b5b1 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_subscriptions_operations.py @@ -0,0 +1,347 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionsOperations(object): + """SubscriptionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_topic( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + skip=None, # type: Optional[int] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBSubscriptionListResult"] + """List all the subscriptions under a specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBSubscriptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_topic.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBSubscriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_topic.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + parameters, # type: "_models.SBSubscription" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBSubscription" + """Creates a topic subscription. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBSubscription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a subscription from the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBSubscription" + """Returns a subscription description for the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_topics_operations.py new file mode 100644 index 0000000000000..8976202c588a2 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_topics_operations.py @@ -0,0 +1,764 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class TopicsOperations(object): + """TopicsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBAuthorizationRuleListResult"] + """Gets authorization rules for a topic. + + :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 topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules'} # type: ignore + + def create_or_update_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.SBAuthorizationRule" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Creates an authorization rule for the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def get_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Returns the specified authorization rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def delete_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a topic authorization rule. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Gets the primary and secondary connection strings for the topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + def regenerate_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.RegenerateAccessKeyParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Regenerates primary or secondary connection strings for the topic. + + :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 topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def list_by_namespace( + self, + resource_group_name, # type: str + namespace_name, # type: str + skip=None, # type: Optional[int] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBTopicListResult"] + """Gets all the topics in 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 skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBTopicListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopicListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopicListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBTopicListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + parameters, # type: "_models.SBTopic" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBTopic" + """Creates a topic in the specified 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 topic_name: The topic name. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBTopic') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a topic from the specified namespace and resource group. + + :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 topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBTopic" + """Returns a description for the specified topic. + + :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 topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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), + 'topicName': self._serialize.url("topic_name", topic_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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/py.typed b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/py.typed new file mode 100644 index 0000000000000..e5aff4f83af86 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file