Skip to content

Commit 374e3b6

Browse files
committed
snapshot
1 parent 1565a55 commit 374e3b6

File tree

8 files changed

+367
-51
lines changed

8 files changed

+367
-51
lines changed

src/azure-cli/azure/cli/command_modules/vm/_params.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ def load_arguments(self, _):
227227
c.argument('bandwidth_copy_speed', min_api='2023-10-02',
228228
help='If this field is set on a snapshot and createOption is CopyStart, the snapshot will be copied at a quicker speed.',
229229
arg_type=get_enum_type(["None", "Enhanced"]))
230+
c.argument('enable_instant_access', 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.')
230231
# endregion
231232

232233
# region Images

src/azure-cli/azure/cli/command_modules/vm/aaz/latest/snapshot/_create.py

Lines changed: 64 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ class Create(AAZCommand):
1919
"""
2020

2121
_aaz_info = {
22-
"version": "2023-10-02",
22+
"version": "2025-01-02",
2323
"resources": [
24-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}", "2023-10-02"],
24+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}", "2025-01-02"],
2525
]
2626
}
2727

@@ -179,6 +179,13 @@ def _build_arguments_schema(cls, *args, **kwargs):
179179
help="Disk source information for PIR or user images.",
180180
)
181181
cls._build_args_image_disk_reference_create(creation_data.image_reference)
182+
creation_data.instant_access_duration_minutes = AAZIntArg(
183+
options=["instant-access-duration-minutes"],
184+
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.",
185+
fmt=AAZIntArgFormat(
186+
minimum=1,
187+
),
188+
)
182189
creation_data.logical_sector_size = AAZIntArg(
183190
options=["logical-sector-size"],
184191
help="Logical sector size in bytes for Ultra disks. Supported values are 512 ad 4096. 4096 is the default.",
@@ -196,6 +203,10 @@ def _build_arguments_schema(cls, *args, **kwargs):
196203
options=["security-data-uri"],
197204
help="If createOption is ImportSecure, this is the URI of a blob to be imported into VM guest state.",
198205
)
206+
creation_data.security_metadata_uri = AAZStrArg(
207+
options=["security-metadata-uri"],
208+
help="If createOption is ImportSecure, this is the URI of a blob to be imported into VM metadata for Confidential VM.",
209+
)
199210
creation_data.source_resource_id = AAZStrArg(
200211
options=["source-resource-id"],
201212
help="If createOption is Copy, this is the ARM id of the source snapshot or disk.",
@@ -324,6 +335,11 @@ def _build_arguments_schema(cls, *args, **kwargs):
324335
options=["disk-controller-types"],
325336
help="The disk controllers that an OS disk supports. If set it can be SCSI or SCSI, NVME or NVME, SCSI.",
326337
)
338+
supported_capabilities.supported_security_option = AAZStrArg(
339+
options=["supported-security-option"],
340+
help="Refers to the security capability of the disk supported to create a Trusted launch or Confidential VM",
341+
enum={"TrustedLaunchAndConfidentialVMSupported": "TrustedLaunchAndConfidentialVMSupported", "TrustedLaunchSupported": "TrustedLaunchSupported"},
342+
)
327343

328344
# define Arg Group "Snapshot"
329345

@@ -457,7 +473,7 @@ def __call__(self, *args, **kwargs):
457473
session,
458474
self.on_200,
459475
self.on_error,
460-
lro_options={"final-state-via": "azure-async-operation"},
476+
lro_options={"final-state-via": "location"},
461477
path_format_arguments=self.url_parameters,
462478
)
463479
if session.http_response.status_code in [200]:
@@ -466,7 +482,7 @@ def __call__(self, *args, **kwargs):
466482
session,
467483
self.on_200,
468484
self.on_error,
469-
lro_options={"final-state-via": "azure-async-operation"},
485+
lro_options={"final-state-via": "location"},
470486
path_format_arguments=self.url_parameters,
471487
)
472488

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

486502
@property
487503
def error_format(self):
488-
return "MgmtErrorFormat"
504+
return "ODataV4Format"
489505

490506
@property
491507
def url_parameters(self):
@@ -509,7 +525,7 @@ def url_parameters(self):
509525
def query_parameters(self):
510526
parameters = {
511527
**self.serialize_query_param(
512-
"api-version", "2023-10-02",
528+
"api-version", "2025-01-02",
513529
required=True,
514530
),
515531
}
@@ -576,10 +592,12 @@ def content(self):
576592
creation_data.set_prop("elasticSanResourceId", AAZStrType, ".elastic_san_resource_id")
577593
_CreateHelper._build_schema_image_disk_reference_create(creation_data.set_prop("galleryImageReference", AAZObjectType, ".gallery_image_reference"))
578594
_CreateHelper._build_schema_image_disk_reference_create(creation_data.set_prop("imageReference", AAZObjectType, ".image_reference"))
595+
creation_data.set_prop("instantAccessDurationMinutes", AAZIntType, ".instant_access_duration_minutes")
579596
creation_data.set_prop("logicalSectorSize", AAZIntType, ".logical_sector_size")
580597
creation_data.set_prop("performancePlus", AAZBoolType, ".performance_plus")
581598
creation_data.set_prop("provisionedBandwidthCopySpeed", AAZStrType, ".provisioned_bandwidth_copy_speed")
582599
creation_data.set_prop("securityDataUri", AAZStrType, ".security_data_uri")
600+
creation_data.set_prop("securityMetadataUri", AAZStrType, ".security_metadata_uri")
583601
creation_data.set_prop("sourceResourceId", AAZStrType, ".source_resource_id")
584602
creation_data.set_prop("sourceUri", AAZStrType, ".source_uri")
585603
creation_data.set_prop("storageAccountId", AAZStrType, ".storage_account_id")
@@ -632,6 +650,7 @@ def content(self):
632650
supported_capabilities.set_prop("acceleratedNetwork", AAZBoolType, ".accelerated_network")
633651
supported_capabilities.set_prop("architecture", AAZStrType, ".architecture")
634652
supported_capabilities.set_prop("diskControllerTypes", AAZStrType, ".disk_controller_types")
653+
supported_capabilities.set_prop("supportedSecurityOption", AAZStrType, ".supported_security_option")
635654

636655
sku = _builder.get(".sku")
637656
if sku is not None:
@@ -722,6 +741,7 @@ def _build_schema_snapshot_read(cls, _schema):
722741
_schema.name = cls._schema_snapshot_read.name
723742
_schema.properties = cls._schema_snapshot_read.properties
724743
_schema.sku = cls._schema_snapshot_read.sku
744+
_schema.system_data = cls._schema_snapshot_read.system_data
725745
_schema.tags = cls._schema_snapshot_read.tags
726746
_schema.type = cls._schema_snapshot_read.type
727747
return
@@ -749,6 +769,10 @@ def _build_schema_snapshot_read(cls, _schema):
749769
flags={"client_flatten": True},
750770
)
751771
snapshot_read.sku = AAZObjectType()
772+
snapshot_read.system_data = AAZObjectType(
773+
serialized_name="systemData",
774+
flags={"read_only": True},
775+
)
752776
snapshot_read.tags = AAZDictType()
753777
snapshot_read.type = AAZStrType(
754778
flags={"read_only": True},
@@ -817,6 +841,10 @@ def _build_schema_snapshot_read(cls, _schema):
817841
properties.security_profile = AAZObjectType(
818842
serialized_name="securityProfile",
819843
)
844+
properties.snapshot_access_state = AAZStrType(
845+
serialized_name="snapshotAccessState",
846+
flags={"read_only": True},
847+
)
820848
properties.supported_capabilities = AAZObjectType(
821849
serialized_name="supportedCapabilities",
822850
)
@@ -858,6 +886,9 @@ def _build_schema_snapshot_read(cls, _schema):
858886
serialized_name="imageReference",
859887
)
860888
cls._build_schema_image_disk_reference_read(creation_data.image_reference)
889+
creation_data.instant_access_duration_minutes = AAZIntType(
890+
serialized_name="instantAccessDurationMinutes",
891+
)
861892
creation_data.logical_sector_size = AAZIntType(
862893
serialized_name="logicalSectorSize",
863894
)
@@ -870,6 +901,9 @@ def _build_schema_snapshot_read(cls, _schema):
870901
creation_data.security_data_uri = AAZStrType(
871902
serialized_name="securityDataUri",
872903
)
904+
creation_data.security_metadata_uri = AAZStrType(
905+
serialized_name="securityMetadataUri",
906+
)
873907
creation_data.source_resource_id = AAZStrType(
874908
serialized_name="sourceResourceId",
875909
)
@@ -967,13 +1001,36 @@ def _build_schema_snapshot_read(cls, _schema):
9671001
supported_capabilities.disk_controller_types = AAZStrType(
9681002
serialized_name="diskControllerTypes",
9691003
)
1004+
supported_capabilities.supported_security_option = AAZStrType(
1005+
serialized_name="supportedSecurityOption",
1006+
)
9701007

9711008
sku = _schema_snapshot_read.sku
9721009
sku.name = AAZStrType()
9731010
sku.tier = AAZStrType(
9741011
flags={"read_only": True},
9751012
)
9761013

1014+
system_data = _schema_snapshot_read.system_data
1015+
system_data.created_at = AAZStrType(
1016+
serialized_name="createdAt",
1017+
)
1018+
system_data.created_by = AAZStrType(
1019+
serialized_name="createdBy",
1020+
)
1021+
system_data.created_by_type = AAZStrType(
1022+
serialized_name="createdByType",
1023+
)
1024+
system_data.last_modified_at = AAZStrType(
1025+
serialized_name="lastModifiedAt",
1026+
)
1027+
system_data.last_modified_by = AAZStrType(
1028+
serialized_name="lastModifiedBy",
1029+
)
1030+
system_data.last_modified_by_type = AAZStrType(
1031+
serialized_name="lastModifiedByType",
1032+
)
1033+
9771034
tags = _schema_snapshot_read.tags
9781035
tags.Element = AAZStrType()
9791036

@@ -984,6 +1041,7 @@ def _build_schema_snapshot_read(cls, _schema):
9841041
_schema.name = cls._schema_snapshot_read.name
9851042
_schema.properties = cls._schema_snapshot_read.properties
9861043
_schema.sku = cls._schema_snapshot_read.sku
1044+
_schema.system_data = cls._schema_snapshot_read.system_data
9871045
_schema.tags = cls._schema_snapshot_read.tags
9881046
_schema.type = cls._schema_snapshot_read.type
9891047

src/azure-cli/azure/cli/command_modules/vm/aaz/latest/snapshot/_delete.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ class Delete(AAZCommand):
1919
"""
2020

2121
_aaz_info = {
22-
"version": "2022-03-02",
22+
"version": "2025-01-02",
2323
"resources": [
24-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}", "2022-03-02"],
24+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}", "2025-01-02"],
2525
]
2626
}
2727

