-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
{Compute} az disk-encryption-set, az sig image-version and az image: …
…Migrate commands using CodeGen V2 (#26951)
- Loading branch information
Showing
64 changed files
with
16,056 additions
and
3,943 deletions.
There are no files selected for viewing
This file contains 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
src/azure-cli/azure/cli/command_modules/vm/aaz/2018_03_01_hybrid/image/__cmd_group.py
This file contains 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( | ||
"image", | ||
) | ||
class __CMDGroup(AAZCommandGroup): | ||
"""Manage custom virtual machine images. | ||
""" | ||
pass | ||
|
||
|
||
__all__ = ["__CMDGroup"] |
15 changes: 15 additions & 0 deletions
15
src/azure-cli/azure/cli/command_modules/vm/aaz/2018_03_01_hybrid/image/__init__.py
This file contains 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,15 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# 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 ._delete import * | ||
from ._list import * | ||
from ._show import * | ||
from ._wait import * |
224 changes: 224 additions & 0 deletions
224
src/azure-cli/azure/cli/command_modules/vm/aaz/2018_03_01_hybrid/image/_delete.py
This file contains 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,224 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# 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( | ||
"image delete", | ||
) | ||
class Delete(AAZCommand): | ||
"""Delete an Image. | ||
""" | ||
|
||
_aaz_info = { | ||
"version": "2017-03-30", | ||
"resources": [ | ||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/images/{}", "2017-03-30"], | ||
] | ||
} | ||
|
||
AZ_SUPPORT_NO_WAIT = True | ||
|
||
def _handler(self, command_args): | ||
super()._handler(command_args) | ||
return self.build_lro_poller(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.image_name = AAZStrArg( | ||
options=["-n", "--name", "--image-name"], | ||
help="The name of the image.", | ||
required=True, | ||
id_part="name", | ||
) | ||
_args_schema.resource_group = AAZResourceGroupNameArg( | ||
required=True, | ||
) | ||
return cls._args_schema | ||
|
||
def _execute_operations(self): | ||
self.pre_operations() | ||
yield self.ImagesDelete(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 ImagesDelete(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 [202]: | ||
return self.client.build_lro_polling( | ||
self.ctx.args.no_wait, | ||
session, | ||
self.on_200, | ||
self.on_error, | ||
lro_options={"final-state-via": "azure-async-operation"}, | ||
path_format_arguments=self.url_parameters, | ||
) | ||
if session.http_response.status_code in [200]: | ||
return self.client.build_lro_polling( | ||
self.ctx.args.no_wait, | ||
session, | ||
self.on_200, | ||
self.on_error, | ||
lro_options={"final-state-via": "azure-async-operation"}, | ||
path_format_arguments=self.url_parameters, | ||
) | ||
if session.http_response.status_code in [204]: | ||
return self.client.build_lro_polling( | ||
self.ctx.args.no_wait, | ||
session, | ||
self.on_204, | ||
self.on_error, | ||
lro_options={"final-state-via": "azure-async-operation"}, | ||
path_format_arguments=self.url_parameters, | ||
) | ||
|
||
return self.on_error(session.http_response) | ||
|
||
@property | ||
def url(self): | ||
return self.client.format_url( | ||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", | ||
**self.url_parameters | ||
) | ||
|
||
@property | ||
def method(self): | ||
return "DELETE" | ||
|
||
@property | ||
def error_format(self): | ||
return "MgmtErrorFormat" | ||
|
||
@property | ||
def url_parameters(self): | ||
parameters = { | ||
**self.serialize_url_param( | ||
"imageName", self.ctx.args.image_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", "2017-03-30", | ||
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.end_time = AAZStrType( | ||
serialized_name="endTime", | ||
flags={"read_only": True}, | ||
) | ||
_schema_on_200.error = AAZObjectType() | ||
_schema_on_200.name = AAZStrType( | ||
flags={"read_only": True}, | ||
) | ||
_schema_on_200.start_time = AAZStrType( | ||
serialized_name="startTime", | ||
flags={"read_only": True}, | ||
) | ||
_schema_on_200.status = AAZStrType( | ||
flags={"read_only": True}, | ||
) | ||
|
||
error = cls._schema_on_200.error | ||
error.code = AAZStrType() | ||
error.details = AAZListType() | ||
error.innererror = AAZObjectType() | ||
error.message = AAZStrType() | ||
error.target = AAZStrType() | ||
|
||
details = cls._schema_on_200.error.details | ||
details.Element = AAZObjectType() | ||
|
||
_element = cls._schema_on_200.error.details.Element | ||
_element.code = AAZStrType() | ||
_element.message = AAZStrType() | ||
_element.target = AAZStrType() | ||
|
||
innererror = cls._schema_on_200.error.innererror | ||
innererror.errordetail = AAZStrType() | ||
innererror.exceptiontype = AAZStrType() | ||
|
||
return cls._schema_on_200 | ||
|
||
def on_204(self, session): | ||
pass | ||
|
||
|
||
class _DeleteHelper: | ||
"""Helper class for Delete""" | ||
|
||
|
||
__all__ = ["Delete"] |
Oops, something went wrong.