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
1 change: 1 addition & 0 deletions src/azure-cli/azure/cli/command_modules/vm/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ def load_arguments(self, _):
c.argument('bandwidth_copy_speed', min_api='2023-10-02',
help='If this field is set on a snapshot and createOption is CopyStart, the snapshot will be copied at a quicker speed.',
arg_type=get_enum_type(["None", "Enhanced"]))
c.argument('instant_access_duration_minutes', options_list=['--instant-access-duration-minutes', '--ia-duration'], type=int, help='For snapshots created from Premium SSD v2 or Ultra disk, this property determines the time in minutes the snapshot is retained for instant access to enable faster restore. The disk sku should be UltraSSD_LRS or PremiumV2_LRS')
# endregion

# region Images
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ class Create(AAZCommand):
"""

_aaz_info = {
"version": "2023-10-02",
"version": "2025-01-02",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}", "2023-10-02"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}", "2025-01-02"],
]
}

Expand Down Expand Up @@ -179,6 +179,13 @@ def _build_arguments_schema(cls, *args, **kwargs):
help="Disk source information for PIR or user images.",
)
cls._build_args_image_disk_reference_create(creation_data.image_reference)
creation_data.instant_access_duration_minutes = AAZIntArg(
options=["instant-access-duration-minutes"],
help="For snapshots created from Premium SSD v2 or Ultra disk, this property determines the time in minutes the snapshot is retained for instant access to enable faster restore.",
fmt=AAZIntArgFormat(
minimum=1,
),
)
creation_data.logical_sector_size = AAZIntArg(
options=["logical-sector-size"],
help="Logical sector size in bytes for Ultra disks. Supported values are 512 ad 4096. 4096 is the default.",
Expand All @@ -196,6 +203,10 @@ def _build_arguments_schema(cls, *args, **kwargs):
options=["security-data-uri"],
help="If createOption is ImportSecure, this is the URI of a blob to be imported into VM guest state.",
)
creation_data.security_metadata_uri = AAZStrArg(
options=["security-metadata-uri"],
help="If createOption is ImportSecure, this is the URI of a blob to be imported into VM metadata for Confidential VM.",
)
creation_data.source_resource_id = AAZStrArg(
options=["source-resource-id"],
help="If createOption is Copy, this is the ARM id of the source snapshot or disk.",
Expand Down Expand Up @@ -324,6 +335,11 @@ def _build_arguments_schema(cls, *args, **kwargs):
options=["disk-controller-types"],
help="The disk controllers that an OS disk supports. If set it can be SCSI or SCSI, NVME or NVME, SCSI.",
)
supported_capabilities.supported_security_option = AAZStrArg(
options=["supported-security-option"],
help="Refers to the security capability of the disk supported to create a Trusted launch or Confidential VM",
enum={"TrustedLaunchAndConfidentialVMSupported": "TrustedLaunchAndConfidentialVMSupported", "TrustedLaunchSupported": "TrustedLaunchSupported"},
)

# define Arg Group "Snapshot"

Expand Down Expand Up @@ -457,7 +473,7 @@ def __call__(self, *args, **kwargs):
session,
self.on_200,
self.on_error,
lro_options={"final-state-via": "azure-async-operation"},
lro_options={"final-state-via": "location"},
path_format_arguments=self.url_parameters,
)
if session.http_response.status_code in [200]:
Expand All @@ -466,7 +482,7 @@ def __call__(self, *args, **kwargs):
session,
self.on_200,
self.on_error,
lro_options={"final-state-via": "azure-async-operation"},
lro_options={"final-state-via": "location"},
path_format_arguments=self.url_parameters,
)

Expand All @@ -485,7 +501,7 @@ def method(self):

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

@property
def url_parameters(self):
Expand All @@ -509,7 +525,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2023-10-02",
"api-version", "2025-01-02",
required=True,
),
}
Expand Down Expand Up @@ -576,10 +592,12 @@ def content(self):
creation_data.set_prop("elasticSanResourceId", AAZStrType, ".elastic_san_resource_id")
_CreateHelper._build_schema_image_disk_reference_create(creation_data.set_prop("galleryImageReference", AAZObjectType, ".gallery_image_reference"))
_CreateHelper._build_schema_image_disk_reference_create(creation_data.set_prop("imageReference", AAZObjectType, ".image_reference"))
creation_data.set_prop("instantAccessDurationMinutes", AAZIntType, ".instant_access_duration_minutes")
creation_data.set_prop("logicalSectorSize", AAZIntType, ".logical_sector_size")
creation_data.set_prop("performancePlus", AAZBoolType, ".performance_plus")
creation_data.set_prop("provisionedBandwidthCopySpeed", AAZStrType, ".provisioned_bandwidth_copy_speed")
creation_data.set_prop("securityDataUri", AAZStrType, ".security_data_uri")
creation_data.set_prop("securityMetadataUri", AAZStrType, ".security_metadata_uri")
creation_data.set_prop("sourceResourceId", AAZStrType, ".source_resource_id")
creation_data.set_prop("sourceUri", AAZStrType, ".source_uri")
creation_data.set_prop("storageAccountId", AAZStrType, ".storage_account_id")
Expand Down Expand Up @@ -632,6 +650,7 @@ def content(self):
supported_capabilities.set_prop("acceleratedNetwork", AAZBoolType, ".accelerated_network")
supported_capabilities.set_prop("architecture", AAZStrType, ".architecture")
supported_capabilities.set_prop("diskControllerTypes", AAZStrType, ".disk_controller_types")
supported_capabilities.set_prop("supportedSecurityOption", AAZStrType, ".supported_security_option")

sku = _builder.get(".sku")
if sku is not None:
Expand Down Expand Up @@ -722,6 +741,7 @@ def _build_schema_snapshot_read(cls, _schema):
_schema.name = cls._schema_snapshot_read.name
_schema.properties = cls._schema_snapshot_read.properties
_schema.sku = cls._schema_snapshot_read.sku
_schema.system_data = cls._schema_snapshot_read.system_data
_schema.tags = cls._schema_snapshot_read.tags
_schema.type = cls._schema_snapshot_read.type
return
Expand Down Expand Up @@ -749,6 +769,10 @@ def _build_schema_snapshot_read(cls, _schema):
flags={"client_flatten": True},
)
snapshot_read.sku = AAZObjectType()
snapshot_read.system_data = AAZObjectType(
serialized_name="systemData",
flags={"read_only": True},
)
snapshot_read.tags = AAZDictType()
snapshot_read.type = AAZStrType(
flags={"read_only": True},
Expand Down Expand Up @@ -817,6 +841,10 @@ def _build_schema_snapshot_read(cls, _schema):
properties.security_profile = AAZObjectType(
serialized_name="securityProfile",
)
properties.snapshot_access_state = AAZStrType(
serialized_name="snapshotAccessState",
flags={"read_only": True},
)
properties.supported_capabilities = AAZObjectType(
serialized_name="supportedCapabilities",
)
Expand Down Expand Up @@ -858,6 +886,9 @@ def _build_schema_snapshot_read(cls, _schema):
serialized_name="imageReference",
)
cls._build_schema_image_disk_reference_read(creation_data.image_reference)
creation_data.instant_access_duration_minutes = AAZIntType(
serialized_name="instantAccessDurationMinutes",
)
creation_data.logical_sector_size = AAZIntType(
serialized_name="logicalSectorSize",
)
Expand All @@ -870,6 +901,9 @@ def _build_schema_snapshot_read(cls, _schema):
creation_data.security_data_uri = AAZStrType(
serialized_name="securityDataUri",
)
creation_data.security_metadata_uri = AAZStrType(
serialized_name="securityMetadataUri",
)
creation_data.source_resource_id = AAZStrType(
serialized_name="sourceResourceId",
)
Expand Down Expand Up @@ -967,13 +1001,36 @@ def _build_schema_snapshot_read(cls, _schema):
supported_capabilities.disk_controller_types = AAZStrType(
serialized_name="diskControllerTypes",
)
supported_capabilities.supported_security_option = AAZStrType(
serialized_name="supportedSecurityOption",
)

sku = _schema_snapshot_read.sku
sku.name = AAZStrType()
sku.tier = AAZStrType(
flags={"read_only": True},
)

system_data = _schema_snapshot_read.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",
)

tags = _schema_snapshot_read.tags
tags.Element = AAZStrType()

Expand All @@ -984,6 +1041,7 @@ def _build_schema_snapshot_read(cls, _schema):
_schema.name = cls._schema_snapshot_read.name
_schema.properties = cls._schema_snapshot_read.properties
_schema.sku = cls._schema_snapshot_read.sku
_schema.system_data = cls._schema_snapshot_read.system_data
_schema.tags = cls._schema_snapshot_read.tags
_schema.type = cls._schema_snapshot_read.type

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ class Delete(AAZCommand):
"""

