Skip to content

Commit b50471e

Browse files
committed
migrate latest profile
1 parent 5922c0d commit b50471e

File tree

7 files changed

+815
-739
lines changed

7 files changed

+815
-739
lines changed

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

-4
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,6 @@ def cf_gallery_image_versions(cli_ctx, _):
9595
return _compute_client_factory(cli_ctx).gallery_image_versions
9696

9797

98-
def cf_gallery_application_version(cli_ctx, *_):
99-
return _compute_client_factory(cli_ctx).gallery_application_versions
100-
101-
10298
def cf_proximity_placement_groups(cli_ctx, _):
10399
return _compute_client_factory(cli_ctx).proximity_placement_groups
104100

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

-23
Original file line numberDiff line numberDiff line change
@@ -1110,29 +1110,6 @@
11101110
short-summary: Manage gallery sharing profile
11111111
"""
11121112

1113-
helps['sig gallery-application version'] = """
1114-
type: group
1115-
short-summary: Manage gallery application version
1116-
"""
1117-
1118-
helps['sig gallery-application version create'] = """
1119-
type: command
1120-
short-summary: "Create a gallery Application Version."
1121-
examples:
1122-
- name: Create a simple gallery Application Version.
1123-
text: |-
1124-
az sig gallery-application version create --gallery-name myGalleryName --application-name myGalleryApplicationName -n 1.0.0 -g myResourceGroup --package-file-link https://{myStorageAccount}.blob.core.windows.net/{myStorageContainer}/{myStorageBlob} --install-command installCommand --remove-command removeCommand
1125-
"""
1126-
1127-
helps['sig gallery-application version update'] = """
1128-
type: command
1129-
short-summary: "Update a gallery Application Version."
1130-
examples:
1131-
- name: Update a simple gallery Application Version.
1132-
text: |-
1133-
az sig gallery-application version update --gallery-name myGalleryName --application-name myGalleryApplicationName -n 1.0.0 -g myResourceGroup --package-file-link https://{myStorageAccount}.blob.core.windows.net/{myStorageContainer}/{myStorageBlob} --end-of-life-date "2050-07-01T07:00:00Z"
1134-
"""
1135-
11361113
helps['snapshot create'] = """
11371114
type: command
11381115
short-summary: Create a snapshot.

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

-35
Original file line numberDiff line numberDiff line change
@@ -1408,41 +1408,6 @@ def load_arguments(self, _):
14081408

14091409
# endregion
14101410

1411-
# region Gallery applications
1412-
with self.argument_context('sig gallery-application version') as c:
1413-
c.argument('gallery_application_name', options_list=['--application-name'],
1414-
help='The name of the gallery Application')
1415-
c.argument('gallery_application_version_name', options_list=['--name', '-n', '--version-name'],
1416-
help='The name of the gallery Application Version')
1417-
1418-
with self.argument_context('sig gallery-application version create') as c:
1419-
c.argument('package_file_name', help='The name to assign the downloaded package file on the VM. This is limited to 4096 characters.'
1420-
'If not specified, the package file will be named the same as the Gallery Application name.')
1421-
c.argument('config_file_name', help='The name to assign the downloaded config file on the VM. This is limited to 4096 characters. '
1422-
'If not specified, the config file will be named the Gallery Application name appended with "_config"')
1423-
1424-
for scope in ['create', 'update']:
1425-
with self.argument_context('sig gallery-application version {}'.format(scope)) as c:
1426-
c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False,
1427-
validator=get_default_location_from_resource_group)
1428-
c.argument('tags', tags_type)
1429-
c.argument('package_file_link', help='The mediaLink of the artifact, must be a readable storage page blob.')
1430-
c.argument('install_command', help='The path and arguments to install the gallery application.')
1431-
c.argument('remove_command', help='The path and arguments to remove the gallery application.')
1432-
c.argument('update_command', help='The path and arguments to update the gallery application. If not present,'
1433-
' then update operation will invoke remove command on the previous version'
1434-
' and install command on the current version of the gallery application.')
1435-
c.argument('target_regions', type=validate_file_or_dict, help='The target regions where the Image Version is'
1436-
'going to be replicated to. This property is updatable. Expected value: '
1437-
'json-string/json-file/@json-file.')
1438-
c.argument('default_file_link', help='The default configuration link of the artifact, must be a readable storage page blob.')
1439-
c.argument('exclude_from', arg_type=get_three_state_flag(), help='If set to true, Virtual Machines '
1440-
'deployed from the latest version of the Image Definition won\'t use this Image Version.',
1441-
arg_group='Publishing Profile')
1442-
c.argument('end_of_life_date', help='The end of life date of the gallery image version. This property can be '
1443-
'used for decommissioning purposes. This property is updatable.', arg_group='Publishing Profile')
1444-
# endregion
1445-
14461411
# region Proximity Placement Group
14471412
with self.argument_context('ppg', min_api='2018-04-01') as c:
14481413
c.argument('proximity_placement_group_name', arg_type=name_arg_type, help="The name of the proximity placement group.")

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

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
cf_shared_gallery_image_version,
1818
cf_capacity_reservation_groups, cf_capacity_reservations,
1919
cf_vmss_run_commands,
20-
cf_gallery_application_version, cf_restore_point,
20+
cf_restore_point,
2121
cf_restore_point_collection, cf_community_gallery,
2222
cf_community_gallery_image,
2323
cf_community_gallery_image_version)
@@ -158,9 +158,8 @@ def load_command_table(self, _):
158158
operations_tmpl='azure.mgmt.compute.operations#GalleryApplicationsOperations.{}',
159159
)
160160

