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
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@ class Create(AAZCommand):

:example: Create a shared image gallery with both system and user assigned identity.
az sig create --resource-group MyResourceGroup --gallery-name MyGallery123 --system-assigned --user-assigned id1

:example: Create a gallery with soft deletion enabled.
az sig create --resource-group myResourceGroup --gallery-name myGalleryName --location westus --soft-delete True --soft-delete-retention-period 7 --soft-delete-grace-period 30
"""

_aaz_info = {
"version": "2025-03-03",
"version": "2026-03-03",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}", "2025-03-03"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}", "2026-03-03"],
Comment on lines +37 to +39
]
}

Expand All @@ -59,7 +62,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
help="The name of the Shared Image Gallery.",
required=True,
fmt=AAZStrArgFormat(
pattern="^[^_\\W][\\w._-]{0,79}(?<![-.])$",
pattern="^[^_\\W][\\w.-]{0,79}(?<![-.])$",
),
)
_args_schema.resource_group = AAZResourceGroupNameArg(
Expand Down Expand Up @@ -151,11 +154,21 @@ def _build_arguments_schema(cls, *args, **kwargs):
# define Arg Group "SoftDeletePolicy"

_args_schema = cls._args_schema
_args_schema.soft_delete_grace_period = AAZIntArg(
options=["--soft-delete-grace", "--soft-delete-grace-period"],
arg_group="SoftDeletePolicy",
help="The grace period in days for a simulated hard-deleted resource. During this period the gallery image version is unusable but can still be recovered if required. After this period elapses, the gallery image version is permanently (hard) deleted.",
)
_args_schema.soft_delete = AAZBoolArg(
options=["--soft-delete"],
arg_group="SoftDeletePolicy",
help="Enable soft-deletion for resources in this gallery, allowing them to be recovered within retention time.",
)
_args_schema.soft_delete_retention_period = AAZIntArg(
options=["--soft-delete-retention", "--soft-delete-retention-period"],
arg_group="SoftDeletePolicy",
help="The retention period in days for a soft-deleted resource. After this period elapses, the soft-deleted gallery image version transitions to a simulated hard-deleted state.",
)
return cls._args_schema

def _execute_operations(self):
Expand Down Expand Up @@ -239,7 +252,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2025-03-03",
"api-version", "2026-03-03",
required=True,
),
}
Expand Down Expand Up @@ -298,7 +311,9 @@ def content(self):

soft_delete_policy = _builder.get(".properties.softDeletePolicy")
if soft_delete_policy is not None:
soft_delete_policy.set_prop("gracePeriodInDays", AAZIntType, ".soft_delete_grace_period")
soft_delete_policy.set_prop("isSoftDeleteEnabled", AAZBoolType, ".soft_delete")
soft_delete_policy.set_prop("retentionPeriodInDays", AAZIntType, ".soft_delete_retention_period")

tags = _builder.get(".tags")
if tags is not None:
Expand Down Expand Up @@ -481,9 +496,15 @@ def _build_schema_gallery_read(cls, _schema):
)

soft_delete_policy = _schema_gallery_read.properties.soft_delete_policy
soft_delete_policy.grace_period_in_days = AAZIntType(
serialized_name="gracePeriodInDays",
)
soft_delete_policy.is_soft_delete_enabled = AAZBoolType(
serialized_name="isSoftDeleteEnabled",
)
soft_delete_policy.retention_period_in_days = AAZIntType(
serialized_name="retentionPeriodInDays",
)

system_data = _schema_gallery_read.system_data
system_data.created_at = AAZStrType(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ class Show(AAZCommand):
"""

_aaz_info = {
"version": "2025-03-03",
"version": "2026-03-03",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}", "2025-03-03"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}", "2026-03-03"],
]
}

Expand All @@ -47,22 +47,12 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
id_part="name",
fmt=AAZStrArgFormat(
pattern="^[^_\\W][\\w._-]{0,79}(?<![-.])$",
pattern="^[^_\\W][\\w.-]{0,79}(?<![-.])$",
),
)
_args_schema.resource_group = AAZResourceGroupNameArg(
required=True,
)
_args_schema.expand = AAZStrArg(
Comment thread
yanzhudd marked this conversation as resolved.
options=["--expand"],
help="The expand query option to apply on the operation.",
enum={"SharingProfile/Groups": "SharingProfile/Groups"},
)
_args_schema.select = AAZStrArg(
options=["--select"],
help="The select expression to apply on the operation.",
enum={"Permissions": "Permissions"},
)
return cls._args_schema

def _execute_operations(self):
Expand Down Expand Up @@ -130,13 +120,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"$expand", self.ctx.args.expand,
),
**self.serialize_query_param(
"$select", self.ctx.args.select,
),
**self.serialize_query_param(
"api-version", "2025-03-03",
"api-version", "2026-03-03",
required=True,
),
}
Expand Down Expand Up @@ -302,9 +286,15 @@ def _build_schema_on_200(cls):
)

soft_delete_policy = cls._schema_on_200.properties.soft_delete_policy
soft_delete_policy.grace_period_in_days = AAZIntType(
serialized_name="gracePeriodInDays",
)
soft_delete_policy.is_soft_delete_enabled = AAZBoolType(
serialized_name="isSoftDeleteEnabled",
)
soft_delete_policy.retention_period_in_days = AAZIntType(
serialized_name="retentionPeriodInDays",
)

system_data = cls._schema_on_200.system_data
system_data.created_at = AAZStrType(
Expand Down
Loading
Loading