From 9d174f9307e2a08b76ffb9bd8e672f85ba79b02a Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 5 Apr 2019 23:51:33 +0000 Subject: [PATCH 1/2] Generated from 1452a48f4db294ab952ea449cf67508a3ac1e4bd Update EventHub-preview.json --- ...event_hub2018_preview_management_client.py | 5 + .../v2018_01_01_preview/models/__init__.py | 3 + .../models/eh_namespace_id_list_result.py | 28 +++ .../models/eh_namespace_id_list_result_py3.py | 28 +++ .../operations/__init__.py | 2 + .../operations/cluster_operations.py | 100 ++++++++++ .../operations/clusters_operations.py | 174 ++++++++++++++++++ 7 files changed, 340 insertions(+) create mode 100644 azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/eh_namespace_id_list_result.py create mode 100644 azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/eh_namespace_id_list_result_py3.py create mode 100644 azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/cluster_operations.py diff --git a/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/event_hub2018_preview_management_client.py b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/event_hub2018_preview_management_client.py index c78567f8d234..daf600fb72b4 100644 --- a/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/event_hub2018_preview_management_client.py +++ b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/event_hub2018_preview_management_client.py @@ -15,6 +15,7 @@ from .version import VERSION from .operations.operations import Operations from .operations.clusters_operations import ClustersOperations +from .operations.cluster_operations import ClusterOperations from .operations.configuration_operations import ConfigurationOperations from .operations.namespaces_operations import NamespacesOperations from . import models @@ -64,6 +65,8 @@ class EventHub2018PreviewManagementClient(SDKClient): :vartype operations: azure.mgmt.eventhub.v2018_01_01_preview.operations.Operations :ivar clusters: Clusters operations :vartype clusters: azure.mgmt.eventhub.v2018_01_01_preview.operations.ClustersOperations + :ivar cluster: Cluster operations + :vartype cluster: azure.mgmt.eventhub.v2018_01_01_preview.operations.ClusterOperations :ivar configuration: Configuration operations :vartype configuration: azure.mgmt.eventhub.v2018_01_01_preview.operations.ConfigurationOperations :ivar namespaces: Namespaces operations @@ -94,6 +97,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.clusters = ClustersOperations( self._client, self.config, self._serialize, self._deserialize) + self.cluster = ClusterOperations( + self._client, self.config, self._serialize, self._deserialize) self.configuration = ConfigurationOperations( self._client, self.config, self._serialize, self._deserialize) self.namespaces = NamespacesOperations( 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..60e86253e128 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 @@ -18,6 +18,7 @@ from .error_response_py3 import ErrorResponse, ErrorResponseException from .tracked_resource_py3 import TrackedResource from .resource_py3 import Resource + 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 @@ -35,6 +36,7 @@ from .error_response import ErrorResponse, ErrorResponseException from .tracked_resource import TrackedResource from .resource import Resource + from .eh_namespace_id_list_result import EHNamespaceIdListResult from .sku import Sku from .eh_namespace import EHNamespace from .ip_filter_rule import IpFilterRule @@ -65,6 +67,7 @@ 'ErrorResponse', 'ErrorResponseException', 'TrackedResource', 'Resource', + 'EHNamespaceIdListResult', 'Sku', 'EHNamespace', 'IpFilterRule', 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..814ba17164c8 --- /dev/null +++ b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/eh_namespace_id_list_result.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 EHNamespaceIdListResult(Model): + """The response of the List Namespace IDs operation. + + :param value: Result of the List Namespace IDs operation + :type value: list[str] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[str]'}, + } + + 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..43402c98cd03 --- /dev/null +++ b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/eh_namespace_id_list_result_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 EHNamespaceIdListResult(Model): + """The response of the List Namespace IDs operation. + + :param value: Result of the List Namespace IDs operation + :type value: list[str] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[str]'}, + } + + 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/__init__.py b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/__init__.py index d7355cb00121..48d58672d469 100644 --- a/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/__init__.py +++ b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/__init__.py @@ -11,12 +11,14 @@ from .operations import Operations from .clusters_operations import ClustersOperations +from .cluster_operations import ClusterOperations from .configuration_operations import ConfigurationOperations from .namespaces_operations import NamespacesOperations __all__ = [ 'Operations', 'ClustersOperations', + 'ClusterOperations', 'ConfigurationOperations', 'NamespacesOperations', ] diff --git a/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/cluster_operations.py b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/cluster_operations.py new file mode 100644 index 000000000000..b63ab270dc93 --- /dev/null +++ b/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/cluster_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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ClusterOperations(object): + """ClusterOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client API version. Constant value: "2018-01-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-01-01-preview" + + self.config = config + + def list( + 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.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.post(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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}/namespaces'} 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..46841bfbd96c 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 @@ -168,6 +168,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 +366,82 @@ 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}'} From 880e3e25156c0a272f656d17574bcc03de8dbc2d Mon Sep 17 00:00:00 2001 From: azuresdkci Date: Fri, 5 Apr 2019 23:55:03 +0000 Subject: [PATCH 2/2] Packaging update of azure-mgmt-eventhub --- azure-mgmt-eventhub/setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-mgmt-eventhub/setup.py b/azure-mgmt-eventhub/setup.py index c816b44375be..a73cf3ed43fd 100644 --- a/azure-mgmt-eventhub/setup.py +++ b/azure-mgmt-eventhub/setup.py @@ -53,6 +53,7 @@ version=version, description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), long_description=readme + '\n\n' + history, + long_description_content_type='text/x-rst', license='MIT License', author='Microsoft Corporation', author_email='azpysdkhelp@microsoft.com',