161-
compute_gallery_application_version_sdk = CliCommandType(
161+
compute_gallery_application_version_profile = CliCommandType(
162162
operations_tmpl='azure.mgmt.compute.operations#GalleryApplicationVersionsOperations.{}',
163-
client_factory=cf_gallery_application_version,
164163
)
165164

166165
compute_proximity_placement_groups_sdk = CliCommandType(
@@ -561,9 +560,10 @@ def load_command_table(self, _):
561560
from .operations.sig_gallery_application import SigGalleryApplicationCreate
562561
self.command_table['sig gallery-application create'] = SigGalleryApplicationCreate(loader=self)
563562

564-
with self.command_group('sig gallery-application version', compute_gallery_application_version_sdk, client_factory=cf_gallery_application_version, min_api='2021-07-01', operation_group='gallery_application_versions') as g:
565-
g.custom_command('create', 'gallery_application_version_create', supports_no_wait=True)
566-
g.custom_command('update', 'gallery_application_version_update', supports_no_wait=True)
563+
with self.command_group('sig gallery-application version', compute_gallery_application_version_profile, operation_group='gallery_application_versions'):
564+
from .operations.sig_gallery_application_version import SigGalleryApplicationVersionCreate, SiggalleryApplicationversionUpdate
565+
self.command_table['sig gallery-application version create'] = SigGalleryApplicationVersionCreate(loader=self)
566+
self.command_table['sig gallery-application version update'] = SiggalleryApplicationversionUpdate(loader=self)
567567

568568
with self.command_group('ppg', compute_proximity_placement_groups_sdk, min_api='2018-04-01', client_factory=cf_proximity_placement_groups) as g:
569569
g.custom_command('create', 'create_proximity_placement_group', validator=process_ppg_create_namespace)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# --------------------------------------------------------------------------------------------
5+
# pylint: disable=no-self-use, line-too-long, protected-access, too-few-public-methods, unused-argument
6+
from knack.log import get_logger
7+
8+
from ..aaz.latest.sig.gallery_application.version import Create as _SigGalleryApplicationVersionCreate, Update as _SigGalleryApplicationVersionUpdate
9+
10+
logger = get_logger(__name__)
11+
12+
13+
class SigGalleryApplicationVersionCreate(_SigGalleryApplicationVersionCreate):
14+
@classmethod
15+
def _build_arguments_schema(cls, *args, **kwargs):
16+
args_schema = super()._build_arguments_schema(*args, **kwargs)
17+
args_schema.install_command._required = True
18+
args_schema.package_file_link._required = True
19+
args_schema.remove_command._required = True
20+
return args_schema
21+
22+
23+
class SiggalleryApplicationversionUpdate(_SigGalleryApplicationVersionUpdate):
24+
@classmethod
25+
def _build_arguments_schema(cls, *args, **kwargs):
26+
args_schema = super()._build_arguments_schema(*args, **kwargs)
27+
args_schema.package_file_link._required = True
28+
return args_schema

0 commit comments

Comments
 (0)