-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[SQL] az sql mi endpoint-cert: New command group to manage endpoint certificates
#23350
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 all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b92e7b5
mi endpoint cert codegen
ostojicb 3a225dc
Rename 'managed-instance' to 'mi'
ostojicb ff3c633
Add tests
ostojicb c772992
rename command
ostojicb 6710d59
Update src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/…
ostojicb f4653cb
Update src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/…
ostojicb 54794bb
bump dir name
ostojicb 88f889b
fix help summary
ostojicb a2680ba
Merge branch 'dev' into ob_chimera
ostojicb 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
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,6 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # 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 | ||
| # -------------------------------------------------------------------------------------------- |
6 changes: 6 additions & 0 deletions
6
src/azure-cli/azure/cli/command_modules/sql/aaz/latest/__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,6 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # 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 | ||
| # -------------------------------------------------------------------------------------------- |
23 changes: 23 additions & 0 deletions
23
src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/__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( | ||
| "sql", | ||
| ) | ||
| class __CMDGroup(AAZCommandGroup): | ||
| """Manage Azure SQL Databases and Data Warehouses. | ||
| """ | ||
| pass | ||
|
|
||
|
|
||
| __all__ = ["__CMDGroup"] |
11 changes: 11 additions & 0 deletions
11
src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/__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
src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/__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( | ||
| "sql mi", | ||
| ) | ||
| class __CMDGroup(AAZCommandGroup): | ||
| """Manage SQL managed instances. | ||
| """ | ||
| pass | ||
|
|
||
|
|
||
| __all__ = ["__CMDGroup"] |
11 changes: 11 additions & 0 deletions
11
src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/__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
src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/endpoint_cert/__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( | ||
| "sql mi endpoint-cert", | ||
| ) | ||
| class __CMDGroup(AAZCommandGroup): | ||
| """Endpoint certificates management commands. | ||
| """ | ||
| pass | ||
|
|
||
|
|
||
| __all__ = ["__CMDGroup"] |
13 changes: 13 additions & 0 deletions
13
src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/endpoint_cert/__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,13 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # 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 ._list import * | ||
| from ._show import * |
178 changes: 178 additions & 0 deletions
178
src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/endpoint_cert/_list.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,178 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # 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( | ||
| "sql mi endpoint-cert list", | ||
| ) | ||
| class List(AAZCommand): | ||
| """List certificates used on endpoints on the target instance. | ||
| """ | ||
|
|
||
| _aaz_info = { | ||
| "version": "2022-02-01-preview", | ||
| "resources": [ | ||
| ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.sql/managedinstances/{}/endpointcertificates", "2022-02-01-preview"], | ||
| ] | ||
| } | ||
|
|
||
| def _handler(self, command_args): | ||
| super()._handler(command_args) | ||
| return self.build_paging(self._execute_operations, 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.managed_instance_name = AAZStrArg( | ||
| options=["--mi", "--instance-name", "--managed-instance", "--managed-instance-name"], | ||
| help="Name of the managed instance.", | ||
| required=True, | ||
| ) | ||
| _args_schema.resource_group = AAZResourceGroupNameArg( | ||
| required=True, | ||
| ) | ||
| return cls._args_schema | ||
|
|
||
| def _execute_operations(self): | ||
| self.EndpointCertificatesListByInstance(ctx=self.ctx)() | ||
|
|
||
| def _output(self, *args, **kwargs): | ||
| result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) | ||
| next_link = self.deserialize_output(self.ctx.vars.instance.next_link) | ||
| return result, next_link | ||
|
|
||
| class EndpointCertificatesListByInstance(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.Sql/managedInstances/{managedInstanceName}/endpointCertificates", | ||
| **self.url_parameters | ||
| ) | ||
|
|
||
| @property | ||
| def method(self): | ||
| return "GET" | ||
|
|
||
| @property | ||
| def error_format(self): | ||
| return "ODataV4Format" | ||
|
|
||
| @property | ||
| def url_parameters(self): | ||
| parameters = { | ||
| **self.serialize_url_param( | ||
| "managedInstanceName", self.ctx.args.managed_instance_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-02-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.next_link = AAZStrType( | ||
| serialized_name="nextLink", | ||
| flags={"read_only": True}, | ||
| ) | ||
| _schema_on_200.value = AAZListType( | ||
| flags={"read_only": True}, | ||
| ) | ||
|
|
||
| value = cls._schema_on_200.value | ||
| value.Element = AAZObjectType( | ||
| flags={"read_only": True}, | ||
| ) | ||
|
|
||
| _element = cls._schema_on_200.value.Element | ||
| _element.id = AAZStrType( | ||
| flags={"read_only": True}, | ||
| ) | ||
| _element.name = AAZStrType( | ||
| flags={"read_only": True}, | ||
| ) | ||
| _element.properties = AAZObjectType( | ||
| flags={"client_flatten": True, "read_only": True}, | ||
| ) | ||
| _element.type = AAZStrType( | ||
| flags={"read_only": True}, | ||
| ) | ||
|
|
||
| properties = cls._schema_on_200.value.Element.properties | ||
| properties.public_blob = AAZStrType( | ||
| serialized_name="publicBlob", | ||
| flags={"read_only": True}, | ||
| ) | ||
|
|
||
| return cls._schema_on_200 | ||
|
|
||
|
|
||
| __all__ = ["List"] |
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.
Uh oh!
There was an error while loading. Please reload this page.