From ad35079fbe4b67d44c284d1081a617611b77ffa5 Mon Sep 17 00:00:00 2001 From: Shubham Chaudhari Date: Thu, 18 May 2023 10:20:40 +0530 Subject: [PATCH 1/2] UPdtes --- .../cli/command_modules/servicebus/_params.py | 13 +++++------- .../aaz/latest/servicebus/queue/_update.py | 21 ------------------- 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/servicebus/_params.py b/src/azure-cli/azure/cli/command_modules/servicebus/_params.py index 031b5d3e686..2b5829832bf 100644 --- a/src/azure-cli/azure/cli/command_modules/servicebus/_params.py +++ b/src/azure-cli/azure/cli/command_modules/servicebus/_params.py @@ -59,34 +59,31 @@ def load_arguments_sb(self, _): with self.argument_context('servicebus queue') as c: c.argument('queue_name', arg_type=name_type, id_part='child_name_1', completer=get_queue_command_completion_list, help='Name of Queue') - # region - Queue Create +# region - Queue Create for scope in ['create', 'update']: with self.argument_context('servicebus queue {}'.format(scope)) as c: c.argument('queue_name', arg_type=name_type, id_part='child_name_1', help='Name of Queue') c.argument('lock_duration', validator=_validate_lock_duration, help='String ISO 8601 timespan or duration format for duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute.') c.argument('max_size_in_megabytes', options_list=['--max-size'], type=int, choices=[1024, 2048, 3072, 4096, 5120, 10240, 20480, 40960, 81920], help='Maximum size of queue in megabytes, which is the size of the memory allocated for the queue. Default is 1024. Max for Standard SKU is 5120 and for Premium SKU is 81920') c.argument('max_message_size_in_kilobytes', options_list=['--max-message-size', '--max-message-size-in-kilobytes'], type=int, help='Maximum size (in KB) of the message payload that can be accepted by the queue. This property is only used in Premium today and default is 1024.') - c.argument('requires_duplicate_detection', options_list=['--enable-duplicate-detection'], arg_type=get_three_state_flag(), help='A boolean value indicating if this queue requires duplicate detection.') - c.argument('requires_session', options_list=['--enable-session'], arg_type=get_three_state_flag(), help='A boolean value indicating whether the queue supports the concept of sessions.') c.argument('default_message_time_to_live', validator=_validate_default_message_time_to_live, help='ISO 8601 timespan or duration time format for default message to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself.') c.argument('dead_lettering_on_message_expiration', options_list=['--enable-dead-lettering-on-message-expiration'], arg_type=get_three_state_flag(), help='A boolean value that indicates whether this queue has dead letter support when a message expires.') c.argument('duplicate_detection_history_time_window', validator=_validate_duplicate_detection_history_time_window, help='ISO 8601 timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes.') c.argument('max_delivery_count', type=int, help='The maximum delivery count. A message is automatically deadlettered after this number of deliveries. default value is 10.') c.argument('status', arg_type=get_enum_type(['Active', 'Disabled', 'SendDisabled', 'ReceiveDisabled']), help='Enumerates the possible values for the status of a messaging entity.') c.argument('auto_delete_on_idle', validator=_validate_auto_delete_on_idle, help='ISO 8601 timeSpan or duration time format for idle interval after which the queue is automatically deleted. The minimum duration is 5 minutes.') - c.argument('enable_partitioning', arg_type=get_three_state_flag(), help='A boolean value that indicates whether the queue is to be partitioned across multiple message brokers.') c.argument('enable_express', arg_type=get_three_state_flag(), help='A boolean value that indicates whether Express Entities are enabled. An express queue holds a message in memory temporarily before writing it to persistent storage.') c.argument('forward_to', help='Queue/Topic name to forward the messages') c.argument('forward_dead_lettered_messages_to', help='Queue/Topic name to forward the Dead Letter message') c.argument('enable_batched_operations', arg_type=get_three_state_flag(), help='Allow server-side batched operations.') - with self.argument_context('servicebus queue update') as c: + with self.argument_context('servicebus queue create') as c: c.argument('enable_partitioning', arg_type=get_three_state_flag(), - help='A boolean value that indicates whether the queue is to be partitioned across multiple message brokers.', deprecate_info=c.deprecate(hide=True, expiration='2.49.0')) - c.argument('requires_session', options_list=['--enable-session'], arg_type=get_three_state_flag(), help='A boolean value indicating whether the queue supports the concept of sessions.', deprecate_info=c.deprecate(hide=True, expiration='2.49.0')) + help='A boolean value that indicates whether the queue is to be partitioned across multiple message brokers.') + c.argument('requires_session', options_list=['--enable-session'], arg_type=get_three_state_flag(), help='A boolean value indicating whether the queue supports the concept of sessions.') c.argument('requires_duplicate_detection', options_list=['--enable-duplicate-detection'], arg_type=get_three_state_flag(), - help='A boolean value indicating if this queue requires duplicate detection.', deprecate_info=c.deprecate(hide=True, expiration='2.49.0')) + help='A boolean value indicating if this queue requires duplicate detection.') with self.argument_context('servicebus queue list') as c: c.argument('namespace_name', id_part=None, options_list=['--namespace-name'], help='Name of Namespace') diff --git a/src/azure-cli/azure/cli/command_modules/servicebus/aaz/latest/servicebus/queue/_update.py b/src/azure-cli/azure/cli/command_modules/servicebus/aaz/latest/servicebus/queue/_update.py index 2989de499bc..7d6122bcb36 100644 --- a/src/azure-cli/azure/cli/command_modules/servicebus/aaz/latest/servicebus/queue/_update.py +++ b/src/azure-cli/azure/cli/command_modules/servicebus/aaz/latest/servicebus/queue/_update.py @@ -105,12 +105,6 @@ def _build_arguments_schema(cls, *args, **kwargs): help="A value that indicates whether Express Entities are enabled. An express queue holds a message in memory temporarily before writing it to persistent storage.", nullable=True, ) - _args_schema.enable_partitioning = AAZBoolArg( - options=["--enable-partitioning"], - arg_group="Properties", - help="A value that indicates whether the queue is to be partitioned across multiple message brokers.", - nullable=True, - ) _args_schema.forward_dead_lettered_messages_to = AAZStrArg( options=["--forward-dead-lettered-messages-to"], arg_group="Properties", @@ -147,18 +141,6 @@ def _build_arguments_schema(cls, *args, **kwargs): help="Maximum size of the topic in megabytes, which is the size of the memory allocated for the topic. Default is 1024.", nullable=True, ) - _args_schema.enable_duplicate_detection = AAZBoolArg( - options=["--duplicate-detection", "--enable-duplicate-detection"], - arg_group="Properties", - help="A value indicating if this queue requires duplicate detection.", - nullable=True, - ) - _args_schema.enable_session = AAZBoolArg( - options=["--enable-session"], - arg_group="Properties", - help="A value that indicates whether the queue supports the concept of sessions.", - nullable=True, - ) _args_schema.status = AAZStrArg( options=["--status"], arg_group="Properties", @@ -405,15 +387,12 @@ def _update_instance(self, instance): properties.set_prop("duplicateDetectionHistoryTimeWindow", AAZStrType, ".duplicate_detection_history_time_window") properties.set_prop("enableBatchedOperations", AAZBoolType, ".enable_batched_operations") properties.set_prop("enableExpress", AAZBoolType, ".enable_express") - properties.set_prop("enablePartitioning", AAZBoolType, ".enable_partitioning") properties.set_prop("forwardDeadLetteredMessagesTo", AAZStrType, ".forward_dead_lettered_messages_to") properties.set_prop("forwardTo", AAZStrType, ".forward_to") properties.set_prop("lockDuration", AAZStrType, ".lock_duration") properties.set_prop("maxDeliveryCount", AAZIntType, ".max_delivery_count") properties.set_prop("maxMessageSizeInKilobytes", AAZIntType, ".max_message_size_in_kilobytes") properties.set_prop("maxSizeInMegabytes", AAZIntType, ".max_size_in_megabytes") - properties.set_prop("requiresDuplicateDetection", AAZBoolType, ".enable_duplicate_detection") - properties.set_prop("requiresSession", AAZBoolType, ".enable_session") properties.set_prop("status", AAZStrType, ".status") return _instance_value From 84a435bb98cb1812e9bf405599578b6831241a1c Mon Sep 17 00:00:00 2001 From: Shubham Chaudhari Date: Thu, 18 May 2023 11:45:09 +0530 Subject: [PATCH 2/2] style fixed --- src/azure-cli/azure/cli/command_modules/servicebus/_params.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/servicebus/_params.py b/src/azure-cli/azure/cli/command_modules/servicebus/_params.py index 83a436e9290..1eea875a103 100644 --- a/src/azure-cli/azure/cli/command_modules/servicebus/_params.py +++ b/src/azure-cli/azure/cli/command_modules/servicebus/_params.py @@ -13,8 +13,7 @@ def load_arguments_sb(self, _): - from azure.cli.command_modules.servicebus._completers import get_queue_command_completion_list, \ - get_rules_command_completion_list, get_subscriptions_command_completion_list, get_topic_command_completion_list + from azure.cli.command_modules.servicebus._completers import get_rules_command_completion_list from azure.cli.command_modules.servicebus._validators import _validate_auto_delete_on_idle, \ _validate_duplicate_detection_history_time_window, \ _validate_default_message_time_to_live, \