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
96 changes: 1 addition & 95 deletions src/azure-cli/azure/cli/command_modules/servicebus/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
Expand Down Expand Up @@ -55,99 +54,6 @@ def load_arguments_sb(self, _):
c.argument('zone_redundant', options_list=['--zone-redundant'], is_preview=True, arg_type=get_three_state_flag(),
help='Enabling this property creates a ServiceBus Zone Redundant Namespace in regions supported availability zones')

# region Queue
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
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:
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))
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))
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))

with self.argument_context('servicebus queue list') as c:
c.argument('namespace_name', id_part=None, options_list=['--namespace-name'], help='Name of Namespace')

# region - Topic
for scope in ['servicebus topic show', 'servicebus topic delete']:
with self.argument_context(scope) as c:
c.argument('topic_name', arg_type=name_type, id_part='child_name_1', completer=get_topic_command_completion_list, help='Name of Topic')

# region - Topic Create
for scope in ['create', 'update']:
with self.argument_context('servicebus topic {}'.format(scope)) as c:
c.argument('topic_name', arg_type=name_type, id_part='child_name_1', completer=get_topic_command_completion_list, help='Name of Topic')
c.argument('default_message_time_to_live', validator=_validate_default_message_time_to_live, help='ISO 8601 or duration time format for Default message timespan 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('max_size_in_megabytes', options_list=['--max-size'], type=int, choices=[1024, 2048, 3072, 4096, 5120, 10240, 20480, 40960, 81920], help='Maximum size of topic in megabytes, which is the size of the memory allocated for the topic. Default is 1024. Max for Standard SKU is 5120 and for Premium SKU is 81920')
c.argument('requires_duplicate_detection', options_list=['--enable-duplicate-detection'], arg_type=get_three_state_flag(), help='A boolean value indicating if this topic requires duplicate detection.')
c.argument('duplicate_detection_history_time_window', validator=_validate_duplicate_detection_history_time_window, help='ISO 8601 timespan or duration time format for structure that defines the duration of the duplicate detection history. The default value is 10 minutes.')
c.argument('enable_batched_operations', arg_type=get_three_state_flag(), help='Allow server-side batched operations.')
c.argument('status', arg_type=get_enum_type(['Active', 'Disabled', 'SendDisabled']), help='Enumerates the possible values for the status of a messaging entity.')
c.argument('support_ordering', options_list=['--enable-ordering'], arg_type=get_three_state_flag(), help='A boolean value that indicates whether the topic supports ordering.')
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 topic 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 topic to be partitioned across multiple message brokers is enabled.')
c.argument('enable_express', arg_type=get_three_state_flag(), help='A boolean value that indicates whether Express Entities are enabled. An express topic holds a message in memory temporarily before writing it to persistent storage.')
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.')

for scope in ['servicebus topic show', 'servicebus topic delete']:
with self.argument_context(scope) as c:
c.argument('topic_name', arg_type=name_type, id_part='child_name_1', completer=get_topic_command_completion_list, help='Name of Topic')

with self.argument_context('servicebus topic list') as c:
c.argument('namespace_name', id_part=None, options_list=['--namespace-name'], help='Name of Namespace')

with self.argument_context('servicebus topic subscription') as c:
c.argument('subscription_name', arg_type=name_type, id_part='child_name_2', completer=get_subscriptions_command_completion_list, help='Name of Subscription')
c.argument('topic_name', id_part='child_name_1', options_list=['--topic-name'], help='Name of Topic')

# region - Subscription Create and update
for scope in ['create', 'update']:
with self.argument_context('servicebus topic subscription {}'.format(scope)) as c:
c.argument('lock_duration', validator=_validate_lock_duration, help='ISO 8601 or duration format (day:minute:seconds) for lock duration timespan for the subscription. The default value is 1 minute.')
c.argument('requires_session', options_list=['--enable-session'], arg_type=get_three_state_flag(), help='A boolean value indicating if a subscription supports the concept of sessions.')
c.argument('default_message_time_to_live', validator=_validate_default_message_time_to_live, help='ISO 8601 or duration time format for Default message timespan 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 a subscription has dead letter support when a message expires.')
c.argument('max_delivery_count', type=int, help='Number of maximum deliveries.')
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('enable_batched_operations', arg_type=get_three_state_flag(), help='Allow server-side batched operations.')
c.argument('auto_delete_on_idle', validator=_validate_auto_delete_on_idle, options_list=['--auto-delete-on-idle'], help='ISO 8601 timeSpan or duration time format for idle interval after which the subscription is automatically deleted. The minimum duration is 5 minutes.')
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('dead_lettering_on_filter_evaluation_exceptions', options_list=['--dead-letter-on-filter-exceptions'], arg_type=get_three_state_flag(), help='Allow dead lettering when filter evaluation exceptions occur.')

with self.argument_context('servicebus topic subscription create') as c:
c.argument('is_client_affine', arg_type=get_three_state_flag(), help='Value that indicates whether the subscription has an affinity to the client id.')
c.argument('client_id', help='Indicates the Client ID of the application that created the client-affine subscription.')
c.argument('is_shared', arg_type=get_three_state_flag(), help='For client-affine subscriptions, this value indicates whether the subscription is shared or not.')
c.argument('is_durable', arg_type=get_three_state_flag(), help='For client-affine subscriptions, this value indicates whether the subscription is durable or not.')

with self.argument_context('servicebus topic subscription list') as c:
c.argument('namespace_name', options_list=['--namespace-name'], id_part=None, help='Name of Namespace')
c.argument('topic_name', options_list=['--topic-name'], id_part=None, help='Name of Topic')

# Region Subscription Rules
with self.argument_context('servicebus topic subscription rule') as c:
c.argument('rule_name', arg_type=name_type, id_part='child_name_3', completer=get_rules_command_completion_list, help='Name of Rule')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand Down