diff --git a/azure-mgmt-eventhub/azure/mgmt/eventhub/event_hub_management_client.py b/azure-mgmt-eventhub/azure/mgmt/eventhub/event_hub_management_client.py index 71a30fe7027a..3956f8446e7e 100644 --- a/azure-mgmt-eventhub/azure/mgmt/eventhub/event_hub_management_client.py +++ b/azure-mgmt-eventhub/azure/mgmt/eventhub/event_hub_management_client.py @@ -15,9 +15,11 @@ from .version import VERSION from .operations.operations import Operations from .operations.namespaces_operations import NamespacesOperations +from .operations.messaging_plan_operations import MessagingPlanOperations from .operations.disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations from .operations.event_hubs_operations import EventHubsOperations from .operations.consumer_groups_operations import ConsumerGroupsOperations +from .operations.regions_operations import RegionsOperations from . import models @@ -65,12 +67,16 @@ class EventHubManagementClient(object): :vartype operations: azure.mgmt.eventhub.operations.Operations :ivar namespaces: Namespaces operations :vartype namespaces: azure.mgmt.eventhub.operations.NamespacesOperations + :ivar messaging_plan: MessagingPlan operations + :vartype messaging_plan: azure.mgmt.eventhub.operations.MessagingPlanOperations :ivar disaster_recovery_configs: DisasterRecoveryConfigs operations :vartype disaster_recovery_configs: azure.mgmt.eventhub.operations.DisasterRecoveryConfigsOperations :ivar event_hubs: EventHubs operations :vartype event_hubs: azure.mgmt.eventhub.operations.EventHubsOperations :ivar consumer_groups: ConsumerGroups operations :vartype consumer_groups: azure.mgmt.eventhub.operations.ConsumerGroupsOperations + :ivar regions: Regions operations + :vartype regions: azure.mgmt.eventhub.operations.RegionsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -97,9 +103,13 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.namespaces = NamespacesOperations( self._client, self.config, self._serialize, self._deserialize) + self.messaging_plan = MessagingPlanOperations( + self._client, self.config, self._serialize, self._deserialize) self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( self._client, self.config, self._serialize, self._deserialize) self.event_hubs = EventHubsOperations( self._client, self.config, self._serialize, self._deserialize) self.consumer_groups = ConsumerGroupsOperations( self._client, self.config, self._serialize, self._deserialize) + self.regions = RegionsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-eventhub/azure/mgmt/eventhub/models/__init__.py b/azure-mgmt-eventhub/azure/mgmt/eventhub/models/__init__.py index 4b11427822c9..36c7d006d528 100644 --- a/azure-mgmt-eventhub/azure/mgmt/eventhub/models/__init__.py +++ b/azure-mgmt-eventhub/azure/mgmt/eventhub/models/__init__.py @@ -26,12 +26,16 @@ from .operation import Operation from .error_response import ErrorResponse, ErrorResponseException from .arm_disaster_recovery import ArmDisasterRecovery +from .messaging_regions_properties import MessagingRegionsProperties +from .messaging_regions import MessagingRegions +from .messaging_plan import MessagingPlan from .operation_paged import OperationPaged from .eh_namespace_paged import EHNamespacePaged from .authorization_rule_paged import AuthorizationRulePaged from .arm_disaster_recovery_paged import ArmDisasterRecoveryPaged from .eventhub_paged import EventhubPaged from .consumer_group_paged import ConsumerGroupPaged +from .messaging_regions_paged import MessagingRegionsPaged from .event_hub_management_client_enums import ( SkuName, SkuTier, @@ -62,12 +66,16 @@ 'Operation', 'ErrorResponse', 'ErrorResponseException', 'ArmDisasterRecovery', + 'MessagingRegionsProperties', + 'MessagingRegions', + 'MessagingPlan', 'OperationPaged', 'EHNamespacePaged', 'AuthorizationRulePaged', 'ArmDisasterRecoveryPaged', 'EventhubPaged', 'ConsumerGroupPaged', + 'MessagingRegionsPaged', 'SkuName', 'SkuTier', 'AccessRights', diff --git a/azure-mgmt-eventhub/azure/mgmt/eventhub/models/messaging_plan.py b/azure-mgmt-eventhub/azure/mgmt/eventhub/models/messaging_plan.py new file mode 100644 index 000000000000..04115687a696 --- /dev/null +++ b/azure-mgmt-eventhub/azure/mgmt/eventhub/models/messaging_plan.py @@ -0,0 +1,65 @@ +# 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 .tracked_resource import TrackedResource + + +class MessagingPlan(TrackedResource): + """Messaging. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param sku: Sku type + :type sku: int + :param selected_event_hub_unit: Selected event hub unit + :type selected_event_hub_unit: int + :ivar updated_at: The exact time the messaging plan was updated. + :vartype updated_at: datetime + :param revision: revision number + :type revision: long + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'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'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'properties.sku', 'type': 'int'}, + 'selected_event_hub_unit': {'key': 'properties.selectedEventHubUnit', 'type': 'int'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'revision': {'key': 'properties.revision', 'type': 'long'}, + } + + def __init__(self, location=None, tags=None, sku=None, selected_event_hub_unit=None, revision=None): + super(MessagingPlan, self).__init__(location=location, tags=tags) + self.sku = sku + self.selected_event_hub_unit = selected_event_hub_unit + self.updated_at = None + self.revision = revision diff --git a/azure-mgmt-eventhub/azure/mgmt/eventhub/models/messaging_regions.py b/azure-mgmt-eventhub/azure/mgmt/eventhub/models/messaging_regions.py new file mode 100644 index 000000000000..6d4a810d53e2 --- /dev/null +++ b/azure-mgmt-eventhub/azure/mgmt/eventhub/models/messaging_regions.py @@ -0,0 +1,52 @@ +# 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 .tracked_resource import TrackedResource + + +class MessagingRegions(TrackedResource): + """Messaging Region. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param properties: + :type properties: ~azure.mgmt.eventhub.models.MessagingRegionsProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'MessagingRegionsProperties'}, + } + + def __init__(self, location=None, tags=None, properties=None): + super(MessagingRegions, self).__init__(location=location, tags=tags) + self.properties = properties diff --git a/azure-mgmt-eventhub/azure/mgmt/eventhub/models/messaging_regions_paged.py b/azure-mgmt-eventhub/azure/mgmt/eventhub/models/messaging_regions_paged.py new file mode 100644 index 000000000000..6697e580f246 --- /dev/null +++ b/azure-mgmt-eventhub/azure/mgmt/eventhub/models/messaging_regions_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class MessagingRegionsPaged(Paged): + """ + A paging container for iterating over a list of :class:`MessagingRegions ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[MessagingRegions]'} + } + + def __init__(self, *args, **kwargs): + + super(MessagingRegionsPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-eventhub/azure/mgmt/eventhub/models/messaging_regions_properties.py b/azure-mgmt-eventhub/azure/mgmt/eventhub/models/messaging_regions_properties.py new file mode 100644 index 000000000000..cf7269d6b8f1 --- /dev/null +++ b/azure-mgmt-eventhub/azure/mgmt/eventhub/models/messaging_regions_properties.py @@ -0,0 +1,40 @@ +# 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 MessagingRegionsProperties(Model): + """MessagingRegionsProperties. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: Region code + :vartype code: str + :ivar full_name: Full name of the region + :vartype full_name: str + """ + + _validation = { + 'code': {'readonly': True}, + 'full_name': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'full_name': {'key': 'fullName', 'type': 'str'}, + } + + def __init__(self): + super(MessagingRegionsProperties, self).__init__() + self.code = None + self.full_name = None diff --git a/azure-mgmt-eventhub/azure/mgmt/eventhub/operations/__init__.py b/azure-mgmt-eventhub/azure/mgmt/eventhub/operations/__init__.py index 754191f262b2..a573bb6e8a0c 100644 --- a/azure-mgmt-eventhub/azure/mgmt/eventhub/operations/__init__.py +++ b/azure-mgmt-eventhub/azure/mgmt/eventhub/operations/__init__.py @@ -11,14 +11,18 @@ from .operations import Operations from .namespaces_operations import NamespacesOperations +from .messaging_plan_operations import MessagingPlanOperations from .disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations from .event_hubs_operations import EventHubsOperations from .consumer_groups_operations import ConsumerGroupsOperations +from .regions_operations import RegionsOperations __all__ = [ 'Operations', 'NamespacesOperations', + 'MessagingPlanOperations', 'DisasterRecoveryConfigsOperations', 'EventHubsOperations', 'ConsumerGroupsOperations', + 'RegionsOperations', ] diff --git a/azure-mgmt-eventhub/azure/mgmt/eventhub/operations/messaging_plan_operations.py b/azure-mgmt-eventhub/azure/mgmt/eventhub/operations/messaging_plan_operations.py new file mode 100644 index 000000000000..c65b5f122888 --- /dev/null +++ b/azure-mgmt-eventhub/azure/mgmt/eventhub/operations/messaging_plan_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 msrestazure.azure_exceptions import CloudError + +from .. import models + + +class MessagingPlanOperations(object): + """MessagingPlanOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: Client API Version. Constant value: "2017-04-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-04-01" + + self.config = config + + def get( + self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): + """Gets a description for the specified namespace. + + :param resource_group_name: Name of the resource group within the + azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name + :type namespace_name: str + :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: MessagingPlan or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.models.MessagingPlan or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/messagingplan' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('MessagingPlan', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-eventhub/azure/mgmt/eventhub/operations/regions_operations.py b/azure-mgmt-eventhub/azure/mgmt/eventhub/operations/regions_operations.py new file mode 100644 index 000000000000..54d647393919 --- /dev/null +++ b/azure-mgmt-eventhub/azure/mgmt/eventhub/operations/regions_operations.py @@ -0,0 +1,103 @@ +# 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 RegionsOperations(object): + """RegionsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: Client API Version. Constant value: "2017-04-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-04-01" + + self.config = config + + def list_by_sku( + self, sku, custom_headers=None, raw=False, **operation_config): + """Gets the available Regions for a given sku. + + :param sku: The sku type. + :type sku: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MessagingRegions + :rtype: + ~azure.mgmt.eventhub.models.MessagingRegionsPaged[~azure.mgmt.eventhub.models.MessagingRegions] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/providers/Microsoft.EventHub/sku/{sku}/regions' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'sku': self._serialize.url("sku", sku, 'str', max_length=50, min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.MessagingRegionsPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.MessagingRegionsPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-eventhub/azure/mgmt/eventhub/version.py b/azure-mgmt-eventhub/azure/mgmt/eventhub/version.py index 9c644827672b..d24076f8d84b 100644 --- a/azure-mgmt-eventhub/azure/mgmt/eventhub/version.py +++ b/azure-mgmt-eventhub/azure/mgmt/eventhub/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "1.2.0" +VERSION = "1.3.0"