@@ -78,7 +78,7 @@ def __call__(self, *args, **kwargs):
7878
session,
7979
self.on_200,
8080
self.on_error,
81-
lro_options={"final-state-via": "azure-async-operation"},
81+
lro_options={"final-state-via": "location"},
8282
path_format_arguments=self.url_parameters,
8383
)
8484
if session.http_response.status_code in [200]:
@@ -87,7 +87,7 @@ def __call__(self, *args, **kwargs):
8787
session,
8888
self.on_200,
8989
self.on_error,
90-
lro_options={"final-state-via": "azure-async-operation"},
90+
lro_options={"final-state-via": "location"},
9191
path_format_arguments=self.url_parameters,
9292
)
9393
if session.http_response.status_code in [204]:
@@ -96,7 +96,7 @@ def __call__(self, *args, **kwargs):
9696
session,
9797
self.on_204,
9898
self.on_error,
99-
lro_options={"final-state-via": "azure-async-operation"},
99+
lro_options={"final-state-via": "location"},
100100
path_format_arguments=self.url_parameters,
101101
)
102102

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

116116
@property
117117
def error_format(self):
118-
return "MgmtErrorFormat"
118+
return "ODataV4Format"
119119

120120
@property
121121
def url_parameters(self):
@@ -139,7 +139,7 @@ def url_parameters(self):
139139
def query_parameters(self):
140140
parameters = {
141141
**self.serialize_query_param(
142-
"api-version", "2022-03-02",
142+
"api-version", "2025-01-02",
143143
required=True,
144144
),
145145
}

0 commit comments

Comments
 (0)