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] Adding Create, Delete and List Namespaces Endpoints for Event Hubs Cluster Resource #4791

Closed
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -65,6 +67,7 @@
'ErrorResponse', 'ErrorResponseException',
'TrackedResource',
'Resource',
'EHNamespaceIdListResult',
'Sku',
'EHNamespace',
'IpFilterRule',
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]
Original file line number Diff line number Diff line change
@@ -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<msrest:optionsforoperations>`.
:return: EHNamespaceIdListResult or ClientRawResponse if raw=true
:rtype:
~azure.mgmt.eventhub.v2018_01_01_preview.models.EHNamespaceIdListResult
or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.eventhub.v2018_01_01_preview.models.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'}
Loading