Skip to content

Commit 39633cc

Browse files
committed
support new parameter
1 parent 1952665 commit 39633cc

File tree

10 files changed

+6792
-22
lines changed

10 files changed

+6792
-22
lines changed

src/azure-cli-core/azure/cli/core/profiles/_shared.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def default_api_version(self):
165165
'snapshots': '2023-10-02',
166166
'galleries': '2021-10-01',
167167
'gallery_images': '2021-10-01',
168-
'gallery_image_versions': '2023-07-03',
168+
'gallery_image_versions': '2024-03-03',
169169
'gallery_applications': '2021-07-01',
170170
'gallery_application_versions': '2022-01-03',
171171
'shared_galleries': '2022-01-03',

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,6 +1378,9 @@ def load_arguments(self, _):
13781378
help='Space-separated list of regions, edge zones, replica counts and storage types. Use `<region>=<edge zone>[=<replica count>][=<storage account type>]` to optionally set the replica count and/or storage account type for each region. '
13791379
'If a replica count is not specified, the default replica count will be used. If a storage account type is not specified, the default storage account type will be used. '
13801380
'If "--target-edge-zones None" is specified, the target extended locations will be cleared.')
1381+
c.argument('block_deletion_before_end_of_life', arg_type=get_three_state_flag(), min_api='2024-03-03',
1382+
options_list=['--block-deletion-before-end-of-life', '--block-deletion'],
1383+
help="Indicates whether or not the deletion is blocked for this gallery image version if its end of life has not expired")
13811384

13821385
for scope in ['sig image-version create', 'sig image-version update', 'sig image-version undelete']:
13831386
with self.argument_context(scope, operation_group='gallery_image_versions') as c:

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

