Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR eventhub/resource-manager] EventHub: Revert removing of messaging plan and updated with examples #2377

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions azure-mgmt-eventhub/azure/mgmt/eventhub/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
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
Expand Down Expand Up @@ -67,6 +68,7 @@
'ArmDisasterRecovery',
'MessagingRegionsProperties',
'MessagingRegions',
'MessagingPlan',
'OperationPaged',
'EHNamespacePaged',
'AuthorizationRulePaged',
Expand Down
68 changes: 68 additions & 0 deletions azure-mgmt-eventhub/azure/mgmt/eventhub/models/messaging_plan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# 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 Plan for the namespace.

Variables are only populated by the server, and will be ignored when
sending a request.

:ivar id: Resource Id
:vartype id: str
:ivar name: Resource name
:vartype name: str
:ivar type: Resource type
:vartype type: str
:param location: Resource location
:type location: str
:param tags: Resource tags
:type tags: dict[str, str]
:ivar sku: Sku type
:vartype sku: int
:ivar selected_event_hub_unit: Selected event hub unit
:vartype selected_event_hub_unit: int
:ivar updated_at: The exact time the messaging plan was updated.
:vartype updated_at: datetime
:ivar revision: revision number
:vartype revision: long
"""

_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'sku': {'readonly': True},
'selected_event_hub_unit': {'readonly': True},
'updated_at': {'readonly': True},
'revision': {'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):
super(MessagingPlan, self).__init__(location=location, tags=tags)
self.sku = None
self.selected_event_hub_unit = None
self.updated_at = None
self.revision = None
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,68 @@ def update(
return deserialized
update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}'}

def get_messaging_plan(
self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config):
"""Gets messaging plan for 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<msrest:optionsforoperations>`.
:return: MessagingPlan or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.eventhub.models.MessagingPlan or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.eventhub.models.ErrorResponseException>`
"""
# Construct URL
url = self.get_messaging_plan.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_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]:
raise models.ErrorResponseException(self._deserialize, response)

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
get_messaging_plan.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/messagingplan'}

def list_authorization_rules(
self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config):
"""Gets a list of authorization rules for a Namespace.
Expand Down