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
10 changes: 7 additions & 3 deletions src/azure-cli/azure/cli/command_modules/vm/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2870,14 +2870,18 @@ def _validate_vm_vmss_update_ephemeral_placement(cmd, namespace): # pylint: dis

def _validate_community_gallery_legal_agreement_acceptance(cmd, namespace):
from ._vm_utils import is_community_gallery_image_id, parse_community_gallery_image_id
from .aaz.latest.sig import ShowCommunity as SigShowCommunity
if not is_community_gallery_image_id(namespace.image) or namespace.accept_term:
return

community_gallery_name, _ = parse_community_gallery_image_id(namespace.image)
from ._client_factory import cf_community_gallery
try:
community_gallery_info = cf_community_gallery(cmd.cli_ctx).get(namespace.location, community_gallery_name)
eula = community_gallery_info.additional_properties['communityMetadata']['eula']
command_args = {
'location': namespace.location,
'public_gallery_name': community_gallery_name
}
community_gallery_info = SigShowCommunity(cli_ctx=cmd.cli_ctx)(command_args=command_args)
eula = community_gallery_info['communityMetadata']['eula']
except Exception as err:
raise CLIInternalError('Get the eula from community gallery failed: {0}'.format(err))

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

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

Expand Down Expand Up @@ -118,7 +118,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2022-01-03",
"api-version", "2025-03-03",
required=True,
),
}
Expand Down Expand Up @@ -160,6 +160,9 @@ def _build_schema_on_200(cls):
_schema_on_200.name = AAZStrType(
flags={"read_only": True},
)
_schema_on_200.properties = AAZObjectType(
flags={"client_flatten": True},
)
_schema_on_200.type = AAZStrType(
flags={"read_only": True},
)
Expand All @@ -169,6 +172,38 @@ def _build_schema_on_200(cls):
serialized_name="uniqueId",
)

properties = cls._schema_on_200.properties
properties.artifact_tags = AAZDictType(
serialized_name="artifactTags",
)
properties.community_metadata = AAZObjectType(
serialized_name="communityMetadata",
)
properties.disclaimer = AAZStrType()

artifact_tags = cls._schema_on_200.properties.artifact_tags
artifact_tags.Element = AAZStrType()

community_metadata = cls._schema_on_200.properties.community_metadata
community_metadata.eula = AAZStrType()
community_metadata.privacy_statement_uri = AAZStrType(
serialized_name="privacyStatementUri",
)
community_metadata.public_names = AAZListType(
serialized_name="publicNames",
flags={"required": True},
)
community_metadata.publisher_contact = AAZStrType(
serialized_name="publisherContact",
flags={"required": True},
)
community_metadata.publisher_uri = AAZStrType(
serialized_name="publisherUri",
)

public_names = cls._schema_on_200.properties.community_metadata.public_names
public_names.Element = AAZStrType()

return cls._schema_on_200


Expand Down
Loading
Loading