From a644e1e703357b7f43a5a68c1234863df2395dce Mon Sep 17 00:00:00 2001 From: Azure CLI Bot Date: Mon, 1 Nov 2021 09:46:51 +0800 Subject: [PATCH] [AutoRelease] t2-eventhub-2021-10-25-83263 (#21397) * CodeGen from PR 16363 in Azure/azure-rest-api-specs EventHub : New API version 2021-11-01 (#16363) * base commit for new api version 2021-11-01 * new api version 2021-11-01 changes * CI fixes * CI fixes * fix for Python SDK * added common def v2 * avocado fix * updated common types * update to address S360 * S360 fix for DisasterRecoveryConfigs * Revert "S360 fix for DisasterRecoveryConfigs" This reverts commit 2476975abd304ee89f1382ceaee280ad3a711e15. * Added SchemaRegistry API * CI fixes - Schemagroup * corrected Schemagroup group properties * reverted the proxyresource location change * Revert "reverted the proxyresource location change" This reverts commit ac79e8a163198742f32adfdc40cc11aa2e039e90. * addresing S360 swagger correctness fro operations and capture * updated description for datalake in capture * subscription format to uuid Co-authored-by: Damodar Avadhani Co-authored-by: v-ajnava * version,CHANGELOG * Update CHANGELOG.md Co-authored-by: SDKAuto Co-authored-by: Damodar Avadhani Co-authored-by: v-ajnava Co-authored-by: PythonSdkPipelines Co-authored-by: Jiefeng Chen <51037443+BigCat20196@users.noreply.github.com> --- sdk/eventhub/azure-mgmt-eventhub/CHANGELOG.md | 29 +- sdk/eventhub/azure-mgmt-eventhub/_meta.json | 2 +- .../eventhub/_event_hub_management_client.py | 49 +- .../azure/mgmt/eventhub/_version.py | 2 +- .../aio/_event_hub_management_client.py | 49 +- .../azure/mgmt/eventhub/models.py | 1 + .../mgmt/eventhub/v2015_08_01/_version.py | 2 +- .../mgmt/eventhub/v2017_04_01/_version.py | 2 +- .../eventhub/v2017_04_01/models/_models.py | 82 +- .../v2017_04_01/models/_models_py3.py | 82 +- .../eventhub/v2018_01_01_preview/_version.py | 2 +- .../v2018_01_01_preview/models/_models.py | 106 +- .../v2018_01_01_preview/models/_models_py3.py | 106 +- .../eventhub/v2021_01_01_preview/_version.py | 2 +- .../v2021_01_01_preview/models/_models.py | 74 +- .../v2021_01_01_preview/models/_models_py3.py | 74 +- .../eventhub/v2021_06_01_preview/_version.py | 2 +- .../v2021_06_01_preview/models/_models.py | 82 +- .../v2021_06_01_preview/models/_models_py3.py | 82 +- .../mgmt/eventhub/v2021_11_01/__init__.py | 19 + .../eventhub/v2021_11_01/_configuration.py | 71 + .../_event_hub_management_client.py | 134 ++ .../mgmt/eventhub/v2021_11_01/_metadata.json | 112 + .../mgmt/eventhub/v2021_11_01/_version.py | 9 + .../mgmt/eventhub/v2021_11_01/aio/__init__.py | 10 + .../v2021_11_01/aio/_configuration.py | 67 + .../aio/_event_hub_management_client.py | 127 + .../v2021_11_01/aio/operations/__init__.py | 31 + .../aio/operations/_clusters_operations.py | 720 ++++++ .../operations/_configuration_operations.py | 174 ++ .../operations/_consumer_groups_operations.py | 340 +++ .../_disaster_recovery_configs_operations.py | 714 ++++++ .../aio/operations/_event_hubs_operations.py | 752 ++++++ .../aio/operations/_namespaces_operations.py | 1202 +++++++++ .../v2021_11_01/aio/operations/_operations.py | 105 + ...private_endpoint_connections_operations.py | 375 +++ .../_private_link_resources_operations.py | 100 + .../operations/_schema_registry_operations.py | 323 +++ .../eventhub/v2021_11_01/models/__init__.py | 213 ++ .../_event_hub_management_client_enums.py | 182 ++ .../eventhub/v2021_11_01/models/_models.py | 1974 +++++++++++++++ .../v2021_11_01/models/_models_py3.py | 2143 +++++++++++++++++ .../v2021_11_01/operations/__init__.py | 31 + .../operations/_clusters_operations.py | 735 ++++++ .../operations/_configuration_operations.py | 180 ++ .../operations/_consumer_groups_operations.py | 348 +++ .../_disaster_recovery_configs_operations.py | 728 ++++++ .../operations/_event_hubs_operations.py | 766 ++++++ .../operations/_namespaces_operations.py | 1224 ++++++++++ .../v2021_11_01/operations/_operations.py | 110 + ...private_endpoint_connections_operations.py | 384 +++ .../_private_link_resources_operations.py | 105 + .../operations/_schema_registry_operations.py | 331 +++ .../azure/mgmt/eventhub/v2021_11_01/py.typed | 1 + 54 files changed, 15398 insertions(+), 272 deletions(-) create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/__init__.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_configuration.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_event_hub_management_client.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_metadata.json create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_version.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/__init__.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/_configuration.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/_event_hub_management_client.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/__init__.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_clusters_operations.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_configuration_operations.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_consumer_groups_operations.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_disaster_recovery_configs_operations.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_event_hubs_operations.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_namespaces_operations.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_operations.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_private_link_resources_operations.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_schema_registry_operations.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/models/__init__.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/models/_event_hub_management_client_enums.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/models/_models.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/models/_models_py3.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/__init__.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_clusters_operations.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_configuration_operations.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_consumer_groups_operations.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_disaster_recovery_configs_operations.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_event_hubs_operations.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_namespaces_operations.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_operations.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_private_link_resources_operations.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_schema_registry_operations.py create mode 100644 sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/py.typed diff --git a/sdk/eventhub/azure-mgmt-eventhub/CHANGELOG.md b/sdk/eventhub/azure-mgmt-eventhub/CHANGELOG.md index dceaea924cd1..3d139806cc83 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/CHANGELOG.md +++ b/sdk/eventhub/azure-mgmt-eventhub/CHANGELOG.md @@ -1,5 +1,32 @@ # Release History +## 10.0.0 (2021-11-01) + +**Features** + + - Model ErrorResponse has a new parameter error + - Model NetworkRuleSet has a new parameter location + - Model Eventhub has a new parameter location + - Model ConsumerGroup has a new parameter location + - Model ArmDisasterRecovery has a new parameter location + - Model Operation has a new parameter is_data_action + - Model Operation has a new parameter origin + - Model Operation has a new parameter properties + - Model PrivateEndpointConnection has a new parameter location + - Model Destination has a new parameter data_lake_account_name + - Model Destination has a new parameter data_lake_subscription_id + - Model Destination has a new parameter data_lake_folder_path + - Model EHNamespace has a new parameter alternate_name + - Model OperationDisplay has a new parameter description + - Model AuthorizationRule has a new parameter location + - Added operation NamespacesOperations.list_network_rule_set + - Added operation group SchemaRegistryOperations + +**Breaking changes** + + - Model ErrorResponse no longer has parameter message + - Model ErrorResponse no longer has parameter code + ## 9.1.0 (2021-09-17) **Features** @@ -291,4 +318,4 @@ This wheel package is built with the azure wheel extension ## 0.1.0 (2016-10-27) - - Initial Release \ No newline at end of file + - Initial Release diff --git a/sdk/eventhub/azure-mgmt-eventhub/_meta.json b/sdk/eventhub/azure-mgmt-eventhub/_meta.json index 76188907d20b..c843bcabf201 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/_meta.json +++ b/sdk/eventhub/azure-mgmt-eventhub/_meta.json @@ -4,7 +4,7 @@ "@autorest/python@5.8.4", "@autorest/modelerfour@4.19.2" ], - "commit": "c9992af7235a6550087d4fed8f081ed35019f605", + "commit": "ea69fef496210478b8a9e2c3f8804f3acfb35891", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest_command": "autorest specification/eventhub/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.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", "readme": "specification/eventhub/resource-manager/readme.md" diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/_event_hub_management_client.py index 54186c7530a8..26fb95dce989 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/_event_hub_management_client.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/_event_hub_management_client.py @@ -33,7 +33,7 @@ def __init__(self, *args, **kwargs): pass class EventHubManagementClient(MultiApiClientMixin, _SDKClient): - """Azure Event Hubs client. + """Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and VirtualNetworkRules resources. This ready contains multiple API versions, to help you deal with all of the Azure clouds (Azure Stack, Azure Government, Azure China, etc.). @@ -56,11 +56,12 @@ class EventHubManagementClient(MultiApiClientMixin, _SDKClient): :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' + DEFAULT_API_VERSION = '2021-11-01' _PROFILE_TAG = "azure.mgmt.eventhub.EventHubManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, + 'regions': '2017-04-01', }}, _PROFILE_TAG + " latest" ) @@ -96,6 +97,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2018-01-01-preview: :mod:`v2018_01_01_preview.models` * 2021-01-01-preview: :mod:`v2021_01_01_preview.models` * 2021-06-01-preview: :mod:`v2021_06_01_preview.models` + * 2021-11-01: :mod:`v2021_11_01.models` """ if api_version == '2015-08-01': from .v2015_08_01 import models @@ -112,6 +114,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2021-06-01-preview': from .v2021_06_01_preview import models return models + elif api_version == '2021-11-01': + from .v2021_11_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -120,12 +125,15 @@ def clusters(self): * 2018-01-01-preview: :class:`ClustersOperations` * 2021-06-01-preview: :class:`ClustersOperations` + * 2021-11-01: :class:`ClustersOperations` """ api_version = self._get_api_version('clusters') if api_version == '2018-01-01-preview': from .v2018_01_01_preview.operations import ClustersOperations as OperationClass elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import ClustersOperations as OperationClass + elif api_version == '2021-11-01': + from .v2021_11_01.operations import ClustersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'clusters'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -136,12 +144,15 @@ def configuration(self): * 2018-01-01-preview: :class:`ConfigurationOperations` * 2021-06-01-preview: :class:`ConfigurationOperations` + * 2021-11-01: :class:`ConfigurationOperations` """ api_version = self._get_api_version('configuration') if api_version == '2018-01-01-preview': from .v2018_01_01_preview.operations import ConfigurationOperations as OperationClass elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import ConfigurationOperations as OperationClass + elif api_version == '2021-11-01': + from .v2021_11_01.operations import ConfigurationOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'configuration'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -155,6 +166,7 @@ def consumer_groups(self): * 2018-01-01-preview: :class:`ConsumerGroupsOperations` * 2021-01-01-preview: :class:`ConsumerGroupsOperations` * 2021-06-01-preview: :class:`ConsumerGroupsOperations` + * 2021-11-01: :class:`ConsumerGroupsOperations` """ api_version = self._get_api_version('consumer_groups') if api_version == '2015-08-01': @@ -167,6 +179,8 @@ def consumer_groups(self): from .v2021_01_01_preview.operations import ConsumerGroupsOperations as OperationClass elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import ConsumerGroupsOperations as OperationClass + elif api_version == '2021-11-01': + from .v2021_11_01.operations import ConsumerGroupsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'consumer_groups'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -179,6 +193,7 @@ def disaster_recovery_configs(self): * 2018-01-01-preview: :class:`DisasterRecoveryConfigsOperations` * 2021-01-01-preview: :class:`DisasterRecoveryConfigsOperations` * 2021-06-01-preview: :class:`DisasterRecoveryConfigsOperations` + * 2021-11-01: :class:`DisasterRecoveryConfigsOperations` """ api_version = self._get_api_version('disaster_recovery_configs') if api_version == '2017-04-01': @@ -189,6 +204,8 @@ def disaster_recovery_configs(self): from .v2021_01_01_preview.operations import DisasterRecoveryConfigsOperations as OperationClass elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import DisasterRecoveryConfigsOperations as OperationClass + elif api_version == '2021-11-01': + from .v2021_11_01.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))) @@ -202,6 +219,7 @@ def event_hubs(self): * 2018-01-01-preview: :class:`EventHubsOperations` * 2021-01-01-preview: :class:`EventHubsOperations` * 2021-06-01-preview: :class:`EventHubsOperations` + * 2021-11-01: :class:`EventHubsOperations` """ api_version = self._get_api_version('event_hubs') if api_version == '2015-08-01': @@ -214,6 +232,8 @@ def event_hubs(self): from .v2021_01_01_preview.operations import EventHubsOperations as OperationClass elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import EventHubsOperations as OperationClass + elif api_version == '2021-11-01': + from .v2021_11_01.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))) @@ -227,6 +247,7 @@ def namespaces(self): * 2018-01-01-preview: :class:`NamespacesOperations` * 2021-01-01-preview: :class:`NamespacesOperations` * 2021-06-01-preview: :class:`NamespacesOperations` + * 2021-11-01: :class:`NamespacesOperations` """ api_version = self._get_api_version('namespaces') if api_version == '2015-08-01': @@ -239,6 +260,8 @@ def namespaces(self): from .v2021_01_01_preview.operations import NamespacesOperations as OperationClass elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import NamespacesOperations as OperationClass + elif api_version == '2021-11-01': + from .v2021_11_01.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))) @@ -252,6 +275,7 @@ def operations(self): * 2018-01-01-preview: :class:`Operations` * 2021-01-01-preview: :class:`Operations` * 2021-06-01-preview: :class:`Operations` + * 2021-11-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2015-08-01': @@ -264,6 +288,8 @@ def operations(self): from .v2021_01_01_preview.operations import Operations as OperationClass elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import Operations as OperationClass + elif api_version == '2021-11-01': + from .v2021_11_01.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))) @@ -275,6 +301,7 @@ def private_endpoint_connections(self): * 2018-01-01-preview: :class:`PrivateEndpointConnectionsOperations` * 2021-01-01-preview: :class:`PrivateEndpointConnectionsOperations` * 2021-06-01-preview: :class:`PrivateEndpointConnectionsOperations` + * 2021-11-01: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2018-01-01-preview': @@ -283,6 +310,8 @@ def private_endpoint_connections(self): from .v2021_01_01_preview.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2021-11-01': + from .v2021_11_01.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))) @@ -294,6 +323,7 @@ def private_link_resources(self): * 2018-01-01-preview: :class:`PrivateLinkResourcesOperations` * 2021-01-01-preview: :class:`PrivateLinkResourcesOperations` * 2021-06-01-preview: :class:`PrivateLinkResourcesOperations` + * 2021-11-01: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2018-01-01-preview': @@ -302,6 +332,8 @@ def private_link_resources(self): from .v2021_01_01_preview.operations import PrivateLinkResourcesOperations as OperationClass elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2021-11-01': + from .v2021_11_01.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))) @@ -322,6 +354,19 @@ def regions(self): 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 schema_registry(self): + """Instance depends on the API version: + + * 2021-11-01: :class:`SchemaRegistryOperations` + """ + api_version = self._get_api_version('schema_registry') + if api_version == '2021-11-01': + from .v2021_11_01.operations import SchemaRegistryOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'schema_registry'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + def close(self): self._client.close() def __enter__(self): diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/_version.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/_version.py index 2bcd3a3e386b..ec4bcf3637ab 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/_version.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "9.1.0" +VERSION = "10.0.0" diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/aio/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/aio/_event_hub_management_client.py index d9c6cc69154b..38f76459a789 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/aio/_event_hub_management_client.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/aio/_event_hub_management_client.py @@ -31,7 +31,7 @@ def __init__(self, *args, **kwargs): pass class EventHubManagementClient(MultiApiClientMixin, _SDKClient): - """Azure Event Hubs client. + """Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and VirtualNetworkRules resources. This ready contains multiple API versions, to help you deal with all of the Azure clouds (Azure Stack, Azure Government, Azure China, etc.). @@ -54,11 +54,12 @@ class EventHubManagementClient(MultiApiClientMixin, _SDKClient): :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' + DEFAULT_API_VERSION = '2021-11-01' _PROFILE_TAG = "azure.mgmt.eventhub.EventHubManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, + 'regions': '2017-04-01', }}, _PROFILE_TAG + " latest" ) @@ -94,6 +95,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2018-01-01-preview: :mod:`v2018_01_01_preview.models` * 2021-01-01-preview: :mod:`v2021_01_01_preview.models` * 2021-06-01-preview: :mod:`v2021_06_01_preview.models` + * 2021-11-01: :mod:`v2021_11_01.models` """ if api_version == '2015-08-01': from ..v2015_08_01 import models @@ -110,6 +112,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2021-06-01-preview': from ..v2021_06_01_preview import models return models + elif api_version == '2021-11-01': + from ..v2021_11_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -118,12 +123,15 @@ def clusters(self): * 2018-01-01-preview: :class:`ClustersOperations` * 2021-06-01-preview: :class:`ClustersOperations` + * 2021-11-01: :class:`ClustersOperations` """ api_version = self._get_api_version('clusters') if api_version == '2018-01-01-preview': from ..v2018_01_01_preview.aio.operations import ClustersOperations as OperationClass elif api_version == '2021-06-01-preview': from ..v2021_06_01_preview.aio.operations import ClustersOperations as OperationClass + elif api_version == '2021-11-01': + from ..v2021_11_01.aio.operations import ClustersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'clusters'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -134,12 +142,15 @@ def configuration(self): * 2018-01-01-preview: :class:`ConfigurationOperations` * 2021-06-01-preview: :class:`ConfigurationOperations` + * 2021-11-01: :class:`ConfigurationOperations` """ api_version = self._get_api_version('configuration') if api_version == '2018-01-01-preview': from ..v2018_01_01_preview.aio.operations import ConfigurationOperations as OperationClass elif api_version == '2021-06-01-preview': from ..v2021_06_01_preview.aio.operations import ConfigurationOperations as OperationClass + elif api_version == '2021-11-01': + from ..v2021_11_01.aio.operations import ConfigurationOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'configuration'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -153,6 +164,7 @@ def consumer_groups(self): * 2018-01-01-preview: :class:`ConsumerGroupsOperations` * 2021-01-01-preview: :class:`ConsumerGroupsOperations` * 2021-06-01-preview: :class:`ConsumerGroupsOperations` + * 2021-11-01: :class:`ConsumerGroupsOperations` """ api_version = self._get_api_version('consumer_groups') if api_version == '2015-08-01': @@ -165,6 +177,8 @@ def consumer_groups(self): from ..v2021_01_01_preview.aio.operations import ConsumerGroupsOperations as OperationClass elif api_version == '2021-06-01-preview': from ..v2021_06_01_preview.aio.operations import ConsumerGroupsOperations as OperationClass + elif api_version == '2021-11-01': + from ..v2021_11_01.aio.operations import ConsumerGroupsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'consumer_groups'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -177,6 +191,7 @@ def disaster_recovery_configs(self): * 2018-01-01-preview: :class:`DisasterRecoveryConfigsOperations` * 2021-01-01-preview: :class:`DisasterRecoveryConfigsOperations` * 2021-06-01-preview: :class:`DisasterRecoveryConfigsOperations` + * 2021-11-01: :class:`DisasterRecoveryConfigsOperations` """ api_version = self._get_api_version('disaster_recovery_configs') if api_version == '2017-04-01': @@ -187,6 +202,8 @@ def disaster_recovery_configs(self): from ..v2021_01_01_preview.aio.operations import DisasterRecoveryConfigsOperations as OperationClass elif api_version == '2021-06-01-preview': from ..v2021_06_01_preview.aio.operations import DisasterRecoveryConfigsOperations as OperationClass + elif api_version == '2021-11-01': + from ..v2021_11_01.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))) @@ -200,6 +217,7 @@ def event_hubs(self): * 2018-01-01-preview: :class:`EventHubsOperations` * 2021-01-01-preview: :class:`EventHubsOperations` * 2021-06-01-preview: :class:`EventHubsOperations` + * 2021-11-01: :class:`EventHubsOperations` """ api_version = self._get_api_version('event_hubs') if api_version == '2015-08-01': @@ -212,6 +230,8 @@ def event_hubs(self): from ..v2021_01_01_preview.aio.operations import EventHubsOperations as OperationClass elif api_version == '2021-06-01-preview': from ..v2021_06_01_preview.aio.operations import EventHubsOperations as OperationClass + elif api_version == '2021-11-01': + from ..v2021_11_01.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))) @@ -225,6 +245,7 @@ def namespaces(self): * 2018-01-01-preview: :class:`NamespacesOperations` * 2021-01-01-preview: :class:`NamespacesOperations` * 2021-06-01-preview: :class:`NamespacesOperations` + * 2021-11-01: :class:`NamespacesOperations` """ api_version = self._get_api_version('namespaces') if api_version == '2015-08-01': @@ -237,6 +258,8 @@ def namespaces(self): from ..v2021_01_01_preview.aio.operations import NamespacesOperations as OperationClass elif api_version == '2021-06-01-preview': from ..v2021_06_01_preview.aio.operations import NamespacesOperations as OperationClass + elif api_version == '2021-11-01': + from ..v2021_11_01.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))) @@ -250,6 +273,7 @@ def operations(self): * 2018-01-01-preview: :class:`Operations` * 2021-01-01-preview: :class:`Operations` * 2021-06-01-preview: :class:`Operations` + * 2021-11-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2015-08-01': @@ -262,6 +286,8 @@ def operations(self): from ..v2021_01_01_preview.aio.operations import Operations as OperationClass elif api_version == '2021-06-01-preview': from ..v2021_06_01_preview.aio.operations import Operations as OperationClass + elif api_version == '2021-11-01': + from ..v2021_11_01.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))) @@ -273,6 +299,7 @@ def private_endpoint_connections(self): * 2018-01-01-preview: :class:`PrivateEndpointConnectionsOperations` * 2021-01-01-preview: :class:`PrivateEndpointConnectionsOperations` * 2021-06-01-preview: :class:`PrivateEndpointConnectionsOperations` + * 2021-11-01: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2018-01-01-preview': @@ -281,6 +308,8 @@ def private_endpoint_connections(self): from ..v2021_01_01_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2021-06-01-preview': from ..v2021_06_01_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2021-11-01': + from ..v2021_11_01.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))) @@ -292,6 +321,7 @@ def private_link_resources(self): * 2018-01-01-preview: :class:`PrivateLinkResourcesOperations` * 2021-01-01-preview: :class:`PrivateLinkResourcesOperations` * 2021-06-01-preview: :class:`PrivateLinkResourcesOperations` + * 2021-11-01: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2018-01-01-preview': @@ -300,6 +330,8 @@ def private_link_resources(self): from ..v2021_01_01_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass elif api_version == '2021-06-01-preview': from ..v2021_06_01_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2021-11-01': + from ..v2021_11_01.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))) @@ -320,6 +352,19 @@ def regions(self): 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 schema_registry(self): + """Instance depends on the API version: + + * 2021-11-01: :class:`SchemaRegistryOperations` + """ + api_version = self._get_api_version('schema_registry') + if api_version == '2021-11-01': + from ..v2021_11_01.aio.operations import SchemaRegistryOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'schema_registry'".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): diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/models.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/models.py index 5572430ae05d..013276f989e6 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/models.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/models.py @@ -5,3 +5,4 @@ # license information. # -------------------------------------------------------------------------- from .v2017_04_01.models import * +from .v2021_11_01.models import * diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/_version.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/_version.py index f89ed38360ab..9f8bb24bdd99 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/_version.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.1.0" +VERSION = "10.0.0" diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/_version.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/_version.py index f89ed38360ab..9f8bb24bdd99 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/_version.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.1.0" +VERSION = "10.0.0" diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_models.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_models.py index c5ed65e0e26c..c3ba8c22a80e 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_models.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_models.py @@ -72,15 +72,17 @@ def __init__( class Resource(msrest.serialization.Model): - """The resource definition. + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -111,11 +113,13 @@ class ArmDisasterRecovery(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :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", @@ -200,11 +204,13 @@ class AuthorizationRule(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param rights: The rights associated with the rule. :type rights: list[str or ~azure.mgmt.eventhub.v2017_04_01.models.AccessRights] @@ -370,11 +376,13 @@ class ConsumerGroup(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar created_at: Exact time the message was created. :vartype created_at: ~datetime.datetime @@ -476,11 +484,13 @@ class TrackedResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -516,11 +526,13 @@ class EHNamespace(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -645,11 +657,13 @@ class Eventhub(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar partition_ids: Current number of shards on the Event Hub. :vartype partition_ids: list[str] @@ -738,11 +752,13 @@ class MessagingPlan(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -796,11 +812,13 @@ class MessagingRegions(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -898,11 +916,13 @@ class NetworkRuleSet(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param default_action: Default Action for Network Rule Set. Possible values include: "Allow", "Deny". diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_models_py3.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_models_py3.py index 186f9641af2d..5610404f632d 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_models_py3.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_models_py3.py @@ -76,15 +76,17 @@ def __init__( class Resource(msrest.serialization.Model): - """The resource definition. + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -115,11 +117,13 @@ class ArmDisasterRecovery(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :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", @@ -209,11 +213,13 @@ class AuthorizationRule(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param rights: The rights associated with the rule. :type rights: list[str or ~azure.mgmt.eventhub.v2017_04_01.models.AccessRights] @@ -396,11 +402,13 @@ class ConsumerGroup(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar created_at: Exact time the message was created. :vartype created_at: ~datetime.datetime @@ -512,11 +520,13 @@ class TrackedResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -555,11 +565,13 @@ class EHNamespace(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -697,11 +709,13 @@ class Eventhub(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar partition_ids: Current number of shards on the Event Hub. :vartype partition_ids: list[str] @@ -798,11 +812,13 @@ class MessagingPlan(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -859,11 +875,13 @@ class MessagingRegions(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -967,11 +985,13 @@ class NetworkRuleSet(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param default_action: Default Action for Network Rule Set. Possible values include: "Allow", "Deny". diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_version.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_version.py index f89ed38360ab..9f8bb24bdd99 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_version.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.1.0" +VERSION = "10.0.0" diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_models.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_models.py index 195086f8199a..dc45b5d93897 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_models.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_models.py @@ -72,15 +72,17 @@ def __init__( class Resource(msrest.serialization.Model): - """The resource definition. + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -111,11 +113,13 @@ class ArmDisasterRecovery(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :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", @@ -201,11 +205,13 @@ class AuthorizationRule(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param rights: The rights associated with the rule. :type rights: list[str or ~azure.mgmt.eventhub.v2018_01_01_preview.models.AccessRights] @@ -411,11 +417,13 @@ class TrackedResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -451,11 +459,13 @@ class Cluster(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -613,11 +623,13 @@ class ConsumerGroup(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar created_at: Exact time the message was created. :vartype created_at: ~datetime.datetime @@ -719,11 +731,13 @@ class EHNamespace(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -934,11 +948,13 @@ class Eventhub(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar partition_ids: Current number of shards on the Event Hub. :vartype partition_ids: list[str] @@ -1056,11 +1072,13 @@ class IpFilterRule(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param ip_mask: IP Mask. :type ip_mask: str @@ -1151,11 +1169,13 @@ class MessagingRegions(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -1253,11 +1273,13 @@ class NetworkRuleSet(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param trusted_service_access_enabled: Value that indicates whether Trusted Service Access is Enabled or not. @@ -1465,11 +1487,13 @@ class PrivateEndpointConnection(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param private_endpoint: The Private Endpoint resource for this Connection. :type private_endpoint: ~azure.mgmt.eventhub.v2018_01_01_preview.models.PrivateEndpoint @@ -1682,11 +1706,13 @@ class VirtualNetworkRule(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param virtual_network_subnet_id: ARM ID of Virtual Network Subnet. :type virtual_network_subnet_id: str diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_models_py3.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_models_py3.py index b77e8ceb7310..dcef990361ec 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_models_py3.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_models_py3.py @@ -76,15 +76,17 @@ def __init__( class Resource(msrest.serialization.Model): - """The resource definition. + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -115,11 +117,13 @@ class ArmDisasterRecovery(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :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", @@ -210,11 +214,13 @@ class AuthorizationRule(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param rights: The rights associated with the rule. :type rights: list[str or ~azure.mgmt.eventhub.v2018_01_01_preview.models.AccessRights] @@ -441,11 +447,13 @@ class TrackedResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -484,11 +492,13 @@ class Cluster(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -661,11 +671,13 @@ class ConsumerGroup(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar created_at: Exact time the message was created. :vartype created_at: ~datetime.datetime @@ -777,11 +789,13 @@ class EHNamespace(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -1016,11 +1030,13 @@ class Eventhub(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar partition_ids: Current number of shards on the Event Hub. :vartype partition_ids: list[str] @@ -1150,11 +1166,13 @@ class IpFilterRule(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param ip_mask: IP Mask. :type ip_mask: str @@ -1256,11 +1274,13 @@ class MessagingRegions(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -1364,11 +1384,13 @@ class NetworkRuleSet(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param trusted_service_access_enabled: Value that indicates whether Trusted Service Access is Enabled or not. @@ -1591,11 +1613,13 @@ class PrivateEndpointConnection(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param private_endpoint: The Private Endpoint resource for this Connection. :type private_endpoint: ~azure.mgmt.eventhub.v2018_01_01_preview.models.PrivateEndpoint @@ -1834,11 +1858,13 @@ class VirtualNetworkRule(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param virtual_network_subnet_id: ARM ID of Virtual Network Subnet. :type virtual_network_subnet_id: str diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/_version.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/_version.py index f89ed38360ab..9f8bb24bdd99 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/_version.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.1.0" +VERSION = "10.0.0" diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/models/_models.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/models/_models.py index f1080cbf888e..37cbb6b1b5d3 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/models/_models.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/models/_models.py @@ -72,15 +72,17 @@ def __init__( class Resource(msrest.serialization.Model): - """The resource definition. + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -111,11 +113,13 @@ class ArmDisasterRecovery(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_01_01_preview.models.SystemData @@ -206,11 +210,13 @@ class AuthorizationRule(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_01_01_preview.models.SystemData @@ -437,11 +443,13 @@ class ConsumerGroup(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_01_01_preview.models.SystemData @@ -548,11 +556,13 @@ class TrackedResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -588,11 +598,13 @@ class EHNamespace(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -779,11 +791,13 @@ class Eventhub(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_01_01_preview.models.SystemData @@ -948,11 +962,13 @@ class NetworkRuleSet(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_01_01_preview.models.SystemData @@ -1165,11 +1181,13 @@ class PrivateEndpointConnection(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_01_01_preview.models.SystemData diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/models/_models_py3.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/models/_models_py3.py index 0bfac6b984e8..be38218e4afb 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/models/_models_py3.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/models/_models_py3.py @@ -77,15 +77,17 @@ def __init__( class Resource(msrest.serialization.Model): - """The resource definition. + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -116,11 +118,13 @@ class ArmDisasterRecovery(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_01_01_preview.models.SystemData @@ -216,11 +220,13 @@ class AuthorizationRule(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_01_01_preview.models.SystemData @@ -467,11 +473,13 @@ class ConsumerGroup(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_01_01_preview.models.SystemData @@ -588,11 +596,13 @@ class TrackedResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -631,11 +641,13 @@ class EHNamespace(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -844,11 +856,13 @@ class Eventhub(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_01_01_preview.models.SystemData @@ -1029,11 +1043,13 @@ class NetworkRuleSet(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_01_01_preview.models.SystemData @@ -1261,11 +1277,13 @@ class PrivateEndpointConnection(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_01_01_preview.models.SystemData diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/_version.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/_version.py index f89ed38360ab..9f8bb24bdd99 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/_version.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.1.0" +VERSION = "10.0.0" diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/models/_models.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/models/_models.py index 098183c8cdbb..06a26cac19ec 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/models/_models.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/models/_models.py @@ -72,15 +72,17 @@ def __init__( class Resource(msrest.serialization.Model): - """The resource definition. + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -111,11 +113,13 @@ class ArmDisasterRecovery(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_06_01_preview.models.SystemData @@ -206,11 +210,13 @@ class AuthorizationRule(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_06_01_preview.models.SystemData @@ -416,11 +422,13 @@ class TrackedResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -456,11 +464,13 @@ class Cluster(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -623,11 +633,13 @@ class ConsumerGroup(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_06_01_preview.models.SystemData @@ -734,11 +746,13 @@ class EHNamespace(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -967,11 +981,13 @@ class Eventhub(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_06_01_preview.models.SystemData @@ -1136,11 +1152,13 @@ class NetworkRuleSet(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_06_01_preview.models.SystemData @@ -1360,11 +1378,13 @@ class PrivateEndpointConnection(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_06_01_preview.models.SystemData diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/models/_models_py3.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/models/_models_py3.py index d43fd908426a..1a9c1964abb8 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/models/_models_py3.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/models/_models_py3.py @@ -77,15 +77,17 @@ def __init__( class Resource(msrest.serialization.Model): - """The resource definition. + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -116,11 +118,13 @@ class ArmDisasterRecovery(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_06_01_preview.models.SystemData @@ -216,11 +220,13 @@ class AuthorizationRule(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_06_01_preview.models.SystemData @@ -447,11 +453,13 @@ class TrackedResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -490,11 +498,13 @@ class Cluster(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -672,11 +682,13 @@ class ConsumerGroup(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_06_01_preview.models.SystemData @@ -793,11 +805,13 @@ class EHNamespace(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param location: Resource location. :type location: str @@ -1053,11 +1067,13 @@ class Eventhub(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_06_01_preview.models.SystemData @@ -1238,11 +1254,13 @@ class NetworkRuleSet(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_06_01_preview.models.SystemData @@ -1478,11 +1496,13 @@ class PrivateEndpointConnection(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.eventhub.v2021_06_01_preview.models.SystemData diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/__init__.py new file mode 100644 index 000000000000..b65464aa7533 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/__init__.py @@ -0,0 +1,19 @@ +# 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 ._event_hub_management_client import EventHubManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['EventHubManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_configuration.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_configuration.py new file mode 100644 index 000000000000..f1a299fb1334 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_configuration.py @@ -0,0 +1,71 @@ +# 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 + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class EventHubManagementClientConfiguration(Configuration): + """Configuration for EventHubManagementClient. + + 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(EventHubManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-11-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_event_hub_management_client.py new file mode 100644 index 000000000000..e840aaea7660 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_event_hub_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 EventHubManagementClientConfiguration +from .operations import ClustersOperations +from .operations import ConfigurationOperations +from .operations import NamespacesOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import PrivateLinkResourcesOperations +from .operations import Operations +from .operations import EventHubsOperations +from .operations import DisasterRecoveryConfigsOperations +from .operations import ConsumerGroupsOperations +from .operations import SchemaRegistryOperations +from . import models + + +class EventHubManagementClient(object): + """Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and VirtualNetworkRules resources. + + :ivar clusters: ClustersOperations operations + :vartype clusters: azure.mgmt.eventhub.v2021_11_01.operations.ClustersOperations + :ivar configuration: ConfigurationOperations operations + :vartype configuration: azure.mgmt.eventhub.v2021_11_01.operations.ConfigurationOperations + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: azure.mgmt.eventhub.v2021_11_01.operations.NamespacesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.eventhub.v2021_11_01.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.eventhub.v2021_11_01.operations.PrivateLinkResourcesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.eventhub.v2021_11_01.operations.Operations + :ivar event_hubs: EventHubsOperations operations + :vartype event_hubs: azure.mgmt.eventhub.v2021_11_01.operations.EventHubsOperations + :ivar disaster_recovery_configs: DisasterRecoveryConfigsOperations operations + :vartype disaster_recovery_configs: azure.mgmt.eventhub.v2021_11_01.operations.DisasterRecoveryConfigsOperations + :ivar consumer_groups: ConsumerGroupsOperations operations + :vartype consumer_groups: azure.mgmt.eventhub.v2021_11_01.operations.ConsumerGroupsOperations + :ivar schema_registry: SchemaRegistryOperations operations + :vartype schema_registry: azure.mgmt.eventhub.v2021_11_01.operations.SchemaRegistryOperations + :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 = EventHubManagementClientConfiguration(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.clusters = ClustersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.configuration = ConfigurationOperations( + self._client, self._config, self._serialize, self._deserialize) + 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.event_hubs = EventHubsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.consumer_groups = ConsumerGroupsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.schema_registry = SchemaRegistryOperations( + 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: () -> EventHubManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_metadata.json b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_metadata.json new file mode 100644 index 000000000000..9f119f332f0e --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_metadata.json @@ -0,0 +1,112 @@ +{ + "chosen_version": "2021-11-01", + "total_api_version_list": ["2021-11-01"], + "client": { + "name": "EventHubManagementClient", + "filename": "_event_hub_management_client", + "description": "Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and VirtualNetworkRules resources.", + "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\": [\"EventHubManagementClientConfiguration\"]}}, \"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\": [\"EventHubManagementClientConfiguration\"]}}, \"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": { + "clusters": "ClustersOperations", + "configuration": "ConfigurationOperations", + "namespaces": "NamespacesOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations", + "private_link_resources": "PrivateLinkResourcesOperations", + "operations": "Operations", + "event_hubs": "EventHubsOperations", + "disaster_recovery_configs": "DisasterRecoveryConfigsOperations", + "consumer_groups": "ConsumerGroupsOperations", + "schema_registry": "SchemaRegistryOperations" + } +} \ No newline at end of file diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_version.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_version.py new file mode 100644 index 000000000000..9f8bb24bdd99 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_version.py @@ -0,0 +1,9 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "10.0.0" diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/__init__.py new file mode 100644 index 000000000000..7cb0ca65be40 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_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 ._event_hub_management_client import EventHubManagementClient +__all__ = ['EventHubManagementClient'] diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/_configuration.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/_configuration.py new file mode 100644 index 000000000000..cfe268371392 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/_configuration.py @@ -0,0 +1,67 @@ +# 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 + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class EventHubManagementClientConfiguration(Configuration): + """Configuration for EventHubManagementClient. + + 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(EventHubManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-11-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/_event_hub_management_client.py new file mode 100644 index 000000000000..7fad9c62661f --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/_event_hub_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 EventHubManagementClientConfiguration +from .operations import ClustersOperations +from .operations import ConfigurationOperations +from .operations import NamespacesOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import PrivateLinkResourcesOperations +from .operations import Operations +from .operations import EventHubsOperations +from .operations import DisasterRecoveryConfigsOperations +from .operations import ConsumerGroupsOperations +from .operations import SchemaRegistryOperations +from .. import models + + +class EventHubManagementClient(object): + """Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and VirtualNetworkRules resources. + + :ivar clusters: ClustersOperations operations + :vartype clusters: azure.mgmt.eventhub.v2021_11_01.aio.operations.ClustersOperations + :ivar configuration: ConfigurationOperations operations + :vartype configuration: azure.mgmt.eventhub.v2021_11_01.aio.operations.ConfigurationOperations + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: azure.mgmt.eventhub.v2021_11_01.aio.operations.NamespacesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.eventhub.v2021_11_01.aio.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.eventhub.v2021_11_01.aio.operations.PrivateLinkResourcesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.eventhub.v2021_11_01.aio.operations.Operations + :ivar event_hubs: EventHubsOperations operations + :vartype event_hubs: azure.mgmt.eventhub.v2021_11_01.aio.operations.EventHubsOperations + :ivar disaster_recovery_configs: DisasterRecoveryConfigsOperations operations + :vartype disaster_recovery_configs: azure.mgmt.eventhub.v2021_11_01.aio.operations.DisasterRecoveryConfigsOperations + :ivar consumer_groups: ConsumerGroupsOperations operations + :vartype consumer_groups: azure.mgmt.eventhub.v2021_11_01.aio.operations.ConsumerGroupsOperations + :ivar schema_registry: SchemaRegistryOperations operations + :vartype schema_registry: azure.mgmt.eventhub.v2021_11_01.aio.operations.SchemaRegistryOperations + :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 = EventHubManagementClientConfiguration(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.clusters = ClustersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.configuration = ConfigurationOperations( + self._client, self._config, self._serialize, self._deserialize) + 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.event_hubs = EventHubsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.consumer_groups = ConsumerGroupsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.schema_registry = SchemaRegistryOperations( + 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) -> "EventHubManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/__init__.py new file mode 100644 index 000000000000..84e125803ca8 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/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 ._clusters_operations import ClustersOperations +from ._configuration_operations import ConfigurationOperations +from ._namespaces_operations import NamespacesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._operations import Operations +from ._event_hubs_operations import EventHubsOperations +from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations +from ._consumer_groups_operations import ConsumerGroupsOperations +from ._schema_registry_operations import SchemaRegistryOperations + +__all__ = [ + 'ClustersOperations', + 'ConfigurationOperations', + 'NamespacesOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'Operations', + 'EventHubsOperations', + 'DisasterRecoveryConfigsOperations', + 'ConsumerGroupsOperations', + 'SchemaRegistryOperations', +] diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_clusters_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_clusters_operations.py new file mode 100644 index 000000000000..baf55004d239 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_clusters_operations.py @@ -0,0 +1,720 @@ +# 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 ClustersOperations: + """ClustersOperations 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.eventhub.v2021_11_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 list_available_cluster_region( + self, + **kwargs: Any + ) -> "_models.AvailableClustersList": + """List the quantity of available pre-provisioned Event Hubs Clusters, indexed by Azure region. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailableClustersList, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AvailableClustersList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableClustersList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-01" + accept = "application/json" + + # Construct URL + url = self.list_available_cluster_region.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['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('AvailableClustersList', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_available_cluster_region.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventHub/availableClusterRegions'} # type: ignore + + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ClusterListResult"]: + """Lists the available Event Hubs Clusters within an ARM resource group. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ClusterListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventhub.v2021_11_01.models.ClusterListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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('ClusterListResult', 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_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventHub/clusters'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ClusterListResult"]: + """Lists the available Event Hubs Clusters within an ARM 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 ClusterListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventhub.v2021_11_01.models.ClusterListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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 = { + '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), + } + url = self._client.format_url(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('ClusterListResult', 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.EventHub/clusters'} # type: ignore + + async def get( + self, + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> "_models.Cluster": + """Gets the resource description of the specified Event Hubs Cluster. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param cluster_name: The name of the Event Hubs Cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Cluster, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.Cluster + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-01" + accept = "application/json" + + # Construct URL + url = self.get.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), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=50, min_length=6), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + cluster_name: str, + parameters: "_models.Cluster", + **kwargs: Any + ) -> Optional["_models.Cluster"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Cluster"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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 = { + '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), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=50, min_length=6), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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, 'Cluster') + 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('Cluster', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + parameters: "_models.Cluster", + **kwargs: Any + ) -> AsyncLROPoller["_models.Cluster"]: + """Creates or updates an instance of an Event Hubs Cluster. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param cluster_name: The name of the Event Hubs Cluster. + :type cluster_name: str + :param parameters: Parameters for creating a eventhub cluster resource. + :type parameters: ~azure.mgmt.eventhub.v2021_11_01.models.Cluster + :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 Cluster or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventhub.v2021_11_01.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + 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, + cluster_name=cluster_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('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=50, min_length=6), + } + + 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.EventHub/clusters/{clusterName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + cluster_name: str, + parameters: "_models.Cluster", + **kwargs: Any + ) -> Optional["_models.Cluster"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Cluster"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.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), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=50, min_length=6), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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, 'Cluster') + 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('Cluster', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + parameters: "_models.Cluster", + **kwargs: Any + ) -> AsyncLROPoller["_models.Cluster"]: + """Modifies mutable properties on the Event Hubs Cluster. This operation is idempotent. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param cluster_name: The name of the Event Hubs Cluster. + :type cluster_name: str + :param parameters: The properties of the Event Hubs Cluster which should be updated. + :type parameters: ~azure.mgmt.eventhub.v2021_11_01.models.Cluster + :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 Cluster or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventhub.v2021_11_01.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + 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._update_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_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('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=50, min_length=6), + } + + 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_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + cluster_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-11-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.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), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=50, min_length=6), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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.EventHub/clusters/{clusterName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing Event Hubs Cluster. This operation is idempotent. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param cluster_name: The name of the Event Hubs Cluster. + :type cluster_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, + cluster_name=cluster_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 = { + '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), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=50, min_length=6), + } + + 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.EventHub/clusters/{clusterName}'} # type: ignore + + async def list_namespaces( + self, + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> "_models.EHNamespaceIdListResult": + """List all Event Hubs Namespace IDs in an Event Hubs Dedicated Cluster. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param cluster_name: The name of the Event Hubs Cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EHNamespaceIdListResult, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.EHNamespaceIdListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EHNamespaceIdListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-01" + accept = "application/json" + + # Construct URL + url = self.list_namespaces.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), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=50, min_length=6), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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('EHNamespaceIdListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_namespaces.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}/namespaces'} # type: ignore diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_configuration_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_configuration_operations.py new file mode 100644 index 000000000000..b0abe2109711 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_configuration_operations.py @@ -0,0 +1,174 @@ +# 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, Union +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 ConfigurationOperations: + """ConfigurationOperations 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.eventhub.v2021_11_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 patch( + self, + resource_group_name: str, + cluster_name: str, + parameters: "_models.ClusterQuotaConfigurationProperties", + **kwargs: Any + ) -> Optional["_models.ClusterQuotaConfigurationProperties"]: + """Replace all specified Event Hubs Cluster settings with those contained in the request body. + Leaves the settings not specified in the request body unmodified. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param cluster_name: The name of the Event Hubs Cluster. + :type cluster_name: str + :param parameters: Parameters for creating an Event Hubs Cluster resource. + :type parameters: ~azure.mgmt.eventhub.v2021_11_01.models.ClusterQuotaConfigurationProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ClusterQuotaConfigurationProperties, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.ClusterQuotaConfigurationProperties or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ClusterQuotaConfigurationProperties"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.patch.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), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=50, min_length=6), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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, 'ClusterQuotaConfigurationProperties') + 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('ClusterQuotaConfigurationProperties', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ClusterQuotaConfigurationProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}/quotaConfiguration/default'} # type: ignore + + async def get( + self, + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> "_models.ClusterQuotaConfigurationProperties": + """Get all Event Hubs Cluster settings - a collection of key/value pairs which represent the + quotas and settings imposed on the cluster. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param cluster_name: The name of the Event Hubs Cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ClusterQuotaConfigurationProperties, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.ClusterQuotaConfigurationProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterQuotaConfigurationProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-01" + accept = "application/json" + + # Construct URL + url = self.get.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), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=50, min_length=6), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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('ClusterQuotaConfigurationProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}/quotaConfiguration/default'} # type: ignore diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_consumer_groups_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_consumer_groups_operations.py new file mode 100644 index 000000000000..6ddd90a50a91 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_consumer_groups_operations.py @@ -0,0 +1,340 @@ +# 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 ConsumerGroupsOperations: + """ConsumerGroupsOperations 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.eventhub.v2021_11_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 create_or_update( + self, + resource_group_name: str, + namespace_name: str, + event_hub_name: str, + consumer_group_name: str, + parameters: "_models.ConsumerGroup", + **kwargs: Any + ) -> "_models.ConsumerGroup": + """Creates or updates an Event Hubs consumer group as a nested resource 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 event_hub_name: The Event Hub name. + :type event_hub_name: str + :param consumer_group_name: The consumer group name. + :type consumer_group_name: str + :param parameters: Parameters supplied to create or update a consumer group resource. + :type parameters: ~azure.mgmt.eventhub.v2021_11_01.models.ConsumerGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConsumerGroup, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.ConsumerGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConsumerGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'consumerGroupName': self._serialize.url("consumer_group_name", consumer_group_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, 'ConsumerGroup') + 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('ConsumerGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + event_hub_name: str, + consumer_group_name: str, + **kwargs: Any + ) -> None: + """Deletes a consumer group from the specified Event Hub 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 event_hub_name: The Event Hub name. + :type event_hub_name: str + :param consumer_group_name: The consumer group name. + :type consumer_group_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-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'consumerGroupName': self._serialize.url("consumer_group_name", consumer_group_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.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + event_hub_name: str, + consumer_group_name: str, + **kwargs: Any + ) -> "_models.ConsumerGroup": + """Gets a description for the specified consumer 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 event_hub_name: The Event Hub name. + :type event_hub_name: str + :param consumer_group_name: The consumer group name. + :type consumer_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConsumerGroup, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.ConsumerGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConsumerGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'consumerGroupName': self._serialize.url("consumer_group_name", consumer_group_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('ConsumerGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}'} # type: ignore + + def list_by_event_hub( + self, + resource_group_name: str, + namespace_name: str, + event_hub_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ConsumerGroupListResult"]: + """Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group + exists in 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 event_hub_name: The Event Hub name. + :type event_hub_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 ConsumerGroupListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventhub.v2021_11_01.models.ConsumerGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConsumerGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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_event_hub.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(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('ConsumerGroupListResult', 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_event_hub.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups'} # type: ignore diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_disaster_recovery_configs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_disaster_recovery_configs_operations.py new file mode 100644 index 000000000000..0305ee0e8802 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_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.eventhub.v2021_11_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.CheckNameAvailabilityParameter", + **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 Alias name. + :type parameters: ~azure.mgmt.eventhub.v2021_11_01.models.CheckNameAvailabilityParameter + :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.eventhub.v2021_11_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 = "2021-11-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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, 'CheckNameAvailabilityParameter') + 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.EventHub/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.eventhub.v2021_11_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 = "2021-11-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.EventHub/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.eventhub.v2021_11_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.eventhub.v2021_11_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 = "2021-11-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.EventHub/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-11-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, 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.EventHub/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.eventhub.v2021_11_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 = "2021-11-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.EventHub/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-11-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.EventHub/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 = "2021-11-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.EventHub/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.AuthorizationRuleListResult"]: + """Gets a list of 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 AuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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('AuthorizationRuleListResult', 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.EventHub/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.AuthorizationRule": + """Gets an AuthorizationRule 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: AuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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('AuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/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.eventhub.v2021_11_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 = "2021-11-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', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys'} # type: ignore diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_event_hubs_operations.py new file mode 100644 index 000000000000..41633f87c474 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_event_hubs_operations.py @@ -0,0 +1,752 @@ +# 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.eventhub.v2021_11_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, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.EventHubListResult"]: + """Gets all the Event Hubs 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 EventHubListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventhub.v2021_11_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 = "2021-11-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('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.EventHub/namespaces/{namespaceName}/eventhubs'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + event_hub_name: str, + parameters: "_models.Eventhub", + **kwargs: Any + ) -> "_models.Eventhub": + """Creates or updates a new Event Hub as a nested resource 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 event_hub_name: The Event Hub name. + :type event_hub_name: str + :param parameters: Parameters supplied to create an Event Hub resource. + :type parameters: ~azure.mgmt.eventhub.v2021_11_01.models.Eventhub + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Eventhub, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.Eventhub + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Eventhub"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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, 'Eventhub') + 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('Eventhub', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + event_hub_name: str, + **kwargs: Any + ) -> None: + """Deletes an Event Hub 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 event_hub_name: The Event Hub name. + :type event_hub_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-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + event_hub_name: str, + **kwargs: Any + ) -> "_models.Eventhub": + """Gets an Event Hubs description for the specified Event Hub. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name. + :type namespace_name: str + :param event_hub_name: The Event Hub name. + :type event_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Eventhub, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.Eventhub + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Eventhub"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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('Eventhub', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + event_hub_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.AuthorizationRuleListResult"]: + """Gets the authorization rules for an Event Hub. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name. + :type namespace_name: str + :param event_hub_name: The Event Hub name. + :type event_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(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('AuthorizationRuleListResult', 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.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + event_hub_name: str, + authorization_rule_name: str, + parameters: "_models.AuthorizationRule", + **kwargs: Any + ) -> "_models.AuthorizationRule": + """Creates or updates an AuthorizationRule for the specified Event Hub. Creation/update of the + AuthorizationRule will take a few seconds to take effect. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name. + :type namespace_name: str + :param event_hub_name: The Event Hub name. + :type event_hub_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access AuthorizationRule. + :type parameters: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_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, 'AuthorizationRule') + 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('AuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + event_hub_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AuthorizationRule": + """Gets an AuthorizationRule for an Event Hub 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 event_hub_name: The Event Hub name. + :type event_hub_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: AuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_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('AuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + event_hub_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes an Event Hub AuthorizationRule. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name. + :type namespace_name: str + :param event_hub_name: The Event Hub name. + :type event_hub_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-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_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_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + event_hub_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Gets the ACS and SAS connection strings for the Event Hub. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name. + :type namespace_name: str + :param event_hub_name: The Event Hub name. + :type event_hub_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.eventhub.v2021_11_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 = "2021-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_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.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.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}/listKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + event_hub_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateAccessKeyParameters", + **kwargs: Any + ) -> "_models.AccessKeys": + """Regenerates the ACS and SAS connection strings for the Event Hub. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name. + :type namespace_name: str + :param event_hub_name: The Event Hub name. + :type event_hub_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the AuthorizationRule Keys + (PrimaryKey/SecondaryKey). + :type parameters: ~azure.mgmt.eventhub.v2021_11_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.eventhub.v2021_11_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 = "2021-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_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, '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.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_namespaces_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_namespaces_operations.py new file mode 100644 index 000000000000..a189f62e52db --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_namespaces_operations.py @@ -0,0 +1,1202 @@ +# 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.eventhub.v2021_11_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.EHNamespaceListResult"]: + """Lists all the available Namespaces within a 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 EHNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventhub.v2021_11_01.models.EHNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EHNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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('EHNamespaceListResult', 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.EventHub/namespaces'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.EHNamespaceListResult"]: + """Lists 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 EHNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventhub.v2021_11_01.models.EHNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EHNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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('EHNamespaceListResult', 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.EventHub/namespaces'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.EHNamespace", + **kwargs: Any + ) -> Optional["_models.EHNamespace"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.EHNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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', 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, 'EHNamespace') + 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('EHNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('EHNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.EHNamespace", + **kwargs: Any + ) -> AsyncLROPoller["_models.EHNamespace"]: + """Creates or updates a 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 for creating a namespace resource. + :type parameters: ~azure.mgmt.eventhub.v2021_11_01.models.EHNamespace + :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 EHNamespace or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.eventhub.v2021_11_01.models.EHNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.EHNamespace"] + 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('EHNamespace', 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), + '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.EventHub/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-11-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.EventHub/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.EventHub/namespaces/{namespaceName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> "_models.EHNamespace": + """Gets the description of 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: EHNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.EHNamespace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EHNamespace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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('EHNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.EHNamespace", + **kwargs: Any + ) -> Optional["_models.EHNamespace"]: + """Creates or updates a 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 for updating a namespace resource. + :type parameters: ~azure.mgmt.eventhub.v2021_11_01.models.EHNamespace + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EHNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.EHNamespace or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.EHNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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, 'EHNamespace') + 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('EHNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('EHNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/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.eventhub.v2021_11_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.eventhub.v2021_11_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 = "2021-11-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.EventHub/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.eventhub.v2021_11_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 = "2021-11-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.EventHub/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + async def list_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> "_models.NetworkRuleSetListResult": + """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: NetworkRuleSetListResult, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_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 = "2021-11-01" + accept = "application/json" + + # Construct URL + url = self.list_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('NetworkRuleSetListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/networkRuleSets'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.AuthorizationRuleListResult"]: + """Gets a list of 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 AuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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('AuthorizationRuleListResult', 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.EventHub/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.AuthorizationRule", + **kwargs: Any + ) -> "_models.AuthorizationRule": + """Creates or updates an AuthorizationRule 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 AuthorizationRule. + :type parameters: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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, 'AuthorizationRule') + 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('AuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/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 an AuthorizationRule 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 + :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-11-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', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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.EventHub/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.AuthorizationRule": + """Gets an AuthorizationRule 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: AuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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('AuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/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.eventhub.v2021_11_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 = "2021-11-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', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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.EventHub/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 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters required to regenerate the connection string. + :type parameters: ~azure.mgmt.eventhub.v2021_11_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.eventhub.v2021_11_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 = "2021-11-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', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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.EventHub/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + async def check_name_availability( + self, + parameters: "_models.CheckNameAvailabilityParameter", + **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.eventhub.v2021_11_01.models.CheckNameAvailabilityParameter + :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.eventhub.v2021_11_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 = "2021-11-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, 'CheckNameAvailabilityParameter') + 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.EventHub/checkNameAvailability'} # type: ignore diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_operations.py new file mode 100644 index 000000000000..23698290f5d5 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_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.eventhub.v2021_11_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 Event Hub 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.eventhub.v2021_11_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 = "2021-11-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.EventHub/operations'} # type: ignore diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..3223f068073a --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,375 @@ +# 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.eventhub.v2021_11_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.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.eventhub.v2021_11_01.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-11-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('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.EventHub/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.eventhub.v2021_11_01.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.eventhub.v2021_11_01.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-11-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 = { + '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.EventHub/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-11-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'), + '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.EventHub/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 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 + :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.EventHub/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 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 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.eventhub.v2021_11_01.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-11-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), + '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.EventHub/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_private_link_resources_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..30de42df8521 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/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.eventhub.v2021_11_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 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.eventhub.v2021_11_01.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-11-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('PrivateLinkResourcesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/privateLinkResources'} # type: ignore diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_schema_registry_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_schema_registry_operations.py new file mode 100644 index 000000000000..b2058bf3926a --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_schema_registry_operations.py @@ -0,0 +1,323 @@ +# 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 SchemaRegistryOperations: + """SchemaRegistryOperations 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.eventhub.v2021_11_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, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SchemaGroupListResult"]: + """Gets all the Schema Groups 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 SchemaGroupListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.eventhub.v2021_11_01.models.SchemaGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SchemaGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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('SchemaGroupListResult', 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.EventHub/namespaces/{namespaceName}/schemagroups'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + schema_group_name: str, + parameters: "_models.SchemaGroup", + **kwargs: Any + ) -> "_models.SchemaGroup": + """create_or_update. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name. + :type namespace_name: str + :param schema_group_name: The Schema Group name. + :type schema_group_name: str + :param parameters: Parameters supplied to create an Event Hub resource. + :type parameters: ~azure.mgmt.eventhub.v2021_11_01.models.SchemaGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SchemaGroup, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.SchemaGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SchemaGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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), + 'schemaGroupName': self._serialize.url("schema_group_name", schema_group_name, 'str', max_length=256, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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, 'SchemaGroup') + 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('SchemaGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/schemagroups/{schemaGroupName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + schema_group_name: str, + **kwargs: Any + ) -> None: + """delete. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name. + :type namespace_name: str + :param schema_group_name: The Schema Group name. + :type schema_group_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-11-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), + 'schemaGroupName': self._serialize.url("schema_group_name", schema_group_name, 'str', max_length=256, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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.EventHub/namespaces/{namespaceName}/schemagroups/{schemaGroupName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + schema_group_name: str, + **kwargs: Any + ) -> "_models.SchemaGroup": + """get. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name. + :type namespace_name: str + :param schema_group_name: The Schema Group name. + :type schema_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SchemaGroup, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.SchemaGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SchemaGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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), + 'schemaGroupName': self._serialize.url("schema_group_name", schema_group_name, 'str', max_length=256, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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('SchemaGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/schemagroups/{schemaGroupName}'} # type: ignore diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/models/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/models/__init__.py new file mode 100644 index 000000000000..8e811e9ce424 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/models/__init__.py @@ -0,0 +1,213 @@ +# 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 ArmDisasterRecovery + from ._models_py3 import ArmDisasterRecoveryListResult + from ._models_py3 import AuthorizationRule + from ._models_py3 import AuthorizationRuleListResult + from ._models_py3 import AvailableCluster + from ._models_py3 import AvailableClustersList + from ._models_py3 import CaptureDescription + from ._models_py3 import CheckNameAvailabilityParameter + from ._models_py3 import CheckNameAvailabilityResult + from ._models_py3 import Cluster + from ._models_py3 import ClusterListResult + from ._models_py3 import ClusterQuotaConfigurationProperties + from ._models_py3 import ClusterSku + from ._models_py3 import ConnectionState + from ._models_py3 import ConsumerGroup + from ._models_py3 import ConsumerGroupListResult + from ._models_py3 import Destination + from ._models_py3 import EHNamespace + from ._models_py3 import EHNamespaceIdContainer + from ._models_py3 import EHNamespaceIdListResult + from ._models_py3 import EHNamespaceListResult + from ._models_py3 import Encryption + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse + from ._models_py3 import EventHubListResult + from ._models_py3 import Eventhub + from ._models_py3 import Identity + from ._models_py3 import KeyVaultProperties + 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 ProxyResource + from ._models_py3 import RegenerateAccessKeyParameters + from ._models_py3 import Resource + from ._models_py3 import SchemaGroup + from ._models_py3 import SchemaGroupListResult + from ._models_py3 import Sku + from ._models_py3 import Subnet + from ._models_py3 import SystemData + from ._models_py3 import TrackedResource + from ._models_py3 import UserAssignedIdentity + from ._models_py3 import UserAssignedIdentityProperties +except (SyntaxError, ImportError): + from ._models import AccessKeys # type: ignore + from ._models import ArmDisasterRecovery # type: ignore + from ._models import ArmDisasterRecoveryListResult # type: ignore + from ._models import AuthorizationRule # type: ignore + from ._models import AuthorizationRuleListResult # type: ignore + from ._models import AvailableCluster # type: ignore + from ._models import AvailableClustersList # type: ignore + from ._models import CaptureDescription # type: ignore + from ._models import CheckNameAvailabilityParameter # type: ignore + from ._models import CheckNameAvailabilityResult # type: ignore + from ._models import Cluster # type: ignore + from ._models import ClusterListResult # type: ignore + from ._models import ClusterQuotaConfigurationProperties # type: ignore + from ._models import ClusterSku # type: ignore + from ._models import ConnectionState # type: ignore + from ._models import ConsumerGroup # type: ignore + from ._models import ConsumerGroupListResult # type: ignore + from ._models import Destination # type: ignore + from ._models import EHNamespace # type: ignore + from ._models import EHNamespaceIdContainer # type: ignore + from ._models import EHNamespaceIdListResult # type: ignore + from ._models import EHNamespaceListResult # type: ignore + from ._models import Encryption # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import EventHubListResult # type: ignore + from ._models import Eventhub # type: ignore + from ._models import Identity # type: ignore + from ._models import KeyVaultProperties # 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 ProxyResource # type: ignore + from ._models import RegenerateAccessKeyParameters # type: ignore + from ._models import Resource # type: ignore + from ._models import SchemaGroup # type: ignore + from ._models import SchemaGroupListResult # type: ignore + from ._models import Sku # type: ignore + from ._models import Subnet # type: ignore + from ._models import SystemData # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import UserAssignedIdentity # type: ignore + from ._models import UserAssignedIdentityProperties # type: ignore + +from ._event_hub_management_client_enums import ( + AccessRights, + ClusterSkuName, + CreatedByType, + DefaultAction, + EncodingCaptureDescription, + EndPointProvisioningState, + EntityStatus, + KeyType, + ManagedServiceIdentityType, + NetworkRuleIPAction, + PrivateLinkConnectionStatus, + ProvisioningStateDR, + PublicNetworkAccessFlag, + RoleDisasterRecovery, + SchemaCompatibility, + SchemaType, + SkuName, + SkuTier, + UnavailableReason, +) + +__all__ = [ + 'AccessKeys', + 'ArmDisasterRecovery', + 'ArmDisasterRecoveryListResult', + 'AuthorizationRule', + 'AuthorizationRuleListResult', + 'AvailableCluster', + 'AvailableClustersList', + 'CaptureDescription', + 'CheckNameAvailabilityParameter', + 'CheckNameAvailabilityResult', + 'Cluster', + 'ClusterListResult', + 'ClusterQuotaConfigurationProperties', + 'ClusterSku', + 'ConnectionState', + 'ConsumerGroup', + 'ConsumerGroupListResult', + 'Destination', + 'EHNamespace', + 'EHNamespaceIdContainer', + 'EHNamespaceIdListResult', + 'EHNamespaceListResult', + 'Encryption', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'EventHubListResult', + 'Eventhub', + 'Identity', + 'KeyVaultProperties', + 'NWRuleSetIpRules', + 'NWRuleSetVirtualNetworkRules', + 'NetworkRuleSet', + 'NetworkRuleSetListResult', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionListResult', + 'PrivateLinkResource', + 'PrivateLinkResourcesListResult', + 'ProxyResource', + 'RegenerateAccessKeyParameters', + 'Resource', + 'SchemaGroup', + 'SchemaGroupListResult', + 'Sku', + 'Subnet', + 'SystemData', + 'TrackedResource', + 'UserAssignedIdentity', + 'UserAssignedIdentityProperties', + 'AccessRights', + 'ClusterSkuName', + 'CreatedByType', + 'DefaultAction', + 'EncodingCaptureDescription', + 'EndPointProvisioningState', + 'EntityStatus', + 'KeyType', + 'ManagedServiceIdentityType', + 'NetworkRuleIPAction', + 'PrivateLinkConnectionStatus', + 'ProvisioningStateDR', + 'PublicNetworkAccessFlag', + 'RoleDisasterRecovery', + 'SchemaCompatibility', + 'SchemaType', + 'SkuName', + 'SkuTier', + 'UnavailableReason', +] diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/models/_event_hub_management_client_enums.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/models/_event_hub_management_client_enums.py new file mode 100644 index 000000000000..0d17716db7ea --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/models/_event_hub_management_client_enums.py @@ -0,0 +1,182 @@ +# 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 ClusterSkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Name of this SKU. + """ + + DEDICATED = "Dedicated" + +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 EncodingCaptureDescription(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Enumerates the possible values for the encoding format of capture description. Note: + 'AvroDeflate' will be deprecated in New API Version + """ + + AVRO = "Avro" + AVRO_DEFLATE = "AvroDeflate" + +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)): + """Enumerates the possible values for the status of the Event Hub. + """ + + ACTIVE = "Active" + DISABLED = "Disabled" + RESTORING = "Restoring" + SEND_DISABLED = "SendDisabled" + RECEIVE_DISABLED = "ReceiveDisabled" + CREATING = "Creating" + DELETING = "Deleting" + RENAMING = "Renaming" + UNKNOWN = "Unknown" + +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 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 PublicNetworkAccessFlag(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """This determines if traffic is allowed over public network. By default it is enabled. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +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 SchemaCompatibility(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + NONE = "None" + BACKWARD = "Backward" + FORWARD = "Forward" + +class SchemaType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + UNKNOWN = "Unknown" + AVRO = "Avro" + +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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/models/_models.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/models/_models.py new file mode 100644 index 000000000000..7e691919b41c --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/models/_models.py @@ -0,0 +1,1974 @@ +# 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/EventHub 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 + AuthorizationRule. + :vartype primary_connection_string: str + :ivar secondary_connection_string: Secondary connection string of the created namespace + AuthorizationRule. + :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 AuthorizationRule. + :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 ProxyResource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + + +class ArmDisasterRecovery(ProxyResource): + """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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.eventhub.v2021_11_01.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.eventhub.v2021_11_01.models.ProvisioningStateDR + :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: Alternate name specified when alias and namespace names are same. + :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.eventhub.v2021_11_01.models.RoleDisasterRecovery + :ivar pending_replication_operations_count: Number of entities pending to be replicated. + :vartype pending_replication_operations_count: long + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'role': {'readonly': True}, + 'pending_replication_operations_count': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'partner_namespace': {'key': 'properties.partnerNamespace', 'type': 'str'}, + 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, + 'role': {'key': 'properties.role', 'type': 'str'}, + 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(ArmDisasterRecovery, self).__init__(**kwargs) + self.system_data = None + self.provisioning_state = None + self.partner_namespace = kwargs.get('partner_namespace', None) + self.alternate_name = kwargs.get('alternate_name', None) + self.role = None + self.pending_replication_operations_count = 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.eventhub.v2021_11_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 AuthorizationRule(ProxyResource): + """Single item in a List or Get AuthorizationRule operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.eventhub.v2021_11_01.models.SystemData + :param rights: The rights associated with the rule. + :type rights: list[str or ~azure.mgmt.eventhub.v2021_11_01.models.AccessRights] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'rights': {'key': 'properties.rights', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(AuthorizationRule, self).__init__(**kwargs) + self.system_data = None + self.rights = kwargs.get('rights', None) + + +class AuthorizationRuleListResult(msrest.serialization.Model): + """The response from the List namespace operation. + + :param value: Result of the List Authorization Rules operation. + :type value: list[~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule] + :param next_link: Link to the next set of results. Not empty if Value contains an incomplete + list of Authorization Rules. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AuthorizationRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AuthorizationRuleListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class AvailableCluster(msrest.serialization.Model): + """Pre-provisioned and readily available Event Hubs Cluster count per region. + + :param location: Location fo the Available Cluster. + :type location: str + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AvailableCluster, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + + +class AvailableClustersList(msrest.serialization.Model): + """The response of the List Available Clusters operation. + + :param value: The count of readily available and pre-provisioned Event Hubs Clusters per + region. + :type value: list[~azure.mgmt.eventhub.v2021_11_01.models.AvailableCluster] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AvailableCluster]'}, + } + + def __init__( + self, + **kwargs + ): + super(AvailableClustersList, self).__init__(**kwargs) + self.value = kwargs.get('value', 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. + Note: 'AvroDeflate' will be deprecated in New API Version. Possible values include: "Avro", + "AvroDeflate". + :type encoding: str or ~azure.mgmt.eventhub.v2021_11_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 to 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.eventhub.v2021_11_01.models.Destination + :param skip_empty_archives: A value that indicates whether to Skip Empty Archives. + :type skip_empty_archives: bool + """ + + _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'}, + 'skip_empty_archives': {'key': 'skipEmptyArchives', 'type': 'bool'}, + } + + 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) + self.skip_empty_archives = kwargs.get('skip_empty_archives', None) + + +class CheckNameAvailabilityParameter(msrest.serialization.Model): + """Parameter supplied to check Namespace name availability operation. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name to check the namespace name availability. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailabilityParameter, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class CheckNameAvailabilityResult(msrest.serialization.Model): + """The Result of the CheckNameAvailability operation. + + 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.eventhub.v2021_11_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 Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :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 TrackedResource(Resource): + """Definition of resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :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(TrackedResource, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class Cluster(TrackedResource): + """Single Event Hubs Cluster resource in List or Get operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :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 the cluster SKU. + :type sku: ~azure.mgmt.eventhub.v2021_11_01.models.ClusterSku + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.eventhub.v2021_11_01.models.SystemData + :ivar created_at: The UTC time when the Event Hubs Cluster was created. + :vartype created_at: str + :ivar updated_at: The UTC time when the Event Hubs Cluster was last updated. + :vartype updated_at: str + :ivar metric_id: The metric ID of the cluster resource. Provided by the service and not + modifiable by the user. + :vartype metric_id: str + :ivar status: Status of the Cluster resource. + :vartype status: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'metric_id': {'readonly': True}, + 'status': {'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': 'ClusterSku'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'str'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Cluster, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.system_data = None + self.created_at = None + self.updated_at = None + self.metric_id = None + self.status = None + + +class ClusterListResult(msrest.serialization.Model): + """The response of the List Event Hubs Clusters operation. + + :param value: The Event Hubs Clusters present in the List Event Hubs operation results. + :type value: list[~azure.mgmt.eventhub.v2021_11_01.models.Cluster] + :param next_link: Link to the next set of results. Empty unless the value parameter contains an + incomplete list of Event Hubs Clusters. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Cluster]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ClusterListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ClusterQuotaConfigurationProperties(msrest.serialization.Model): + """Contains all settings for the cluster. + + :param settings: All possible Cluster settings - a collection of key/value paired settings + which apply to quotas and configurations imposed on the cluster. + :type settings: dict[str, str] + """ + + _attribute_map = { + 'settings': {'key': 'settings', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(ClusterQuotaConfigurationProperties, self).__init__(**kwargs) + self.settings = kwargs.get('settings', None) + + +class ClusterSku(msrest.serialization.Model): + """SKU parameters particular to a cluster instance. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of this SKU. Possible values include: "Dedicated". + :type name: str or ~azure.mgmt.eventhub.v2021_11_01.models.ClusterSkuName + :param capacity: The quantity of Event Hubs Cluster Capacity Units contained in this cluster. + :type capacity: int + """ + + _validation = { + 'name': {'required': True}, + 'capacity': {'minimum': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(ClusterSku, self).__init__(**kwargs) + self.name = kwargs['name'] + self.capacity = kwargs.get('capacity', 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.eventhub.v2021_11_01.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 ConsumerGroup(ProxyResource): + """Single item in List or Get Consumer group operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.eventhub.v2021_11_01.models.SystemData + :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 + :param user_metadata: User Metadata is a placeholder to store user-defined string data with + maximum length 1024. e.g. it can be used to store descriptive data, such as list of teams and + their contact information also user-defined configuration settings can be stored. + :type user_metadata: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'system_data': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'user_metadata': {'key': 'properties.userMetadata', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ConsumerGroup, self).__init__(**kwargs) + self.system_data = None + self.created_at = None + self.updated_at = None + self.user_metadata = kwargs.get('user_metadata', None) + + +class ConsumerGroupListResult(msrest.serialization.Model): + """The result to the List Consumer Group operation. + + :param value: Result of the List Consumer Group operation. + :type value: list[~azure.mgmt.eventhub.v2021_11_01.models.ConsumerGroup] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Consumer Group. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ConsumerGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ConsumerGroupListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +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 + :param data_lake_subscription_id: Subscription Id of Azure Data Lake Store. + :type data_lake_subscription_id: str + :param data_lake_account_name: The Azure Data Lake Store name for the captured events. + :type data_lake_account_name: str + :param data_lake_folder_path: The destination folder path for the captured events. + :type data_lake_folder_path: 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'}, + 'data_lake_subscription_id': {'key': 'properties.dataLakeSubscriptionId', 'type': 'str'}, + 'data_lake_account_name': {'key': 'properties.dataLakeAccountName', 'type': 'str'}, + 'data_lake_folder_path': {'key': 'properties.dataLakeFolderPath', '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) + self.data_lake_subscription_id = kwargs.get('data_lake_subscription_id', None) + self.data_lake_account_name = kwargs.get('data_lake_account_name', None) + self.data_lake_folder_path = kwargs.get('data_lake_folder_path', None) + + +class EHNamespace(TrackedResource): + """Single Namespace item in List or Get Operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :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 resource. + :type sku: ~azure.mgmt.eventhub.v2021_11_01.models.Sku + :param identity: Properties of BYOK Identity description. + :type identity: ~azure.mgmt.eventhub.v2021_11_01.models.Identity + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.eventhub.v2021_11_01.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 + :param cluster_arm_id: Cluster ARM ID of the Namespace. + :type cluster_arm_id: str + :ivar metric_id: Identifier for Azure Insights metrics. + :vartype metric_id: str + :param is_auto_inflate_enabled: Value that indicates whether AutoInflate is enabled for + eventhub namespace. + :type is_auto_inflate_enabled: bool + :param maximum_throughput_units: Upper limit of throughput units when AutoInflate is enabled, + value should be within 0 to 20 throughput units. ( '0' if AutoInflateEnabled = true). + :type maximum_throughput_units: int + :param kafka_enabled: Value that indicates whether Kafka is enabled for eventhub namespace. + :type kafka_enabled: bool + :param zone_redundant: Enabling this property creates a Standard Event Hubs Namespace in + regions supported availability zones. + :type zone_redundant: bool + :param encryption: Properties of BYOK Encryption description. + :type encryption: ~azure.mgmt.eventhub.v2021_11_01.models.Encryption + :param private_endpoint_connections: List of private endpoint connections. + :type private_endpoint_connections: + list[~azure.mgmt.eventhub.v2021_11_01.models.PrivateEndpointConnection] + :param disable_local_auth: This property disables SAS authentication for the Event Hubs + namespace. + :type disable_local_auth: bool + :param alternate_name: Alternate name specified when alias and namespace names are same. + :type alternate_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': 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': 'Sku'}, + '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'}, + 'cluster_arm_id': {'key': 'properties.clusterArmId', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + 'is_auto_inflate_enabled': {'key': 'properties.isAutoInflateEnabled', 'type': 'bool'}, + 'maximum_throughput_units': {'key': 'properties.maximumThroughputUnits', 'type': 'int'}, + 'kafka_enabled': {'key': 'properties.kafkaEnabled', 'type': 'bool'}, + 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, + 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, + 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EHNamespace, 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.cluster_arm_id = kwargs.get('cluster_arm_id', None) + self.metric_id = None + self.is_auto_inflate_enabled = kwargs.get('is_auto_inflate_enabled', None) + self.maximum_throughput_units = kwargs.get('maximum_throughput_units', None) + self.kafka_enabled = kwargs.get('kafka_enabled', 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) + self.disable_local_auth = kwargs.get('disable_local_auth', None) + self.alternate_name = kwargs.get('alternate_name', None) + + +class EHNamespaceIdContainer(msrest.serialization.Model): + """The full ARM ID of an Event Hubs Namespace. + + :param id: id parameter. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EHNamespaceIdContainer, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class EHNamespaceIdListResult(msrest.serialization.Model): + """The response of the List Namespace IDs operation. + + :param value: Result of the List Namespace IDs operation. + :type value: list[~azure.mgmt.eventhub.v2021_11_01.models.EHNamespaceIdContainer] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EHNamespaceIdContainer]'}, + } + + def __init__( + self, + **kwargs + ): + super(EHNamespaceIdListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class EHNamespaceListResult(msrest.serialization.Model): + """The response of the List Namespace operation. + + :param value: Result of the List Namespace operation. + :type value: list[~azure.mgmt.eventhub.v2021_11_01.models.EHNamespace] + :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': '[EHNamespace]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EHNamespaceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class Encryption(msrest.serialization.Model): + """Properties to configure Encryption. + + :param key_vault_properties: Properties of KeyVault. + :type key_vault_properties: list[~azure.mgmt.eventhub.v2021_11_01.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 ErrorDetail(msrest.serialization.Model): + """The error detail. + + 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.eventhub.v2021_11_01.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.eventhub.v2021_11_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': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Error response indicates Event Hub service is not able to process the incoming request. The reason is provided in the error message. + + :param error: The error object. + :type error: ~azure.mgmt.eventhub.v2021_11_01.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class Eventhub(ProxyResource): + """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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.eventhub.v2021_11_01.models.SystemData + :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 the Event Hub. Possible values + include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", + "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.eventhub.v2021_11_01.models.EntityStatus + :param capture_description: Properties of capture description. + :type capture_description: ~azure.mgmt.eventhub.v2021_11_01.models.CaptureDescription + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'system_data': {'readonly': True}, + 'partition_ids': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'message_retention_in_days': {'minimum': 1}, + 'partition_count': {'minimum': 1}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + '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.system_data = None + 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. + + :param value: Result of the List EventHubs operation. + :type value: list[~azure.mgmt.eventhub.v2021_11_01.models.Eventhub] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of EventHubs. + :type next_link: str + """ + + _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 = kwargs.get('next_link', None) + + +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. + + :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.eventhub.v2021_11_01.models.ManagedServiceIdentityType + :param user_assigned_identities: Properties for User Assigned Identities. + :type user_assigned_identities: dict[str, + ~azure.mgmt.eventhub.v2021_11_01.models.UserAssignedIdentity] + """ + + _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': '{UserAssignedIdentity}'}, + } + + 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: Key Version. + :type key_version: str + :param identity: + :type identity: ~azure.mgmt.eventhub.v2021_11_01.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 NetworkRuleSet(ProxyResource): + """Description of topic resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.eventhub.v2021_11_01.models.SystemData + :param trusted_service_access_enabled: Value that indicates whether Trusted Service Access is + Enabled or not. + :type trusted_service_access_enabled: bool + :param default_action: Default Action for Network Rule Set. Possible values include: "Allow", + "Deny". + :type default_action: str or ~azure.mgmt.eventhub.v2021_11_01.models.DefaultAction + :param virtual_network_rules: List VirtualNetwork Rules. + :type virtual_network_rules: + list[~azure.mgmt.eventhub.v2021_11_01.models.NWRuleSetVirtualNetworkRules] + :param ip_rules: List of IpRules. + :type ip_rules: list[~azure.mgmt.eventhub.v2021_11_01.models.NWRuleSetIpRules] + :param public_network_access: This determines if traffic is allowed over public network. By + default it is enabled. Possible values include: "Enabled", "Disabled". Default value: + "Enabled". + :type public_network_access: str or + ~azure.mgmt.eventhub.v2021_11_01.models.PublicNetworkAccessFlag + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'trusted_service_access_enabled': {'key': 'properties.trustedServiceAccessEnabled', 'type': 'bool'}, + 'default_action': {'key': 'properties.defaultAction', 'type': 'str'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[NWRuleSetVirtualNetworkRules]'}, + 'ip_rules': {'key': 'properties.ipRules', 'type': '[NWRuleSetIpRules]'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkRuleSet, self).__init__(**kwargs) + self.system_data = None + self.trusted_service_access_enabled = kwargs.get('trusted_service_access_enabled', 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) + self.public_network_access = kwargs.get('public_network_access', "Enabled") + + +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.eventhub.v2021_11_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): + """The response from the List namespace operation. + + :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.eventhub.v2021_11_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', None) + + +class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): + """The response from the List namespace operation. + + :param subnet: Subnet properties. + :type subnet: ~azure.mgmt.eventhub.v2021_11_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 Event Hub 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 is_data_action: Indicates whether the operation is a data action. + :type is_data_action: bool + :param display: Display of the operation. + :type display: ~azure.mgmt.eventhub.v2021_11_01.models.OperationDisplay + :param origin: Origin of the operation. + :type origin: str + :param properties: Properties of the operation. + :type properties: any + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.is_data_action = kwargs.get('is_data_action', None) + self.display = kwargs.get('display', None) + self.origin = kwargs.get('origin', None) + self.properties = kwargs.get('properties', None) + + +class OperationDisplay(msrest.serialization.Model): + """Operation display payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Resource provider of the operation. + :vartype provider: str + :ivar resource: Resource of the operation. + :vartype resource: str + :ivar operation: Localized friendly name for the operation. + :vartype operation: str + :ivar description: Localized friendly description for the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Event Hub 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 Event Hub operations supported by the Microsoft.EventHub resource + provider. + :vartype value: list[~azure.mgmt.eventhub.v2021_11_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 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(ProxyResource): + """Properties of the PrivateEndpointConnection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.eventhub.v2021_11_01.models.SystemData + :param private_endpoint: The Private Endpoint resource for this Connection. + :type private_endpoint: ~azure.mgmt.eventhub.v2021_11_01.models.PrivateEndpoint + :param private_link_service_connection_state: Details about the state of the connection. + :type private_link_service_connection_state: + ~azure.mgmt.eventhub.v2021_11_01.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.eventhub.v2021_11_01.models.EndPointProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', '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.eventhub.v2021_11_01.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: The private link resource group id. + :type group_id: str + :param required_members: The private link resource required member names. + :type required_members: list[str] + :param required_zone_names: The private link resource Private link DNS zone name. + :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.eventhub.v2021_11_01.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.eventhub.v2021_11_01.models.KeyType + :param key: Optional, if the key value provided, is set for KeyType or autogenerated 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 SchemaGroup(ProxyResource): + """Single item in List or Get Schema Group operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.eventhub.v2021_11_01.models.SystemData + :ivar updated_at_utc: Exact time the Schema Group was updated. + :vartype updated_at_utc: ~datetime.datetime + :ivar created_at_utc: Exact time the Schema Group was created. + :vartype created_at_utc: ~datetime.datetime + :ivar e_tag: The ETag value. + :vartype e_tag: str + :param group_properties: dictionary object for SchemaGroup group properties. + :type group_properties: dict[str, str] + :param schema_compatibility: Possible values include: "None", "Backward", "Forward". + :type schema_compatibility: str or ~azure.mgmt.eventhub.v2021_11_01.models.SchemaCompatibility + :param schema_type: Possible values include: "Unknown", "Avro". + :type schema_type: str or ~azure.mgmt.eventhub.v2021_11_01.models.SchemaType + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'system_data': {'readonly': True}, + 'updated_at_utc': {'readonly': True}, + 'created_at_utc': {'readonly': True}, + 'e_tag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'updated_at_utc': {'key': 'properties.updatedAtUtc', 'type': 'iso-8601'}, + 'created_at_utc': {'key': 'properties.createdAtUtc', 'type': 'iso-8601'}, + 'e_tag': {'key': 'properties.eTag', 'type': 'str'}, + 'group_properties': {'key': 'properties.groupProperties', 'type': '{str}'}, + 'schema_compatibility': {'key': 'properties.schemaCompatibility', 'type': 'str'}, + 'schema_type': {'key': 'properties.schemaType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SchemaGroup, self).__init__(**kwargs) + self.system_data = None + self.updated_at_utc = None + self.created_at_utc = None + self.e_tag = None + self.group_properties = kwargs.get('group_properties', None) + self.schema_compatibility = kwargs.get('schema_compatibility', None) + self.schema_type = kwargs.get('schema_type', None) + + +class SchemaGroupListResult(msrest.serialization.Model): + """The result of the List SchemaGroup operation. + + :param value: Result of the List SchemaGroups operation. + :type value: list[~azure.mgmt.eventhub.v2021_11_01.models.SchemaGroup] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Schema Groups. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SchemaGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SchemaGroupListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class Sku(msrest.serialization.Model): + """SKU parameters supplied to the create namespace operation. + + 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.eventhub.v2021_11_01.models.SkuName + :param tier: The billing tier of this particular SKU. Possible values include: "Basic", + "Standard", "Premium". + :type tier: str or ~azure.mgmt.eventhub.v2021_11_01.models.SkuTier + :param capacity: The Event Hubs throughput units for Basic or Standard tiers, where value + should be 0 to 20 throughput units. The Event Hubs premium units for Premium tier, where value + should be 0 to 10 premium units. + :type capacity: int + """ + + _validation = { + 'name': {'required': True}, + 'capacity': {'minimum': 0}, + } + + _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['name'] + self.tier = kwargs.get('tier', None) + self.capacity = kwargs.get('capacity', None) + + +class Subnet(msrest.serialization.Model): + """Properties supplied for Subnet. + + :param id: Resource ID of Virtual Network Subnet. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Subnet, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +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.eventhub.v2021_11_01.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.eventhub.v2021_11_01.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 UserAssignedIdentity(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(UserAssignedIdentity, self).__init__(**kwargs) + self.principal_id = None + self.client_id = 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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/models/_models_py3.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/models/_models_py3.py new file mode 100644 index 000000000000..582f81410405 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/models/_models_py3.py @@ -0,0 +1,2143 @@ +# 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 Any, Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._event_hub_management_client_enums import * + + +class AccessKeys(msrest.serialization.Model): + """Namespace/EventHub 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 + AuthorizationRule. + :vartype primary_connection_string: str + :ivar secondary_connection_string: Secondary connection string of the created namespace + AuthorizationRule. + :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 AuthorizationRule. + :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 ProxyResource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + + +class ArmDisasterRecovery(ProxyResource): + """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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.eventhub.v2021_11_01.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.eventhub.v2021_11_01.models.ProvisioningStateDR + :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: Alternate name specified when alias and namespace names are same. + :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.eventhub.v2021_11_01.models.RoleDisasterRecovery + :ivar pending_replication_operations_count: Number of entities pending to be replicated. + :vartype pending_replication_operations_count: long + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'role': {'readonly': True}, + 'pending_replication_operations_count': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'partner_namespace': {'key': 'properties.partnerNamespace', 'type': 'str'}, + 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, + 'role': {'key': 'properties.role', 'type': 'str'}, + 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, + } + + 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.partner_namespace = partner_namespace + self.alternate_name = alternate_name + self.role = None + self.pending_replication_operations_count = 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.eventhub.v2021_11_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 AuthorizationRule(ProxyResource): + """Single item in a List or Get AuthorizationRule operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.eventhub.v2021_11_01.models.SystemData + :param rights: The rights associated with the rule. + :type rights: list[str or ~azure.mgmt.eventhub.v2021_11_01.models.AccessRights] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', '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(AuthorizationRule, self).__init__(**kwargs) + self.system_data = None + self.rights = rights + + +class AuthorizationRuleListResult(msrest.serialization.Model): + """The response from the List namespace operation. + + :param value: Result of the List Authorization Rules operation. + :type value: list[~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule] + :param next_link: Link to the next set of results. Not empty if Value contains an incomplete + list of Authorization Rules. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AuthorizationRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["AuthorizationRule"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(AuthorizationRuleListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AvailableCluster(msrest.serialization.Model): + """Pre-provisioned and readily available Event Hubs Cluster count per region. + + :param location: Location fo the Available Cluster. + :type location: str + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + **kwargs + ): + super(AvailableCluster, self).__init__(**kwargs) + self.location = location + + +class AvailableClustersList(msrest.serialization.Model): + """The response of the List Available Clusters operation. + + :param value: The count of readily available and pre-provisioned Event Hubs Clusters per + region. + :type value: list[~azure.mgmt.eventhub.v2021_11_01.models.AvailableCluster] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AvailableCluster]'}, + } + + def __init__( + self, + *, + value: Optional[List["AvailableCluster"]] = None, + **kwargs + ): + super(AvailableClustersList, self).__init__(**kwargs) + self.value = value + + +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. + Note: 'AvroDeflate' will be deprecated in New API Version. Possible values include: "Avro", + "AvroDeflate". + :type encoding: str or ~azure.mgmt.eventhub.v2021_11_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 to 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.eventhub.v2021_11_01.models.Destination + :param skip_empty_archives: A value that indicates whether to Skip Empty Archives. + :type skip_empty_archives: bool + """ + + _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'}, + 'skip_empty_archives': {'key': 'skipEmptyArchives', 'type': 'bool'}, + } + + 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, + skip_empty_archives: Optional[bool] = 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 + self.skip_empty_archives = skip_empty_archives + + +class CheckNameAvailabilityParameter(msrest.serialization.Model): + """Parameter supplied to check Namespace name availability operation. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name to check the namespace name availability. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(CheckNameAvailabilityParameter, self).__init__(**kwargs) + self.name = name + + +class CheckNameAvailabilityResult(msrest.serialization.Model): + """The Result of the CheckNameAvailability operation. + + 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.eventhub.v2021_11_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 Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :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 TrackedResource(Resource): + """Definition of resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :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(TrackedResource, self).__init__(**kwargs) + self.location = location + self.tags = tags + + +class Cluster(TrackedResource): + """Single Event Hubs Cluster resource in List or Get operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :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 the cluster SKU. + :type sku: ~azure.mgmt.eventhub.v2021_11_01.models.ClusterSku + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.eventhub.v2021_11_01.models.SystemData + :ivar created_at: The UTC time when the Event Hubs Cluster was created. + :vartype created_at: str + :ivar updated_at: The UTC time when the Event Hubs Cluster was last updated. + :vartype updated_at: str + :ivar metric_id: The metric ID of the cluster resource. Provided by the service and not + modifiable by the user. + :vartype metric_id: str + :ivar status: Status of the Cluster resource. + :vartype status: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'metric_id': {'readonly': True}, + 'status': {'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': 'ClusterSku'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'str'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["ClusterSku"] = None, + **kwargs + ): + super(Cluster, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.system_data = None + self.created_at = None + self.updated_at = None + self.metric_id = None + self.status = None + + +class ClusterListResult(msrest.serialization.Model): + """The response of the List Event Hubs Clusters operation. + + :param value: The Event Hubs Clusters present in the List Event Hubs operation results. + :type value: list[~azure.mgmt.eventhub.v2021_11_01.models.Cluster] + :param next_link: Link to the next set of results. Empty unless the value parameter contains an + incomplete list of Event Hubs Clusters. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Cluster]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Cluster"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ClusterListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ClusterQuotaConfigurationProperties(msrest.serialization.Model): + """Contains all settings for the cluster. + + :param settings: All possible Cluster settings - a collection of key/value paired settings + which apply to quotas and configurations imposed on the cluster. + :type settings: dict[str, str] + """ + + _attribute_map = { + 'settings': {'key': 'settings', 'type': '{str}'}, + } + + def __init__( + self, + *, + settings: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ClusterQuotaConfigurationProperties, self).__init__(**kwargs) + self.settings = settings + + +class ClusterSku(msrest.serialization.Model): + """SKU parameters particular to a cluster instance. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of this SKU. Possible values include: "Dedicated". + :type name: str or ~azure.mgmt.eventhub.v2021_11_01.models.ClusterSkuName + :param capacity: The quantity of Event Hubs Cluster Capacity Units contained in this cluster. + :type capacity: int + """ + + _validation = { + 'name': {'required': True}, + 'capacity': {'minimum': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + *, + name: Union[str, "ClusterSkuName"], + capacity: Optional[int] = None, + **kwargs + ): + super(ClusterSku, self).__init__(**kwargs) + self.name = name + self.capacity = capacity + + +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.eventhub.v2021_11_01.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 ConsumerGroup(ProxyResource): + """Single item in List or Get Consumer group operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.eventhub.v2021_11_01.models.SystemData + :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 + :param user_metadata: User Metadata is a placeholder to store user-defined string data with + maximum length 1024. e.g. it can be used to store descriptive data, such as list of teams and + their contact information also user-defined configuration settings can be stored. + :type user_metadata: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'system_data': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'user_metadata': {'key': 'properties.userMetadata', 'type': 'str'}, + } + + def __init__( + self, + *, + user_metadata: Optional[str] = None, + **kwargs + ): + super(ConsumerGroup, self).__init__(**kwargs) + self.system_data = None + self.created_at = None + self.updated_at = None + self.user_metadata = user_metadata + + +class ConsumerGroupListResult(msrest.serialization.Model): + """The result to the List Consumer Group operation. + + :param value: Result of the List Consumer Group operation. + :type value: list[~azure.mgmt.eventhub.v2021_11_01.models.ConsumerGroup] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Consumer Group. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ConsumerGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ConsumerGroup"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ConsumerGroupListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +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 + :param data_lake_subscription_id: Subscription Id of Azure Data Lake Store. + :type data_lake_subscription_id: str + :param data_lake_account_name: The Azure Data Lake Store name for the captured events. + :type data_lake_account_name: str + :param data_lake_folder_path: The destination folder path for the captured events. + :type data_lake_folder_path: 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'}, + 'data_lake_subscription_id': {'key': 'properties.dataLakeSubscriptionId', 'type': 'str'}, + 'data_lake_account_name': {'key': 'properties.dataLakeAccountName', 'type': 'str'}, + 'data_lake_folder_path': {'key': 'properties.dataLakeFolderPath', '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, + data_lake_subscription_id: Optional[str] = None, + data_lake_account_name: Optional[str] = None, + data_lake_folder_path: 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 + self.data_lake_subscription_id = data_lake_subscription_id + self.data_lake_account_name = data_lake_account_name + self.data_lake_folder_path = data_lake_folder_path + + +class EHNamespace(TrackedResource): + """Single Namespace item in List or Get Operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :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 resource. + :type sku: ~azure.mgmt.eventhub.v2021_11_01.models.Sku + :param identity: Properties of BYOK Identity description. + :type identity: ~azure.mgmt.eventhub.v2021_11_01.models.Identity + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.eventhub.v2021_11_01.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 + :param cluster_arm_id: Cluster ARM ID of the Namespace. + :type cluster_arm_id: str + :ivar metric_id: Identifier for Azure Insights metrics. + :vartype metric_id: str + :param is_auto_inflate_enabled: Value that indicates whether AutoInflate is enabled for + eventhub namespace. + :type is_auto_inflate_enabled: bool + :param maximum_throughput_units: Upper limit of throughput units when AutoInflate is enabled, + value should be within 0 to 20 throughput units. ( '0' if AutoInflateEnabled = true). + :type maximum_throughput_units: int + :param kafka_enabled: Value that indicates whether Kafka is enabled for eventhub namespace. + :type kafka_enabled: bool + :param zone_redundant: Enabling this property creates a Standard Event Hubs Namespace in + regions supported availability zones. + :type zone_redundant: bool + :param encryption: Properties of BYOK Encryption description. + :type encryption: ~azure.mgmt.eventhub.v2021_11_01.models.Encryption + :param private_endpoint_connections: List of private endpoint connections. + :type private_endpoint_connections: + list[~azure.mgmt.eventhub.v2021_11_01.models.PrivateEndpointConnection] + :param disable_local_auth: This property disables SAS authentication for the Event Hubs + namespace. + :type disable_local_auth: bool + :param alternate_name: Alternate name specified when alias and namespace names are same. + :type alternate_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': 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': 'Sku'}, + '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'}, + 'cluster_arm_id': {'key': 'properties.clusterArmId', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + 'is_auto_inflate_enabled': {'key': 'properties.isAutoInflateEnabled', 'type': 'bool'}, + 'maximum_throughput_units': {'key': 'properties.maximumThroughputUnits', 'type': 'int'}, + 'kafka_enabled': {'key': 'properties.kafkaEnabled', 'type': 'bool'}, + 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, + 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'}, + 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["Sku"] = None, + identity: Optional["Identity"] = None, + cluster_arm_id: Optional[str] = None, + is_auto_inflate_enabled: Optional[bool] = None, + maximum_throughput_units: Optional[int] = None, + kafka_enabled: Optional[bool] = None, + zone_redundant: Optional[bool] = None, + encryption: Optional["Encryption"] = None, + private_endpoint_connections: Optional[List["PrivateEndpointConnection"]] = None, + disable_local_auth: Optional[bool] = None, + alternate_name: Optional[str] = None, + **kwargs + ): + super(EHNamespace, 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.cluster_arm_id = cluster_arm_id + self.metric_id = None + self.is_auto_inflate_enabled = is_auto_inflate_enabled + self.maximum_throughput_units = maximum_throughput_units + self.kafka_enabled = kafka_enabled + self.zone_redundant = zone_redundant + self.encryption = encryption + self.private_endpoint_connections = private_endpoint_connections + self.disable_local_auth = disable_local_auth + self.alternate_name = alternate_name + + +class EHNamespaceIdContainer(msrest.serialization.Model): + """The full ARM ID of an Event Hubs Namespace. + + :param id: id parameter. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + super(EHNamespaceIdContainer, self).__init__(**kwargs) + self.id = id + + +class EHNamespaceIdListResult(msrest.serialization.Model): + """The response of the List Namespace IDs operation. + + :param value: Result of the List Namespace IDs operation. + :type value: list[~azure.mgmt.eventhub.v2021_11_01.models.EHNamespaceIdContainer] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EHNamespaceIdContainer]'}, + } + + def __init__( + self, + *, + value: Optional[List["EHNamespaceIdContainer"]] = None, + **kwargs + ): + super(EHNamespaceIdListResult, self).__init__(**kwargs) + self.value = value + + +class EHNamespaceListResult(msrest.serialization.Model): + """The response of the List Namespace operation. + + :param value: Result of the List Namespace operation. + :type value: list[~azure.mgmt.eventhub.v2021_11_01.models.EHNamespace] + :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': '[EHNamespace]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["EHNamespace"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(EHNamespaceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class Encryption(msrest.serialization.Model): + """Properties to configure Encryption. + + :param key_vault_properties: Properties of KeyVault. + :type key_vault_properties: list[~azure.mgmt.eventhub.v2021_11_01.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 ErrorDetail(msrest.serialization.Model): + """The error detail. + + 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.eventhub.v2021_11_01.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.eventhub.v2021_11_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': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Error response indicates Event Hub service is not able to process the incoming request. The reason is provided in the error message. + + :param error: The error object. + :type error: ~azure.mgmt.eventhub.v2021_11_01.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class Eventhub(ProxyResource): + """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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.eventhub.v2021_11_01.models.SystemData + :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 the Event Hub. Possible values + include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", + "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.eventhub.v2021_11_01.models.EntityStatus + :param capture_description: Properties of capture description. + :type capture_description: ~azure.mgmt.eventhub.v2021_11_01.models.CaptureDescription + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'system_data': {'readonly': True}, + 'partition_ids': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'message_retention_in_days': {'minimum': 1}, + 'partition_count': {'minimum': 1}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + '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.system_data = None + 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. + + :param value: Result of the List EventHubs operation. + :type value: list[~azure.mgmt.eventhub.v2021_11_01.models.Eventhub] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of EventHubs. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Eventhub]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Eventhub"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(EventHubListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +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. + + :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.eventhub.v2021_11_01.models.ManagedServiceIdentityType + :param user_assigned_identities: Properties for User Assigned Identities. + :type user_assigned_identities: dict[str, + ~azure.mgmt.eventhub.v2021_11_01.models.UserAssignedIdentity] + """ + + _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': '{UserAssignedIdentity}'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ManagedServiceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = 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: Key Version. + :type key_version: str + :param identity: + :type identity: ~azure.mgmt.eventhub.v2021_11_01.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 NetworkRuleSet(ProxyResource): + """Description of topic resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.eventhub.v2021_11_01.models.SystemData + :param trusted_service_access_enabled: Value that indicates whether Trusted Service Access is + Enabled or not. + :type trusted_service_access_enabled: bool + :param default_action: Default Action for Network Rule Set. Possible values include: "Allow", + "Deny". + :type default_action: str or ~azure.mgmt.eventhub.v2021_11_01.models.DefaultAction + :param virtual_network_rules: List VirtualNetwork Rules. + :type virtual_network_rules: + list[~azure.mgmt.eventhub.v2021_11_01.models.NWRuleSetVirtualNetworkRules] + :param ip_rules: List of IpRules. + :type ip_rules: list[~azure.mgmt.eventhub.v2021_11_01.models.NWRuleSetIpRules] + :param public_network_access: This determines if traffic is allowed over public network. By + default it is enabled. Possible values include: "Enabled", "Disabled". Default value: + "Enabled". + :type public_network_access: str or + ~azure.mgmt.eventhub.v2021_11_01.models.PublicNetworkAccessFlag + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'trusted_service_access_enabled': {'key': 'properties.trustedServiceAccessEnabled', 'type': 'bool'}, + 'default_action': {'key': 'properties.defaultAction', 'type': 'str'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[NWRuleSetVirtualNetworkRules]'}, + 'ip_rules': {'key': 'properties.ipRules', 'type': '[NWRuleSetIpRules]'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + *, + trusted_service_access_enabled: Optional[bool] = None, + default_action: Optional[Union[str, "DefaultAction"]] = None, + virtual_network_rules: Optional[List["NWRuleSetVirtualNetworkRules"]] = None, + ip_rules: Optional[List["NWRuleSetIpRules"]] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccessFlag"]] = "Enabled", + **kwargs + ): + super(NetworkRuleSet, self).__init__(**kwargs) + self.system_data = None + self.trusted_service_access_enabled = trusted_service_access_enabled + self.default_action = default_action + self.virtual_network_rules = virtual_network_rules + self.ip_rules = ip_rules + self.public_network_access = public_network_access + + +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.eventhub.v2021_11_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): + """The response from the List namespace operation. + + :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.eventhub.v2021_11_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"]] = None, + **kwargs + ): + super(NWRuleSetIpRules, self).__init__(**kwargs) + self.ip_mask = ip_mask + self.action = action + + +class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): + """The response from the List namespace operation. + + :param subnet: Subnet properties. + :type subnet: ~azure.mgmt.eventhub.v2021_11_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 Event Hub 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 is_data_action: Indicates whether the operation is a data action. + :type is_data_action: bool + :param display: Display of the operation. + :type display: ~azure.mgmt.eventhub.v2021_11_01.models.OperationDisplay + :param origin: Origin of the operation. + :type origin: str + :param properties: Properties of the operation. + :type properties: any + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'object'}, + } + + def __init__( + self, + *, + is_data_action: Optional[bool] = None, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + properties: Optional[Any] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.is_data_action = is_data_action + self.display = display + self.origin = origin + self.properties = properties + + +class OperationDisplay(msrest.serialization.Model): + """Operation display payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Resource provider of the operation. + :vartype provider: str + :ivar resource: Resource of the operation. + :vartype resource: str + :ivar operation: Localized friendly name for the operation. + :vartype operation: str + :ivar description: Localized friendly description for the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Event Hub 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 Event Hub operations supported by the Microsoft.EventHub resource + provider. + :vartype value: list[~azure.mgmt.eventhub.v2021_11_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 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(ProxyResource): + """Properties of the PrivateEndpointConnection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.eventhub.v2021_11_01.models.SystemData + :param private_endpoint: The Private Endpoint resource for this Connection. + :type private_endpoint: ~azure.mgmt.eventhub.v2021_11_01.models.PrivateEndpoint + :param private_link_service_connection_state: Details about the state of the connection. + :type private_link_service_connection_state: + ~azure.mgmt.eventhub.v2021_11_01.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.eventhub.v2021_11_01.models.EndPointProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', '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.eventhub.v2021_11_01.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: The private link resource group id. + :type group_id: str + :param required_members: The private link resource required member names. + :type required_members: list[str] + :param required_zone_names: The private link resource Private link DNS zone name. + :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.eventhub.v2021_11_01.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.eventhub.v2021_11_01.models.KeyType + :param key: Optional, if the key value provided, is set for KeyType or autogenerated 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 SchemaGroup(ProxyResource): + """Single item in List or Get Schema Group operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or + "Microsoft.EventHub/Namespaces/EventHubs". + :vartype type: str + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.eventhub.v2021_11_01.models.SystemData + :ivar updated_at_utc: Exact time the Schema Group was updated. + :vartype updated_at_utc: ~datetime.datetime + :ivar created_at_utc: Exact time the Schema Group was created. + :vartype created_at_utc: ~datetime.datetime + :ivar e_tag: The ETag value. + :vartype e_tag: str + :param group_properties: dictionary object for SchemaGroup group properties. + :type group_properties: dict[str, str] + :param schema_compatibility: Possible values include: "None", "Backward", "Forward". + :type schema_compatibility: str or ~azure.mgmt.eventhub.v2021_11_01.models.SchemaCompatibility + :param schema_type: Possible values include: "Unknown", "Avro". + :type schema_type: str or ~azure.mgmt.eventhub.v2021_11_01.models.SchemaType + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'system_data': {'readonly': True}, + 'updated_at_utc': {'readonly': True}, + 'created_at_utc': {'readonly': True}, + 'e_tag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'updated_at_utc': {'key': 'properties.updatedAtUtc', 'type': 'iso-8601'}, + 'created_at_utc': {'key': 'properties.createdAtUtc', 'type': 'iso-8601'}, + 'e_tag': {'key': 'properties.eTag', 'type': 'str'}, + 'group_properties': {'key': 'properties.groupProperties', 'type': '{str}'}, + 'schema_compatibility': {'key': 'properties.schemaCompatibility', 'type': 'str'}, + 'schema_type': {'key': 'properties.schemaType', 'type': 'str'}, + } + + def __init__( + self, + *, + group_properties: Optional[Dict[str, str]] = None, + schema_compatibility: Optional[Union[str, "SchemaCompatibility"]] = None, + schema_type: Optional[Union[str, "SchemaType"]] = None, + **kwargs + ): + super(SchemaGroup, self).__init__(**kwargs) + self.system_data = None + self.updated_at_utc = None + self.created_at_utc = None + self.e_tag = None + self.group_properties = group_properties + self.schema_compatibility = schema_compatibility + self.schema_type = schema_type + + +class SchemaGroupListResult(msrest.serialization.Model): + """The result of the List SchemaGroup operation. + + :param value: Result of the List SchemaGroups operation. + :type value: list[~azure.mgmt.eventhub.v2021_11_01.models.SchemaGroup] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Schema Groups. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SchemaGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SchemaGroup"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SchemaGroupListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class Sku(msrest.serialization.Model): + """SKU parameters supplied to the create namespace operation. + + 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.eventhub.v2021_11_01.models.SkuName + :param tier: The billing tier of this particular SKU. Possible values include: "Basic", + "Standard", "Premium". + :type tier: str or ~azure.mgmt.eventhub.v2021_11_01.models.SkuTier + :param capacity: The Event Hubs throughput units for Basic or Standard tiers, where value + should be 0 to 20 throughput units. The Event Hubs premium units for Premium tier, where value + should be 0 to 10 premium units. + :type capacity: int + """ + + _validation = { + 'name': {'required': True}, + 'capacity': {'minimum': 0}, + } + + _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(Sku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.capacity = capacity + + +class Subnet(msrest.serialization.Model): + """Properties supplied for Subnet. + + :param id: Resource ID of Virtual Network Subnet. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **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.eventhub.v2021_11_01.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.eventhub.v2021_11_01.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 UserAssignedIdentity(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(UserAssignedIdentity, self).__init__(**kwargs) + self.principal_id = None + self.client_id = 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, + *, + user_assigned_identity: Optional[str] = None, + **kwargs + ): + super(UserAssignedIdentityProperties, self).__init__(**kwargs) + self.user_assigned_identity = user_assigned_identity diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/__init__.py new file mode 100644 index 000000000000..84e125803ca8 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/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 ._clusters_operations import ClustersOperations +from ._configuration_operations import ConfigurationOperations +from ._namespaces_operations import NamespacesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._operations import Operations +from ._event_hubs_operations import EventHubsOperations +from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations +from ._consumer_groups_operations import ConsumerGroupsOperations +from ._schema_registry_operations import SchemaRegistryOperations + +__all__ = [ + 'ClustersOperations', + 'ConfigurationOperations', + 'NamespacesOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'Operations', + 'EventHubsOperations', + 'DisasterRecoveryConfigsOperations', + 'ConsumerGroupsOperations', + 'SchemaRegistryOperations', +] diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_clusters_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_clusters_operations.py new file mode 100644 index 000000000000..aaea31fbd1aa --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_clusters_operations.py @@ -0,0 +1,735 @@ +# 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 ClustersOperations(object): + """ClustersOperations 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.eventhub.v2021_11_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_available_cluster_region( + self, + **kwargs # type: Any + ): + # type: (...) -> "_models.AvailableClustersList" + """List the quantity of available pre-provisioned Event Hubs Clusters, indexed by Azure region. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailableClustersList, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AvailableClustersList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableClustersList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-01" + accept = "application/json" + + # Construct URL + url = self.list_available_cluster_region.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['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('AvailableClustersList', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_available_cluster_region.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventHub/availableClusterRegions'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ClusterListResult"] + """Lists the available Event Hubs Clusters within an ARM resource group. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ClusterListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventhub.v2021_11_01.models.ClusterListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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('ClusterListResult', 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_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventHub/clusters'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ClusterListResult"] + """Lists the available Event Hubs Clusters within an ARM 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 ClusterListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventhub.v2021_11_01.models.ClusterListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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 = { + '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), + } + url = self._client.format_url(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('ClusterListResult', 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.EventHub/clusters'} # type: ignore + + def get( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Cluster" + """Gets the resource description of the specified Event Hubs Cluster. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param cluster_name: The name of the Event Hubs Cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Cluster, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.Cluster + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-01" + accept = "application/json" + + # Construct URL + url = self.get.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), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=50, min_length=6), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + parameters, # type: "_models.Cluster" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.Cluster"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Cluster"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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 = { + '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), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=50, min_length=6), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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, 'Cluster') + 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('Cluster', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + cluster_name, # type: str + parameters, # type: "_models.Cluster" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Cluster"] + """Creates or updates an instance of an Event Hubs Cluster. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param cluster_name: The name of the Event Hubs Cluster. + :type cluster_name: str + :param parameters: Parameters for creating a eventhub cluster resource. + :type parameters: ~azure.mgmt.eventhub.v2021_11_01.models.Cluster + :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 Cluster or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventhub.v2021_11_01.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + 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, + cluster_name=cluster_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('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=50, min_length=6), + } + + 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.EventHub/clusters/{clusterName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + parameters, # type: "_models.Cluster" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.Cluster"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Cluster"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.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), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=50, min_length=6), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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, 'Cluster') + 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('Cluster', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + cluster_name, # type: str + parameters, # type: "_models.Cluster" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Cluster"] + """Modifies mutable properties on the Event Hubs Cluster. This operation is idempotent. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param cluster_name: The name of the Event Hubs Cluster. + :type cluster_name: str + :param parameters: The properties of the Event Hubs Cluster which should be updated. + :type parameters: ~azure.mgmt.eventhub.v2021_11_01.models.Cluster + :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 Cluster or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventhub.v2021_11_01.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + 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._update_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_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('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=50, min_length=6), + } + + 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_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + cluster_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-11-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.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), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=50, min_length=6), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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.EventHub/clusters/{clusterName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes an existing Event Hubs Cluster. This operation is idempotent. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param cluster_name: The name of the Event Hubs Cluster. + :type cluster_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, + cluster_name=cluster_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 = { + '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), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=50, min_length=6), + } + + 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.EventHub/clusters/{clusterName}'} # type: ignore + + def list_namespaces( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.EHNamespaceIdListResult" + """List all Event Hubs Namespace IDs in an Event Hubs Dedicated Cluster. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param cluster_name: The name of the Event Hubs Cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EHNamespaceIdListResult, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.EHNamespaceIdListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EHNamespaceIdListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-01" + accept = "application/json" + + # Construct URL + url = self.list_namespaces.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), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=50, min_length=6), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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('EHNamespaceIdListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_namespaces.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}/namespaces'} # type: ignore diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_configuration_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_configuration_operations.py new file mode 100644 index 000000000000..fa8d014a0201 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_configuration_operations.py @@ -0,0 +1,180 @@ +# 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, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ConfigurationOperations(object): + """ConfigurationOperations 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.eventhub.v2021_11_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 patch( + self, + resource_group_name, # type: str + cluster_name, # type: str + parameters, # type: "_models.ClusterQuotaConfigurationProperties" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.ClusterQuotaConfigurationProperties"] + """Replace all specified Event Hubs Cluster settings with those contained in the request body. + Leaves the settings not specified in the request body unmodified. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param cluster_name: The name of the Event Hubs Cluster. + :type cluster_name: str + :param parameters: Parameters for creating an Event Hubs Cluster resource. + :type parameters: ~azure.mgmt.eventhub.v2021_11_01.models.ClusterQuotaConfigurationProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ClusterQuotaConfigurationProperties, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.ClusterQuotaConfigurationProperties or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ClusterQuotaConfigurationProperties"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.patch.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), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=50, min_length=6), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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, 'ClusterQuotaConfigurationProperties') + 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('ClusterQuotaConfigurationProperties', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ClusterQuotaConfigurationProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}/quotaConfiguration/default'} # type: ignore + + def get( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ClusterQuotaConfigurationProperties" + """Get all Event Hubs Cluster settings - a collection of key/value pairs which represent the + quotas and settings imposed on the cluster. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param cluster_name: The name of the Event Hubs Cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ClusterQuotaConfigurationProperties, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.ClusterQuotaConfigurationProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterQuotaConfigurationProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-01" + accept = "application/json" + + # Construct URL + url = self.get.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), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str', max_length=50, min_length=6), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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('ClusterQuotaConfigurationProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}/quotaConfiguration/default'} # type: ignore diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_consumer_groups_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_consumer_groups_operations.py new file mode 100644 index 000000000000..a69040bbbc1e --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_consumer_groups_operations.py @@ -0,0 +1,348 @@ +# 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 ConsumerGroupsOperations(object): + """ConsumerGroupsOperations 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.eventhub.v2021_11_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 create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + event_hub_name, # type: str + consumer_group_name, # type: str + parameters, # type: "_models.ConsumerGroup" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConsumerGroup" + """Creates or updates an Event Hubs consumer group as a nested resource 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 event_hub_name: The Event Hub name. + :type event_hub_name: str + :param consumer_group_name: The consumer group name. + :type consumer_group_name: str + :param parameters: Parameters supplied to create or update a consumer group resource. + :type parameters: ~azure.mgmt.eventhub.v2021_11_01.models.ConsumerGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConsumerGroup, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.ConsumerGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConsumerGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'consumerGroupName': self._serialize.url("consumer_group_name", consumer_group_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, 'ConsumerGroup') + 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('ConsumerGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + event_hub_name, # type: str + consumer_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a consumer group from the specified Event Hub 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 event_hub_name: The Event Hub name. + :type event_hub_name: str + :param consumer_group_name: The consumer group name. + :type consumer_group_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-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'consumerGroupName': self._serialize.url("consumer_group_name", consumer_group_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.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + event_hub_name, # type: str + consumer_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ConsumerGroup" + """Gets a description for the specified consumer 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 event_hub_name: The Event Hub name. + :type event_hub_name: str + :param consumer_group_name: The consumer group name. + :type consumer_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConsumerGroup, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.ConsumerGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConsumerGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'consumerGroupName': self._serialize.url("consumer_group_name", consumer_group_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('ConsumerGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}'} # type: ignore + + def list_by_event_hub( + self, + resource_group_name, # type: str + namespace_name, # type: str + event_hub_name, # type: str + skip=None, # type: Optional[int] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ConsumerGroupListResult"] + """Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group + exists in 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 event_hub_name: The Event Hub name. + :type event_hub_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 ConsumerGroupListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventhub.v2021_11_01.models.ConsumerGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConsumerGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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_event_hub.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(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('ConsumerGroupListResult', 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_event_hub.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups'} # type: ignore diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_disaster_recovery_configs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_disaster_recovery_configs_operations.py new file mode 100644 index 000000000000..91f5a2f30018 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_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.eventhub.v2021_11_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.CheckNameAvailabilityParameter" + **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 Alias name. + :type parameters: ~azure.mgmt.eventhub.v2021_11_01.models.CheckNameAvailabilityParameter + :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.eventhub.v2021_11_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 = "2021-11-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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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, 'CheckNameAvailabilityParameter') + 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.EventHub/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.eventhub.v2021_11_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 = "2021-11-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.EventHub/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.eventhub.v2021_11_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.eventhub.v2021_11_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 = "2021-11-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.EventHub/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-11-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, 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.EventHub/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.eventhub.v2021_11_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 = "2021-11-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.EventHub/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-11-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.EventHub/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 = "2021-11-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.EventHub/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.AuthorizationRuleListResult"] + """Gets a list of 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 AuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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('AuthorizationRuleListResult', 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.EventHub/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.AuthorizationRule" + """Gets an AuthorizationRule 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: AuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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('AuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/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.eventhub.v2021_11_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 = "2021-11-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', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys'} # type: ignore diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_event_hubs_operations.py new file mode 100644 index 000000000000..0bff2938d1f9 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_event_hubs_operations.py @@ -0,0 +1,766 @@ +# 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.eventhub.v2021_11_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_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.EventHubListResult"] + """Gets all the Event Hubs 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 EventHubListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventhub.v2021_11_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 = "2021-11-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 + + 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.EventHub/namespaces/{namespaceName}/eventhubs'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + event_hub_name, # type: str + parameters, # type: "_models.Eventhub" + **kwargs # type: Any + ): + # type: (...) -> "_models.Eventhub" + """Creates or updates a new Event Hub as a nested resource 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 event_hub_name: The Event Hub name. + :type event_hub_name: str + :param parameters: Parameters supplied to create an Event Hub resource. + :type parameters: ~azure.mgmt.eventhub.v2021_11_01.models.Eventhub + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Eventhub, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.Eventhub + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Eventhub"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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, 'Eventhub') + 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('Eventhub', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + event_hub_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes an Event Hub 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 event_hub_name: The Event Hub name. + :type event_hub_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-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + event_hub_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Eventhub" + """Gets an Event Hubs description for the specified Event Hub. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name. + :type namespace_name: str + :param event_hub_name: The Event Hub name. + :type event_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Eventhub, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.Eventhub + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Eventhub"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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('Eventhub', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name, # type: str + namespace_name, # type: str + event_hub_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AuthorizationRuleListResult"] + """Gets the authorization rules for an Event Hub. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name. + :type namespace_name: str + :param event_hub_name: The Event Hub name. + :type event_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(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('AuthorizationRuleListResult', 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.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules'} # type: ignore + + def create_or_update_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + event_hub_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.AuthorizationRule" + **kwargs # type: Any + ): + # type: (...) -> "_models.AuthorizationRule" + """Creates or updates an AuthorizationRule for the specified Event Hub. Creation/update of the + AuthorizationRule will take a few seconds to take effect. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name. + :type namespace_name: str + :param event_hub_name: The Event Hub name. + :type event_hub_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access AuthorizationRule. + :type parameters: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_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, 'AuthorizationRule') + 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('AuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def get_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + event_hub_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AuthorizationRule" + """Gets an AuthorizationRule for an Event Hub 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 event_hub_name: The Event Hub name. + :type event_hub_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: AuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_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 = 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('AuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def delete_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + event_hub_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes an Event Hub AuthorizationRule. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name. + :type namespace_name: str + :param event_hub_name: The Event Hub name. + :type event_hub_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-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_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 = 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.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + event_hub_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Gets the ACS and SAS connection strings for the Event Hub. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name. + :type namespace_name: str + :param event_hub_name: The Event Hub name. + :type event_hub_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.eventhub.v2021_11_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 = "2021-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_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.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.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}/listKeys'} # type: ignore + + def regenerate_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + event_hub_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.RegenerateAccessKeyParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Regenerates the ACS and SAS connection strings for the Event Hub. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name. + :type namespace_name: str + :param event_hub_name: The Event Hub name. + :type event_hub_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the AuthorizationRule Keys + (PrimaryKey/SecondaryKey). + :type parameters: ~azure.mgmt.eventhub.v2021_11_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.eventhub.v2021_11_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 = "2021-11-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), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=256, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_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, '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.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_namespaces_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_namespaces_operations.py new file mode 100644 index 000000000000..02a3dec4495e --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_namespaces_operations.py @@ -0,0 +1,1224 @@ +# 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.eventhub.v2021_11_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.EHNamespaceListResult"] + """Lists all the available Namespaces within a 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 EHNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventhub.v2021_11_01.models.EHNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EHNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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('EHNamespaceListResult', 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.EventHub/namespaces'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.EHNamespaceListResult"] + """Lists 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 EHNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventhub.v2021_11_01.models.EHNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EHNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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('EHNamespaceListResult', 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.EventHub/namespaces'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.EHNamespace" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.EHNamespace"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.EHNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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', 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, 'EHNamespace') + 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('EHNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('EHNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.EHNamespace" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.EHNamespace"] + """Creates or updates a 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 for creating a namespace resource. + :type parameters: ~azure.mgmt.eventhub.v2021_11_01.models.EHNamespace + :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 EHNamespace or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.eventhub.v2021_11_01.models.EHNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.EHNamespace"] + 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('EHNamespace', 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), + '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.EventHub/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-11-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.EventHub/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.EventHub/namespaces/{namespaceName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.EHNamespace" + """Gets the description of 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: EHNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.EHNamespace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EHNamespace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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('EHNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.EHNamespace" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.EHNamespace"] + """Creates or updates a 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 for updating a namespace resource. + :type parameters: ~azure.mgmt.eventhub.v2021_11_01.models.EHNamespace + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EHNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.EHNamespace or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.EHNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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, 'EHNamespace') + 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('EHNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('EHNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/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.eventhub.v2021_11_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.eventhub.v2021_11_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 = "2021-11-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.EventHub/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.eventhub.v2021_11_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 = "2021-11-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.EventHub/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + def list_network_rule_set( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkRuleSetListResult" + """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: NetworkRuleSetListResult, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_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 = "2021-11-01" + accept = "application/json" + + # Construct URL + url = self.list_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('NetworkRuleSetListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/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.AuthorizationRuleListResult"] + """Gets a list of 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 AuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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('AuthorizationRuleListResult', 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.EventHub/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.AuthorizationRule" + **kwargs # type: Any + ): + # type: (...) -> "_models.AuthorizationRule" + """Creates or updates an AuthorizationRule 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 AuthorizationRule. + :type parameters: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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, 'AuthorizationRule') + 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('AuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/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 an AuthorizationRule 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 + :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-11-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', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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.EventHub/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.AuthorizationRule" + """Gets an AuthorizationRule 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: AuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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('AuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/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.eventhub.v2021_11_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 = "2021-11-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', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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.EventHub/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 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters required to regenerate the connection string. + :type parameters: ~azure.mgmt.eventhub.v2021_11_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.eventhub.v2021_11_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 = "2021-11-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', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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.EventHub/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def check_name_availability( + self, + parameters, # type: "_models.CheckNameAvailabilityParameter" + **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.eventhub.v2021_11_01.models.CheckNameAvailabilityParameter + :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.eventhub.v2021_11_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 = "2021-11-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, 'CheckNameAvailabilityParameter') + 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.EventHub/checkNameAvailability'} # type: ignore diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_operations.py new file mode 100644 index 000000000000..e6ecae76870d --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_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.eventhub.v2021_11_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 Event Hub 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.eventhub.v2021_11_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 = "2021-11-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.EventHub/operations'} # type: ignore diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_private_endpoint_connections_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..1fe0c81706e4 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,384 @@ +# 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.eventhub.v2021_11_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, + 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.eventhub.v2021_11_01.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-11-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('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.EventHub/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.eventhub.v2021_11_01.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.eventhub.v2021_11_01.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-11-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 = { + '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.EventHub/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-11-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'), + '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.EventHub/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 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 + :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.EventHub/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 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 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.eventhub.v2021_11_01.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-11-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), + '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.EventHub/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_private_link_resources_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..e3015e7f2a25 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/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.eventhub.v2021_11_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 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.eventhub.v2021_11_01.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-11-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('PrivateLinkResourcesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/privateLinkResources'} # type: ignore diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_schema_registry_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_schema_registry_operations.py new file mode 100644 index 000000000000..72376ca4a098 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_schema_registry_operations.py @@ -0,0 +1,331 @@ +# 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 SchemaRegistryOperations(object): + """SchemaRegistryOperations 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.eventhub.v2021_11_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_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.SchemaGroupListResult"] + """Gets all the Schema Groups 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 SchemaGroupListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.eventhub.v2021_11_01.models.SchemaGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SchemaGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('SchemaGroupListResult', 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.EventHub/namespaces/{namespaceName}/schemagroups'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + schema_group_name, # type: str + parameters, # type: "_models.SchemaGroup" + **kwargs # type: Any + ): + # type: (...) -> "_models.SchemaGroup" + """create_or_update. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name. + :type namespace_name: str + :param schema_group_name: The Schema Group name. + :type schema_group_name: str + :param parameters: Parameters supplied to create an Event Hub resource. + :type parameters: ~azure.mgmt.eventhub.v2021_11_01.models.SchemaGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SchemaGroup, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.SchemaGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SchemaGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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), + 'schemaGroupName': self._serialize.url("schema_group_name", schema_group_name, 'str', max_length=256, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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, 'SchemaGroup') + 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('SchemaGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/schemagroups/{schemaGroupName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + schema_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """delete. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name. + :type namespace_name: str + :param schema_group_name: The Schema Group name. + :type schema_group_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-11-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), + 'schemaGroupName': self._serialize.url("schema_group_name", schema_group_name, 'str', max_length=256, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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.EventHub/namespaces/{namespaceName}/schemagroups/{schemaGroupName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + schema_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SchemaGroup" + """get. + + :param resource_group_name: Name of the resource group within the azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name. + :type namespace_name: str + :param schema_group_name: The Schema Group name. + :type schema_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SchemaGroup, or the result of cls(response) + :rtype: ~azure.mgmt.eventhub.v2021_11_01.models.SchemaGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SchemaGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-11-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), + 'schemaGroupName': self._serialize.url("schema_group_name", schema_group_name, 'str', max_length=256, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[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('SchemaGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/schemagroups/{schemaGroupName}'} # type: ignore diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/py.typed b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file