From 33b830a1765891f31675d50a794c4183af5688a2 Mon Sep 17 00:00:00 2001 From: "RuiJun Hu (MSFT)" Date: Mon, 6 Jan 2025 16:20:21 +0800 Subject: [PATCH] implement param, remove unused --- .../vm/azure_stack/_client_factory.py | 4 ---- .../cli/command_modules/vm/azure_stack/commands.py | 1 - .../cli/command_modules/vm/azure_stack/custom.py | 9 --------- .../azure/cli/command_modules/vm/custom.py | 9 --------- .../cli/command_modules/vm/operations/sig_share.py | 14 ++++++++++++++ 5 files changed, 14 insertions(+), 23 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_client_factory.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_client_factory.py index 73f66608f9b..3b4334859d1 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_client_factory.py +++ b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_client_factory.py @@ -161,10 +161,6 @@ def cf_shared_galleries(cli_ctx, *_): return cf_vm_cl(cli_ctx).shared_galleries -def cf_gallery_sharing_profile(cli_ctx, *_): - return cf_vm_cl(cli_ctx).gallery_sharing_profile - - def cf_shared_gallery_image(cli_ctx, *_): return cf_vm_cl(cli_ctx).shared_gallery_images diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/commands.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/commands.py index 4ba8a2deba8..67741071e15 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/commands.py +++ b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/commands.py @@ -14,7 +14,6 @@ cf_dedicated_hosts, cf_dedicated_host_groups, cf_log_analytics_data_plane, cf_disk_encryption_set, - cf_gallery_sharing_profile, cf_shared_gallery_image, cf_shared_gallery_image_version, cf_capacity_reservation_groups, diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/custom.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/custom.py index 18383f6372b..db4b4eb3545 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/custom.py +++ b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/custom.py @@ -5402,15 +5402,6 @@ def list_generator(pages, num_results=50): return result -def sig_share_reset(cmd, client, resource_group_name, gallery_name): - SharingUpdate, SharingUpdateOperationTypes = cmd.get_models('SharingUpdate', 'SharingUpdateOperationTypes', - operation_group='shared_galleries') - sharing_update = SharingUpdate(operation_type=SharingUpdateOperationTypes.RESET) - return client.begin_update(resource_group_name=resource_group_name, - gallery_name=gallery_name, - sharing_update=sharing_update) - - def sig_shared_image_definition_list(client, location, gallery_unique_name, shared_to=None, marker=None, show_next_marker=None): # Keep it here as it will add subscription in the future and we need to set it to None to make it work diff --git a/src/azure-cli/azure/cli/command_modules/vm/custom.py b/src/azure-cli/azure/cli/command_modules/vm/custom.py index 2b341f490f0..c34ba4dc40f 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/custom.py +++ b/src/azure-cli/azure/cli/command_modules/vm/custom.py @@ -5395,15 +5395,6 @@ def list_generator(pages, num_results=50): return result -def sig_share_reset(cmd, client, resource_group_name, gallery_name): - SharingUpdate, SharingUpdateOperationTypes = cmd.get_models('SharingUpdate', 'SharingUpdateOperationTypes', - operation_group='shared_galleries') - sharing_update = SharingUpdate(operation_type=SharingUpdateOperationTypes.RESET) - return client.begin_update(resource_group_name=resource_group_name, - gallery_name=gallery_name, - sharing_update=sharing_update) - - def sig_shared_image_definition_list(client, location, gallery_unique_name, shared_to=None, marker=None, show_next_marker=None): # Keep it here as it will add subscription in the future and we need to set it to None to make it work diff --git a/src/azure-cli/azure/cli/command_modules/vm/operations/sig_share.py b/src/azure-cli/azure/cli/command_modules/vm/operations/sig_share.py index e1fc021865c..b38c4817ff4 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/operations/sig_share.py +++ b/src/azure-cli/azure/cli/command_modules/vm/operations/sig_share.py @@ -153,6 +153,20 @@ class SigShareEnableCommunity(_SigShareUpdate): @classmethod def _build_arguments_schema(cls, *args, **kwargs): args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.subscription_ids = AAZListArg( + options=["--subscription-ids"], + help="A list of subscription ids to share the gallery with.", + ) + subscription_ids = args_schema.subscription_ids + subscription_ids.Element = AAZStrArg() + + args_schema.tenant_ids = AAZListArg( + options=["--tenant-ids"], + help="A list of tenant ids to share the gallery with.", + ) + tenant_ids = args_schema.tenant_ids + tenant_ids.Element = AAZStrArg() + args_schema.operation_type._required = False args_schema.operation_type._registered = False args_schema.operation_type._default = 'EnableCommunity'