diff --git a/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/__init__.py b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/__init__.py index 5f3b6f3d7395..9dd46622d872 100644 --- a/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/__init__.py +++ b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/__init__.py @@ -14,10 +14,13 @@ from .operation_py3 import Operation from .cluster_sku_py3 import ClusterSku from .cluster_py3 import Cluster + from .available_clusters_list_py3 import AvailableClustersList from .cluster_quota_configuration_properties_py3 import ClusterQuotaConfigurationProperties from .error_response_py3 import ErrorResponse, ErrorResponseException from .tracked_resource_py3 import TrackedResource from .resource_py3 import Resource + from .eh_namespace_id_container_py3 import EHNamespaceIdContainer + from .eh_namespace_id_list_result_py3 import EHNamespaceIdListResult from .sku_py3 import Sku from .eh_namespace_py3 import EHNamespace from .ip_filter_rule_py3 import IpFilterRule @@ -31,10 +34,13 @@ from .operation import Operation from .cluster_sku import ClusterSku from .cluster import Cluster + from .available_clusters_list import AvailableClustersList from .cluster_quota_configuration_properties import ClusterQuotaConfigurationProperties from .error_response import ErrorResponse, ErrorResponseException from .tracked_resource import TrackedResource from .resource import Resource + from .eh_namespace_id_container import EHNamespaceIdContainer + from .eh_namespace_id_list_result import EHNamespaceIdListResult from .sku import Sku from .eh_namespace import EHNamespace from .ip_filter_rule import IpFilterRule @@ -61,10 +67,13 @@ 'Operation', 'ClusterSku', 'Cluster', + 'AvailableClustersList', 'ClusterQuotaConfigurationProperties', 'ErrorResponse', 'ErrorResponseException', 'TrackedResource', 'Resource', + 'EHNamespaceIdContainer', + 'EHNamespaceIdListResult', 'Sku', 'EHNamespace', 'IpFilterRule', diff --git a/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/available_clusters_list.py b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/available_clusters_list.py new file mode 100644 index 000000000000..b3abbf8f4469 --- /dev/null +++ b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/available_clusters_list.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class AvailableClustersList(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[dict[str, int]] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[{int}]'}, + } + + def __init__(self, **kwargs): + super(AvailableClustersList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) diff --git a/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/available_clusters_list_py3.py b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/available_clusters_list_py3.py new file mode 100644 index 000000000000..4df27efffa53 --- /dev/null +++ b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/available_clusters_list_py3.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class AvailableClustersList(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[dict[str, int]] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[{int}]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(AvailableClustersList, self).__init__(**kwargs) + self.value = value diff --git a/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/eh_namespace_id_container.py b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/eh_namespace_id_container.py new file mode 100644 index 000000000000..aa188d48e93a --- /dev/null +++ b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/eh_namespace_id_container.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class EHNamespaceIdContainer(Model): + """The full ARM ID of an Event Hubs Namespace. + + :param id: + :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) diff --git a/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/eh_namespace_id_container_py3.py b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/eh_namespace_id_container_py3.py new file mode 100644 index 000000000000..a822ffe85794 --- /dev/null +++ b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/eh_namespace_id_container_py3.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class EHNamespaceIdContainer(Model): + """The full ARM ID of an Event Hubs Namespace. + + :param id: + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str=None, **kwargs) -> None: + super(EHNamespaceIdContainer, self).__init__(**kwargs) + self.id = id diff --git a/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/eh_namespace_id_list_result.py b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/eh_namespace_id_list_result.py new file mode 100644 index 000000000000..2f0a6b3986f8 --- /dev/null +++ b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/eh_namespace_id_list_result.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class EHNamespaceIdListResult(Model): + """The response of the List Namespace IDs operation. + + :param value: Result of the List Namespace IDs operation + :type value: + list[~azure.mgmt.eventhub.v2018_01_01_preview.models.EHNamespaceIdContainer] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EHNamespaceIdContainer]'}, + } + + def __init__(self, **kwargs): + super(EHNamespaceIdListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) diff --git a/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/eh_namespace_id_list_result_py3.py b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/eh_namespace_id_list_result_py3.py new file mode 100644 index 000000000000..7d123b15f13e --- /dev/null +++ b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/eh_namespace_id_list_result_py3.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class EHNamespaceIdListResult(Model): + """The response of the List Namespace IDs operation. + + :param value: Result of the List Namespace IDs operation + :type value: + list[~azure.mgmt.eventhub.v2018_01_01_preview.models.EHNamespaceIdContainer] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EHNamespaceIdContainer]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(EHNamespaceIdListResult, self).__init__(**kwargs) + self.value = value diff --git a/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/clusters_operations.py b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/clusters_operations.py index 385a18ca86c4..78d70c105f91 100644 --- a/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/clusters_operations.py +++ b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/clusters_operations.py @@ -38,6 +38,63 @@ def __init__(self, client, config, serializer, deserializer): self.config = config + def list_available_clusters( + self, custom_headers=None, raw=False, **operation_config): + """List the quantity of available pre-provisioned Event Hubs Clusters, + indexed by Azure region. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AvailableClustersList or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.AvailableClustersList + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_available_clusters.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('AvailableClustersList', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_available_clusters.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventHub/availableClusters'} + def list_by_resource_group( self, resource_group_name, custom_headers=None, raw=False, **operation_config): """Lists the available Event Hubs Clusters within an ARM resource group. @@ -168,6 +225,101 @@ def get( get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}'} + def _put_initial( + self, resource_group_name, cluster_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.put.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201, 202]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Cluster', response) + if response.status_code == 201: + deserialized = self._deserialize('Cluster', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def put( + self, resource_group_name, cluster_name, custom_headers=None, raw=False, polling=True, **operation_config): + """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 dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Cluster or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventhub.v2018_01_01_preview.models.Cluster] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventhub.v2018_01_01_preview.models.Cluster]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._put_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Cluster', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}'} + + def _patch_initial( self, resource_group_name, cluster_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL @@ -271,3 +423,145 @@ def get_long_running_output(response): else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}'} + + + def _delete_initial( + self, resource_group_name, cluster_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, cluster_name, custom_headers=None, raw=False, polling=True, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}'} + + def list_namespaces( + self, resource_group_name, cluster_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: EHNamespaceIdListResult or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.EHNamespaceIdListResult + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_namespaces.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('EHNamespaceIdListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_namespaces.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}/namespaces'}