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
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ def load_arguments_sb(self, _):
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, expiration='2.45.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.45.0'))
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.45.0'))

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ def return_valid_duration(update_value, current_value=None):
from isodate import Duration
from azure.cli.core.azclierror import InvalidArgumentValueError
from azure.cli.command_modules.servicebus.constants import DURATION_SECS, DURATION_MIN, DURATION_DAYS
from argcomplete import warn
Copy link
Member

@jiasli jiasli Feb 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why using warn from argcomplete. This usage is weird.

if update_value is not None:
value_toreturn = update_value
else:
Expand All @@ -658,6 +659,7 @@ def return_valid_duration(update_value, current_value=None):
return value_toreturn

if timedeltapattern.match(value_toreturn):
warn('Please use ISO8601 duration for timespan inputs. Timespan inputs of format (days:min:seconds) would be deprecated from version 2.45.0.')
day, minute, seconds = value_toreturn.split(":")
if timedelta(days=int(day), minutes=int(minute), seconds=int(seconds)) <= timedelta(days=DURATION_DAYS,
minutes=DURATION_MIN,
Expand All @@ -673,6 +675,7 @@ def return_valid_duration_create(update_value):
from datetime import timedelta
from isodate import parse_duration
from knack.util import CLIError
import warnings
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not Azure CLI convention to use warnings module. Instead, warnings in Azure CLI is written like

if not subscriptions:
logger.warning('Please run "az login" to access your accounts.')

from azure.cli.command_modules.servicebus.constants import DURATION_SECS, DURATION_MIN, DURATION_DAYS
if update_value is not None:
if iso8601pattern.match(update_value):
Expand All @@ -681,6 +684,7 @@ def return_valid_duration_create(update_value):
'duration value should be less than (days:min:secs) 10675199:10085:477581')

if timedeltapattern.match(update_value):
warnings.warn('Please use ISO8601 duration for timespan inputs. Timespan inputs of format (days:min:seconds) would be deprecated from version 2.45.0.')
day, minute, seconds = update_value.split(":")
if timedelta(days=int(day), minutes=int(minute), seconds=int(seconds)) <= timedelta(days=DURATION_DAYS, minutes=DURATION_MIN, seconds=DURATION_SECS):
update_value = timedelta(days=int(day), minutes=int(minute), seconds=int(seconds))
Expand Down