Lines changed: 99 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class Create(AAZCommand):
1616
"""
1717

1818
_aaz_info = {
19-
"version": "2023-07-03",
19+
"version": "2024-03-03",
2020
"resources": [
21-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}/images/{}/versions/{}", "2023-07-03"],
21+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}/images/{}/versions/{}", "2024-03-03"],
2222
]
2323
}
2424

@@ -86,6 +86,11 @@ def _build_arguments_schema(cls, *args, **kwargs):
8686
arg_group="Properties",
8787
help="The publishing profile of a gallery image Version.",
8888
)
89+
_args_schema.restore = AAZBoolArg(
90+
options=["--restore"],
91+
arg_group="Properties",
92+
help="Indicates if this is a soft-delete resource restoration request.",
93+
)
8994
_args_schema.safety_profile = AAZObjectArg(
9095
options=["--safety-profile"],
9196
arg_group="Properties",
@@ -123,7 +128,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
123128
publishing_profile.storage_account_type = AAZStrArg(
124129
options=["storage-account-type"],
125130
help="Specifies the storage account type to be used to store the image. This property is not updatable.",
126-
enum={"Premium_LRS": "Premium_LRS", "Standard_LRS": "Standard_LRS", "Standard_ZRS": "Standard_ZRS"},
131+
enum={"PremiumV2_LRS": "PremiumV2_LRS", "Premium_LRS": "Premium_LRS", "Standard_LRS": "Standard_LRS", "Standard_ZRS": "Standard_ZRS"},
127132
)
128133
publishing_profile.target_extended_locations = AAZListArg(
129134
options=["target-extended-locations"],
@@ -174,6 +179,10 @@ def _build_arguments_schema(cls, *args, **kwargs):
174179
target_regions.Element = AAZObjectArg()
175180

176181
_element = cls._args_schema.publishing_profile.target_regions.Element
182+
_element.additional_replica_sets = AAZListArg(
183+
options=["additional-replica-sets"],
184+
help="List of storage sku with replica count to create direct drive replicas.",
185+
)
177186
_element.encryption = AAZObjectArg(
178187
options=["encryption"],
179188
help="Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in the gallery artifact.",
@@ -195,14 +204,32 @@ def _build_arguments_schema(cls, *args, **kwargs):
195204
_element.storage_account_type = AAZStrArg(
196205
options=["storage-account-type"],
197206
help="Specifies the storage account type to be used to store the image. This property is not updatable.",
198-
enum={"Premium_LRS": "Premium_LRS", "Standard_LRS": "Standard_LRS", "Standard_ZRS": "Standard_ZRS"},
207+
enum={"PremiumV2_LRS": "PremiumV2_LRS", "Premium_LRS": "Premium_LRS", "Standard_LRS": "Standard_LRS", "Standard_ZRS": "Standard_ZRS"},
208+
)
209+
210+
additional_replica_sets = cls._args_schema.publishing_profile.target_regions.Element.additional_replica_sets
211+
additional_replica_sets.Element = AAZObjectArg()
212+
213+
_element = cls._args_schema.publishing_profile.target_regions.Element.additional_replica_sets.Element
214+
_element.regional_replica_count = AAZIntArg(
215+
options=["regional-replica-count"],
216+
help="The number of direct drive replicas of the Image Version to be created.This Property is updatable",
217+
)
218+
_element.storage_account_type = AAZStrArg(
219+
options=["storage-account-type"],
220+
help="Specifies the storage account type to be used to create the direct drive replicas",
221+
enum={"PremiumV2_LRS": "PremiumV2_LRS", "Premium_LRS": "Premium_LRS", "Standard_LRS": "Standard_LRS", "Standard_ZRS": "Standard_ZRS"},
199222
)
200223

201224
safety_profile = cls._args_schema.safety_profile
202225
safety_profile.allow_deletion_of_replicated_locations = AAZBoolArg(
203226
options=["allow-deletion-of-replicated-locations"],
204227
help="Indicates whether or not removing this Gallery Image Version from replicated regions is allowed.",
205228
)
229+
safety_profile.block_deletion_before_end_of_life = AAZBoolArg(
230+
options=["block-deletion-before-end-of-life"],
231+
help="Indicates whether or not the deletion is blocked for this Gallery Image Version if its End Of Life has not expired.",
232+
)
206233

207234
security_profile = cls._args_schema.security_profile
208235
security_profile.uefi_settings = AAZObjectArg(
@@ -522,7 +549,7 @@ def url_parameters(self):
522549
def query_parameters(self):
523550
parameters = {
524551
**self.serialize_query_param(
525-
"api-version", "2023-07-03",
552+
"api-version", "2024-03-03",
526553
required=True,
527554
),
528555
}
@@ -554,6 +581,7 @@ def content(self):
554581
properties = _builder.get(".properties")
555582
if properties is not None:
556583
properties.set_prop("publishingProfile", AAZObjectType, ".publishing_profile")
584+
properties.set_prop("restore", AAZBoolType, ".restore")
557585
properties.set_prop("safetyProfile", AAZObjectType, ".safety_profile")
558586
properties.set_prop("securityProfile", AAZObjectType, ".security_profile")
559587
properties.set_prop("storageProfile", AAZObjectType, ".storage_profile", typ_kwargs={"flags": {"required": True}})
@@ -591,15 +619,26 @@ def content(self):
591619

592620
_elements = _builder.get(".properties.publishingProfile.targetRegions[]")
593621
if _elements is not None:
622+
_elements.set_prop("additionalReplicaSets", AAZListType, ".additional_replica_sets")
594623
_CreateHelper._build_schema_encryption_images_create(_elements.set_prop("encryption", AAZObjectType, ".encryption"))
595624
_elements.set_prop("excludeFromLatest", AAZBoolType, ".exclude_from_latest")
596625
_elements.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}})
597626
_elements.set_prop("regionalReplicaCount", AAZIntType, ".regional_replica_count")
598627
_elements.set_prop("storageAccountType", AAZStrType, ".storage_account_type")
599628

629+
additional_replica_sets = _builder.get(".properties.publishingProfile.targetRegions[].additionalReplicaSets")
630+
if additional_replica_sets is not None:
631+
additional_replica_sets.set_elements(AAZObjectType, ".")
632+
633+
_elements = _builder.get(".properties.publishingProfile.targetRegions[].additionalReplicaSets[]")
634+
if _elements is not None:
635+
_elements.set_prop("regionalReplicaCount", AAZIntType, ".regional_replica_count")
636+
_elements.set_prop("storageAccountType", AAZStrType, ".storage_account_type")
637+
600638
safety_profile = _builder.get(".properties.safetyProfile")
601639
if safety_profile is not None:
602640
safety_profile.set_prop("allowDeletionOfReplicatedLocations", AAZBoolType, ".allow_deletion_of_replicated_locations")
641+
safety_profile.set_prop("blockDeletionBeforeEndOfLife", AAZBoolType, ".block_deletion_before_end_of_life")
603642

604643
security_profile = _builder.get(".properties.securityProfile")
605644
if security_profile is not None:
@@ -852,6 +891,7 @@ def _build_schema_gallery_image_version_read(cls, _schema):
852891
serialized_name="replicationStatus",
853892
flags={"read_only": True},
854893
)
894+
properties.restore = AAZBoolType()
855895
properties.safety_profile = AAZObjectType(
856896
serialized_name="safetyProfile",
857897
)
@@ -862,6 +902,10 @@ def _build_schema_gallery_image_version_read(cls, _schema):
862902
serialized_name="storageProfile",
863903
flags={"required": True},
864904
)
905+
properties.validations_profile = AAZObjectType(
906+
serialized_name="validationsProfile",
907+
flags={"read_only": True},
908+
)
865909

866910
publishing_profile = _schema_gallery_image_version_read.properties.publishing_profile
867911
publishing_profile.end_of_life_date = AAZStrType(
@@ -915,6 +959,9 @@ def _build_schema_gallery_image_version_read(cls, _schema):
915959
target_regions.Element = AAZObjectType()
916960

917961
_element = _schema_gallery_image_version_read.properties.publishing_profile.target_regions.Element
962+
_element.additional_replica_sets = AAZListType(
963+
serialized_name="additionalReplicaSets",
964+
)
918965
_element.encryption = AAZObjectType()
919966
cls._build_schema_encryption_images_read(_element.encryption)
920967
_element.exclude_from_latest = AAZBoolType(
@@ -930,6 +977,17 @@ def _build_schema_gallery_image_version_read(cls, _schema):
930977
serialized_name="storageAccountType",
931978
)
932979

980+
additional_replica_sets = _schema_gallery_image_version_read.properties.publishing_profile.target_regions.Element.additional_replica_sets
981+
additional_replica_sets.Element = AAZObjectType()
982+
983+
_element = _schema_gallery_image_version_read.properties.publishing_profile.target_regions.Element.additional_replica_sets.Element
984+
_element.regional_replica_count = AAZIntType(
985+
serialized_name="regionalReplicaCount",
986+
)
987+
_element.storage_account_type = AAZStrType(
988+
serialized_name="storageAccountType",
989+
)
990+
933991
replication_status = _schema_gallery_image_version_read.properties.replication_status
934992
replication_status.aggregated_state = AAZStrType(
935993
serialized_name="aggregatedState",
@@ -960,6 +1018,9 @@ def _build_schema_gallery_image_version_read(cls, _schema):
9601018
safety_profile.allow_deletion_of_replicated_locations = AAZBoolType(
9611019
serialized_name="allowDeletionOfReplicatedLocations",
9621020
)
1021+
safety_profile.block_deletion_before_end_of_life = AAZBoolType(
1022+
serialized_name="blockDeletionBeforeEndOfLife",
1023+
)
9631024
safety_profile.policy_violations = AAZListType(
9641025
serialized_name="policyViolations",
9651026
flags={"read_only": True},
@@ -1057,6 +1118,39 @@ def _build_schema_gallery_image_version_read(cls, _schema):
10571118
serialized_name="virtualMachineId",
10581119
)
10591120

1121+
validations_profile = _schema_gallery_image_version_read.properties.validations_profile
1122+
validations_profile.executed_validations = AAZListType(
1123+
serialized_name="executedValidations",
1124+
)
1125+
validations_profile.platform_attributes = AAZListType(
1126+
serialized_name="platformAttributes",
1127+
)
1128+
validations_profile.validation_etag = AAZStrType(
1129+
serialized_name="validationEtag",
1130+
)
1131+
1132+
executed_validations = _schema_gallery_image_version_read.properties.validations_profile.executed_validations
1133+
executed_validations.Element = AAZObjectType()
1134+
1135+
_element = _schema_gallery_image_version_read.properties.validations_profile.executed_validations.Element
1136+
_element.execution_time = AAZStrType(
1137+
serialized_name="executionTime",
1138+
)
1139+
_element.status = AAZStrType()
1140+
_element.type = AAZStrType()
1141+
_element.version = AAZStrType()
1142+
1143+
platform_attributes = _schema_gallery_image_version_read.properties.validations_profile.platform_attributes
1144+
platform_attributes.Element = AAZObjectType()
1145+
1146+
_element = _schema_gallery_image_version_read.properties.validations_profile.platform_attributes.Element
1147+
_element.name = AAZStrType(
1148+
flags={"read_only": True},
1149+
)
1150+
_element.value = AAZStrType(
1151+
flags={"read_only": True},
1152+
)
1153+
10601154
tags = _schema_gallery_image_version_read.tags
10611155
tags.Element = AAZStrType()
10621156

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

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

2121
_aaz_info = {
22-
"version": "2023-07-03",
22+
"version": "2024-03-03",
2323
"resources": [
24-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}/images/{}/versions/{}", "2023-07-03"],
24+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}/images/{}/versions/{}", "2024-03-03"],
2525
]
2626
}
2727

@@ -159,7 +159,7 @@ def url_parameters(self):
159159
def query_parameters(self):
160160
parameters = {
161161
**self.serialize_query_param(
162-
"api-version", "2023-07-03",
162+
"api-version", "2024-03-03",
163163
required=True,
164164
),
165165
}

src/azure-cli/azure/cli/command_modules/vm/aaz/latest/sig/image_version/_show.py

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

2121
_aaz_info = {
22-
"version": "2023-07-03",
22+
"version": "2024-03-03",
2323
"resources": [
24-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}/images/{}/versions/{}", "2023-07-03"],
24+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}/images/{}/versions/{}", "2024-03-03"],
2525
]
2626
}
2727

@@ -145,7 +145,7 @@ def query_parameters(self):
145145
"$expand", self.ctx.args.expand,
146146
),
147147
**self.serialize_query_param(
148-
"api-version", "2023-07-03",
148+
"api-version", "2024-03-03",
149149
required=True,
150150
),
151151
}
@@ -207,6 +207,7 @@ def _build_schema_on_200(cls):
207207
serialized_name="replicationStatus",
208208
flags={"read_only": True},
209209
)
210+
properties.restore = AAZBoolType()
210211
properties.safety_profile = AAZObjectType(
211212
serialized_name="safetyProfile",
212213
)
@@ -217,6 +218,10 @@ def _build_schema_on_200(cls):
217218
serialized_name="storageProfile",
218219
flags={"required": True},
219220
)
221+
properties.validations_profile = AAZObjectType(
222+
serialized_name="validationsProfile",
223+
flags={"read_only": True},
224+
)
220225

221226
publishing_profile = cls._schema_on_200.properties.publishing_profile
222227
publishing_profile.end_of_life_date = AAZStrType(
@@ -270,6 +275,9 @@ def _build_schema_on_200(cls):
270275
target_regions.Element = AAZObjectType()
271276

272277
_element = cls._schema_on_200.properties.publishing_profile.target_regions.Element
278+
_element.additional_replica_sets = AAZListType(
279+
serialized_name="additionalReplicaSets",
280+
)
273281
_element.encryption = AAZObjectType()
274282
_ShowHelper._build_schema_encryption_images_read(_element.encryption)
275283
_element.exclude_from_latest = AAZBoolType(
@@ -285,6 +293,17 @@ def _build_schema_on_200(cls):
285293
serialized_name="storageAccountType",
286294
)
287295

296+
additional_replica_sets = cls._schema_on_200.properties.publishing_profile.target_regions.Element.additional_replica_sets
297+
additional_replica_sets.Element = AAZObjectType()
298+
299+
_element = cls._schema_on_200.properties.publishing_profile.target_regions.Element.additional_replica_sets.Element
300+
_element.regional_replica_count = AAZIntType(
301+
serialized_name="regionalReplicaCount",
302+
)
303+
_element.storage_account_type = AAZStrType(
304+
serialized_name="storageAccountType",
305+
)
306+
288307
replication_status = cls._schema_on_200.properties.replication_status
289308
replication_status.aggregated_state = AAZStrType(
290309
serialized_name="aggregatedState",
@@ -315,6 +334,9 @@ def _build_schema_on_200(cls):
315334
safety_profile.allow_deletion_of_replicated_locations = AAZBoolType(
316335
serialized_name="allowDeletionOfReplicatedLocations",
317336
)
337+
safety_profile.block_deletion_before_end_of_life = AAZBoolType(
338+
serialized_name="blockDeletionBeforeEndOfLife",
339+
)
318340
safety_profile.policy_violations = AAZListType(
319341
serialized_name="policyViolations",
320342
flags={"read_only": True},
@@ -412,6 +434,39 @@ def _build_schema_on_200(cls):
412434
serialized_name="virtualMachineId",
413435
)
414436

437+
validations_profile = cls._schema_on_200.properties.validations_profile
438+
validations_profile.executed_validations = AAZListType(
439+
serialized_name="executedValidations",
440+
)
441+
validations_profile.platform_attributes = AAZListType(
442+
serialized_name="platformAttributes",
443+
)
444+
validations_profile.validation_etag = AAZStrType(
445+
serialized_name="validationEtag",
446+
)
447+
448+
executed_validations = cls._schema_on_200.properties.validations_profile.executed_validations
449+
executed_validations.Element = AAZObjectType()
450+
451+
_element = cls._schema_on_200.properties.validations_profile.executed_validations.Element
452+
_element.execution_time = AAZStrType(
453+
serialized_name="executionTime",
454+
)
455+
_element.status = AAZStrType()
456+
_element.type = AAZStrType()
457+
_element.version = AAZStrType()
458+
459+
platform_attributes = cls._schema_on_200.properties.validations_profile.platform_attributes
460+
platform_attributes.Element = AAZObjectType()
461+
462+
_element = cls._schema_on_200.properties.validations_profile.platform_attributes.Element
463+
_element.name = AAZStrType(
464+
flags={"read_only": True},
465+
)
466+
_element.value = AAZStrType(
467+
flags={"read_only": True},
468+
)
469+
415470
tags = cls._schema_on_200.tags
416471
tags.Element = AAZStrType()
417472

0 commit comments

Comments
 (0)