-
Notifications
You must be signed in to change notification settings - Fork 3.5k
{EventHub} az eventhubs eventhub consumer-group create/update/delete/show/list: Migrate eventhub consumer-group cmdlets to AAZ
#25989
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...zure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/eventhub/__cmd_group.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 eventhub", | ||
| ) | ||
| class __CMDGroup(AAZCommandGroup): | ||
| """Manage Azure EventHubs eventhub | ||
| """ | ||
| pass | ||
|
|
||
|
|
||
| __all__ = ["__CMDGroup"] |
11 changes: 11 additions & 0 deletions
11
src/azure-cli/azure/cli/command_modules/eventhubs/aaz/latest/eventhubs/eventhub/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # 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 * |
23 changes: 23 additions & 0 deletions
23
...cli/command_modules/eventhubs/aaz/latest/eventhubs/eventhub/consumer_group/__cmd_group.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 eventhub consumer-group", | ||
| ) | ||
| class __CMDGroup(AAZCommandGroup): | ||
| """eventhubs eventhub consumer-group | ||
| """ | ||
| pass | ||
|
|
||
|
|
||
| __all__ = ["__CMDGroup"] | ||
16 changes: 16 additions & 0 deletions
16
...re/cli/command_modules/eventhubs/aaz/latest/eventhubs/eventhub/consumer_group/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # 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 ._create import * | ||
| from ._delete import * | ||
| from ._list import * | ||
| from ._show import * | ||
| from ._update import * |
269 changes: 269 additions & 0 deletions
269
...ure/cli/command_modules/eventhubs/aaz/latest/eventhubs/eventhub/consumer_group/_create.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,269 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # 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 eventhub consumer-group create", | ||
| ) | ||
| class Create(AAZCommand): | ||
| """Create an Event Hubs consumer group as a nested resource within a Namespace. | ||
| """ | ||
|
|
||
| _aaz_info = { | ||
| "version": "2022-01-01-preview", | ||
| "resources": [ | ||
| ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.eventhub/namespaces/{}/eventhubs/{}/consumergroups/{}", "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 "" | ||
|
|
||
| _args_schema = cls._args_schema | ||
| _args_schema.consumer_group_name = AAZStrArg( | ||
| options=["-n", "--name", "--consumer-group-name"], | ||
| help="The consumer group name", | ||
| required=True, | ||
| fmt=AAZStrArgFormat( | ||
| max_length=50, | ||
| min_length=1, | ||
| ), | ||
| ) | ||
| _args_schema.eventhub_name = AAZStrArg( | ||
| options=["--eventhub-name"], | ||
| help="The Event Hub name", | ||
| required=True, | ||
| fmt=AAZStrArgFormat( | ||
| max_length=256, | ||
| min_length=1, | ||
| ), | ||
| ) | ||
| _args_schema.namespace_name = AAZStrArg( | ||
| options=["--namespace-name"], | ||
| help="The Namespace name", | ||
| required=True, | ||
| fmt=AAZStrArgFormat( | ||
| max_length=50, | ||
| min_length=6, | ||
| ), | ||
| ) | ||
| _args_schema.resource_group = AAZResourceGroupNameArg( | ||
| required=True, | ||
| ) | ||
|
|
||
| # define Arg Group "Properties" | ||
|
|
||
| _args_schema = cls._args_schema | ||
| _args_schema.user_metadata = AAZStrArg( | ||
| options=["--user-metadata"], | ||
| arg_group="Properties", | ||
| help="User Metadata is a placeholder to store user-defined string data with maximum length 1024. e.g. it can be used to store descriptive data, such as list of teams and their contact information also user-defined configuration settings can be stored.", | ||
| ) | ||
| return cls._args_schema | ||
|
|
||
| def _execute_operations(self): | ||
| self.pre_operations() | ||
| self.ConsumerGroupsCreateOrUpdate(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 ConsumerGroupsCreateOrUpdate(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}", | ||
| **self.url_parameters | ||
| ) | ||
|
|
||
| @property | ||
| def method(self): | ||
| return "PUT" | ||
|
|
||
| @property | ||
| def error_format(self): | ||
| return "MgmtErrorFormat" | ||
|
|
||
| @property | ||
| def url_parameters(self): | ||
| parameters = { | ||
| **self.serialize_url_param( | ||
| "consumerGroupName", self.ctx.args.consumer_group_name, | ||
| required=True, | ||
| ), | ||
| **self.serialize_url_param( | ||
| "eventHubName", self.ctx.args.eventhub_name, | ||
| required=True, | ||
| ), | ||
| **self.serialize_url_param( | ||
| "namespaceName", self.ctx.args.namespace_name, | ||
| required=True, | ||
| ), | ||
| **self.serialize_url_param( | ||
| "resourceGroupName", self.ctx.args.resource_group, | ||
| required=True, | ||
| ), | ||
| **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( | ||
| "Content-Type", "application/json", | ||
| ), | ||
| **self.serialize_header_param( | ||
| "Accept", "application/json", | ||
| ), | ||
| } | ||
| return parameters | ||
|
|
||
| @property | ||
| def content(self): | ||
| _content_value, _builder = self.new_content_builder( | ||
| self.ctx.args, | ||
| typ=AAZObjectType, | ||
| typ_kwargs={"flags": {"required": True, "client_flatten": True}} | ||
| ) | ||
| _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) | ||
|
|
||
| properties = _builder.get(".properties") | ||
| if properties is not None: | ||
| properties.set_prop("userMetadata", AAZStrType, ".user_metadata") | ||
|
|
||
| return self.serialize_content(_content_value) | ||
|
|
||
| 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.id = AAZStrType( | ||
| flags={"read_only": True}, | ||
| ) | ||
| _schema_on_200.location = AAZStrType( | ||
| flags={"read_only": True}, | ||
| ) | ||
| _schema_on_200.name = AAZStrType( | ||
| flags={"read_only": True}, | ||
| ) | ||
| _schema_on_200.properties = AAZObjectType( | ||
| flags={"client_flatten": True}, | ||
| ) | ||
| _schema_on_200.system_data = AAZObjectType( | ||
| serialized_name="systemData", | ||
| flags={"read_only": True}, | ||
| ) | ||
| _schema_on_200.type = AAZStrType( | ||
| flags={"read_only": True}, | ||
| ) | ||
|
|
||
| properties = cls._schema_on_200.properties | ||
| properties.created_at = AAZStrType( | ||
| serialized_name="createdAt", | ||
| flags={"read_only": True}, | ||
| ) | ||
| properties.updated_at = AAZStrType( | ||
| serialized_name="updatedAt", | ||
| flags={"read_only": True}, | ||
| ) | ||
| properties.user_metadata = AAZStrType( | ||
| serialized_name="userMetadata", | ||
| ) | ||
|
|
||
| system_data = cls._schema_on_200.system_data | ||
| system_data.created_at = AAZStrType( | ||
| serialized_name="createdAt", | ||
| ) | ||
| system_data.created_by = AAZStrType( | ||
| serialized_name="createdBy", | ||
| ) | ||
| system_data.created_by_type = AAZStrType( | ||
| serialized_name="createdByType", | ||
| ) | ||
| system_data.last_modified_at = AAZStrType( | ||
| serialized_name="lastModifiedAt", | ||
| ) | ||
| system_data.last_modified_by = AAZStrType( | ||
| serialized_name="lastModifiedBy", | ||
| ) | ||
| system_data.last_modified_by_type = AAZStrType( | ||
| serialized_name="lastModifiedByType", | ||
| ) | ||
|
|
||
| return cls._schema_on_200 | ||
|
|
||
|
|
||
| class _CreateHelper: | ||
| """Helper class for Create""" | ||
|
|
||
|
|
||
| __all__ = ["Create"] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls use meaningful description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done