_aaz_info = {
"version": "2022-03-02",
"version": "2025-01-02",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}", "2022-03-02"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}", "2025-01-02"],
]
}

Expand Down Expand Up @@ -78,7 +78,7 @@ def __call__(self, *args, **kwargs):
session,
self.on_200,
self.on_error,
lro_options={"final-state-via": "azure-async-operation"},
lro_options={"final-state-via": "location"},
path_format_arguments=self.url_parameters,
)
if session.http_response.status_code in [200]:
Expand All @@ -87,7 +87,7 @@ def __call__(self, *args, **kwargs):
session,
self.on_200,
self.on_error,
lro_options={"final-state-via": "azure-async-operation"},
lro_options={"final-state-via": "location"},
path_format_arguments=self.url_parameters,
)
if session.http_response.status_code in [204]:
Expand All @@ -96,7 +96,7 @@ def __call__(self, *args, **kwargs):
session,
self.on_204,
self.on_error,
lro_options={"final-state-via": "azure-async-operation"},
lro_options={"final-state-via": "location"},
path_format_arguments=self.url_parameters,
)

Expand All @@ -115,7 +115,7 @@ def method(self):

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

@property
def url_parameters(self):
Expand All @@ -139,7 +139,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2022-03-02",
"api-version", "2025-01-02",
required=True,
),
}
Expand Down
Loading
Loading