Skip to content
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
17 changes: 1 addition & 16 deletions src/azure-cli/azure/cli/command_modules/eventhubs/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,7 @@ def load_arguments_eh(self, _):
with self.argument_context('eventhubs namespace create', min_api='2021-06-01-preview') as c:
c.argument('cluster_arm_id', options_list=['--cluster-arm-id'], is_preview=True, help='Cluster ARM ID of the Namespace')


# Cluster region
for scope in ['eventhubs cluster', 'eventhubs cluster namespace list']:
with self.argument_context(scope) as c:
c.argument('cluster_name', arg_type=name_type, id_part=None, help='Name of Cluster')

with self.argument_context('eventhubs cluster create') as c:
c.argument('location', arg_type=get_location_type(self.cli_ctx), id_part=None, help='Location of the Cluster, for locations of available pre-provision clusters, please check az event hubs ')
c.argument('supports_scaling', arg_type=get_three_state_flag(), help='A value that indicates whether Scaling is Supported.')

for scope in ['eventhubs cluster create', 'eventhubs cluster update']:
with self.argument_context(scope) as c:
c.argument('tags', arg_type=tags_type)
c.argument('capacity', type=int, help='Capacity for Sku, allowed value : 1')

# region Namespace Authorizationrule
# region Namespace Authorizationrule
with self.argument_context('eventhubs namespace authorization-rule list') as c:
c.argument('namespace_name', options_list=['--namespace-name'], id_part=None, help='Name of Namespace')

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --------------------------------------------------------------------------------------------
# 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 aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command_group(
"eventhubs cluster",
)
class __CMDGroup(AAZCommandGroup):
"""Manage Azure EventHubs Clusters.
"""
pass


__all__ = ["__CMDGroup"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# --------------------------------------------------------------------------------------------
# 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 aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from .__cmd_group import *
from ._available_region import *
from ._create import *
from ._delete import *
from ._list import *
from ._show import *
from ._update import *
from ._wait import *
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# --------------------------------------------------------------------------------------------
# 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 aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command(
"eventhubs cluster available-region",
)
class AvailableRegion(AAZCommand):
"""List the quantity of available pre-provisioned Event Hubs Clusters, indexed by Azure region.
"""

_aaz_info = {
"version": "2022-01-01-preview",
"resources": [
["mgmt-plane", "/subscriptions/{}/providers/microsoft.eventhub/availableclusterregions", "2022-01-01-preview"],
]
}

def _handler(self, command_args):
super()._handler(command_args)
self._execute_operations()
return self._output()

_args_schema = None

@classmethod
def _build_arguments_schema(cls, *args, **kwargs):
if cls._args_schema is not None:
return cls._args_schema
cls._args_schema = super()._build_arguments_schema(*args, **kwargs)

# define Arg Group ""
return cls._args_schema

def _execute_operations(self):
self.pre_operations()
self.ClustersListAvailableClusterRegion(ctx=self.ctx)()
self.post_operations()

@register_callback
def pre_operations(self):
pass

@register_callback
def post_operations(self):
pass

def _output(self, *args, **kwargs):
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True)
return result

class ClustersListAvailableClusterRegion(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"

def __call__(self, *args, **kwargs):
request = self.make_request()
session = self.client.send_request(request=request, stream=False, **kwargs)
if session.http_response.status_code in [200]:
return self.on_200(session)

return self.on_error(session.http_response)

@property
def url(self):
return self.client.format_url(
"/subscriptions/{subscriptionId}/providers/Microsoft.EventHub/availableClusterRegions",
**self.url_parameters
)

@property
def method(self):
return "GET"

@property
def error_format(self):
return "MgmtErrorFormat"

@property
def url_parameters(self):
parameters = {
**self.serialize_url_param(
"subscriptionId", self.ctx.subscription_id,
required=True,
),
}
return parameters

@property
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2022-01-01-preview",
required=True,
),
}
return parameters

@property
def header_parameters(self):
parameters = {
**self.serialize_header_param(
"Accept", "application/json",
),
}
return parameters

def on_200(self, session):
data = self.deserialize_http_content(session)
self.ctx.set_var(
"instance",
data,
schema_builder=self._build_schema_on_200
)

_schema_on_200 = None

@classmethod
def _build_schema_on_200(cls):
if cls._schema_on_200 is not None:
return cls._schema_on_200

cls._schema_on_200 = AAZObjectType()

_schema_on_200 = cls._schema_on_200
_schema_on_200.value = AAZListType()

value = cls._schema_on_200.value
value.Element = AAZObjectType()

_element = cls._schema_on_200.value.Element
_element.location = AAZStrType()

return cls._schema_on_200


class _AvailableRegionHelper:
"""Helper class for AvailableRegion"""


__all__ = ["AvailableRegion"]
Loading