ServiceBus CLI Extension#31
Conversation
…into SBmasterExt
…into SBmasterExt
|
@v-Ajnava Is this ready for review? |
|
@derekbekoe yes, you can review it. |
|
|
||
| helps['servicebus'] = """ | ||
| type: group | ||
| short-summary: Manage Azure ServiceBus namespace, queue, topic, subscription, rule and geo disaster recovery configuration - alias |
There was a problem hiding this comment.
I believe the proper service name is 'Service Bus' not 'ServiceBus'.
Can you change this in the help file?
|
|
||
| # pylint: disable=unused-import | ||
|
|
||
|
|
There was a problem hiding this comment.
Load the _helps file here otherwise it won't be loaded and so no help is shown.
| type: command | ||
| short-summary: check for the availability of the given name for the Namespace | ||
| examples: | ||
| - name: Create a new topic. |
There was a problem hiding this comment.
The description title is wrong?
How does servicebus namespace check-name-availability create a new topic?
| short-summary: check for the availability of the given name for the Namespace | ||
| examples: | ||
| - name: Create a new topic. | ||
| text: az servicebus namespace check_name_availability --name mynamespace |
There was a problem hiding this comment.
check_name_availability -> check-name-availability
| examples: | ||
| - name: Create a new namespace. | ||
| text: helps['az servicebus namespace create --resource-group myresourcegroup --name mynamespace --location westus | ||
| --tags ['tag1: value1', 'tag2: value2'] --sku-name Standard --sku-tier Standard'] |
There was a problem hiding this comment.
Bad help text.
Remove the 'helps' and make sure it's a command that can actually be executed.
There was a problem hiding this comment.
My Bad, i had observed it but missed to change it. its now resolved
|
|
||
| helps['servicebus namespace authorizationrule list-keys'] = """ | ||
| type: command | ||
| short-summary: Shows the connectionstrings of AuthorizatioRule for the namespace |
There was a problem hiding this comment.
connectionstrings should be two words not one.
| c.argument('correlation_id', options_list=['--correlation-id'], help='Identifier of the correlation.') | ||
| c.argument('message_id', options_list=['--message-id'], help='Identifier of the message.') | ||
| c.argument('to', options_list=['--to'], help='Address to send to.') | ||
| c.argument('reply_to', options_list=['--reply_to'], help='Address of the queue to reply to.') |
| author_email='v-ajnava@microsoft.com', | ||
| url='https://github.com/Azure/azure-cli-extensions', | ||
| classifiers=CLASSIFIERS, | ||
| packages=find_packages(), |
There was a problem hiding this comment.
Change to find_packages(exclude=["tests"])
There was a problem hiding this comment.
Let me know if the CI tests check fails because of this.
Ideally we don't want tests in the built package.
| name='servicebus', | ||
| version=VERSION, | ||
| description='An Azure CLI Extension to manage servicebus resources', | ||
| long_description='An Azure CLI Extension to manage servicebus resources', |
| ' --alias {aliasname}') | ||
|
|
||
| getaliasafterbreak = self.cmd( | ||
| 'servicebus georecovery-alias show --resource-group {rg} --namespace-name {namespacenameprimary} --alias {aliasname}').output |
There was a problem hiding this comment.
You can use get_output_in_json() so no need to do the json.loads.
|
@derekbekoe , we have below cmdlet name changes regenerate-keys to keys renew |
There was a problem hiding this comment.
@v-Ajnava I started reviewing but there are still multiple things wrong with this PR. This is what I have noted down so far.
Also, there are still some typos such as with --name in az servicebus namespace exists
| examples: | ||
| - name: Create a Service Bus Namespace. | ||
| text: az servicebus namespace create --resource-group myresourcegroup --name mynamespace --location westus | ||
| --tags ['tag1' 'value1', 'tag2' 'value2'] --sku-name Standard --sku-tier Standard |
There was a problem hiding this comment.
--tags tag1=value1 tag2=value2
What you currently have doesn't work.
| short-summary: Shows the Service Bus Namespace details | ||
| examples: | ||
| - name: shows the Namespace details. | ||
| text: helps['az servicebus namespace show --resource-group myresourcegroup --name mynamespace'] |
There was a problem hiding this comment.
az servicebus namespace show --resource-group myresourcegroup --name mynamespace
What you currently have doesn't work.
| short-summary: List the Service Bus Namespaces by ResourceGroup or by subscription | ||
| examples: | ||
| - name: Get the Service Bus Namespaces by resource Group. | ||
| text: helps['az servicebus namespace list --resource-group myresourcegroup'] |
|
|
||
| helps['servicebus namespace list'] = """ | ||
| type: command | ||
| short-summary: List the Service Bus Namespaces by ResourceGroup or by subscription |
There was a problem hiding this comment.
Remove ' by ResourceGroup or by subscription'.
This follows the convention of other list commands.
| type: command | ||
| short-summary: List the Service Bus Namespaces by ResourceGroup or by subscription | ||
| examples: | ||
| - name: Get the Service Bus Namespaces by resource Group. |
| examples: | ||
| - name: Creates Authorizationrule 'myauthorule' for the given Service Bus Namespace 'mynamepsace' in resourcegroup | ||
| text: az servicebus namespace authorizationrule create --resource-group myresourcegroup --namespace-name mynamespace | ||
| --name myauthorule --access-rights [Send, Listen] |
There was a problem hiding this comment.
This won't work. If you want both Send and Listen it should be --access-rights Send Listen I guess...
| examples: | ||
| - name: Creates Service Bus Queue. | ||
| text: az sb queue create --resource-group myresourcegroup --namespace-name mynamespace --name myqueue | ||
| """ |
There was a problem hiding this comment.
There's no command az sb queue create.
Should this be az servicebus queue create?
| examples: | ||
| - name: Creates Authorization rules for Queue | ||
| text: az servicebus queue authorizationrule create --resource-group myresourcegroup --namespace-name mynamespace | ||
| --queue-name myqueue --name myauthorule --access-rights [Listen] |
| short-summary: Creates the Service Bus Topic | ||
| examples: | ||
| - name: Create a new queue. | ||
| text: az servicebus topic create --resource-group myresourcegroup --namespace-name mynamespace --name {topicname} |
There was a problem hiding this comment.
Remove {} around {topicname}
| short-summary: Shows the Service Bus Topic Details | ||
| examples: | ||
| - name: Shows the Topic details. | ||
| text: az sb topic get --resource-group myresourcegroup --namespace-name mynamespace --name {topicname} |
There was a problem hiding this comment.
Same here.
And there is no az sb topic show command.
|
@derekbekoe, have fixed the help issues. |
…into SBmasterExt
derekbekoe
left a comment
There was a problem hiding this comment.
If the change to _params.py is too much for you to change, you can leave as is. Just note that arguments_context doesn't have to apply to a specific command. It can apply to a whole group such as all commands under servicebus. This would have made the params.py a lot smaller as a lot of the params are just duplicated.
|
|
||
| helps['servicebus queue authorizationrule keys list'] = """ | ||
| type: command | ||
| short-summary: Shows the connectionstrings of AuthorizationRule for the Queue. |
There was a problem hiding this comment.
Shouldn't 'connectionstrings' be two words?
| # pylint: disable=line-too-long | ||
| def load_arguments_namespace(self, _): | ||
| with self.argument_context('servicebus namespace exists') as c: | ||
| c.argument('namespace_name', options_list=['--name'], help='name of the Namespace') |
There was a problem hiding this comment.
For all --name options, also add -n to the list so short options work. They are very common in the CLI.
| c.argument('namespace_name', options_list=['--name', '-n'], help='name of the Namespace') | ||
|
|
||
| with self.argument_context('servicebus namespace list') as c: | ||
| c.argument('resource_group_name', arg_type=resource_group_name_type) |
There was a problem hiding this comment.
Do this at the start of _params.py.
Then you don't have to keep on doing it for each command as it will apply for all.
Then you can remove all the c.argument('resource_group_name', arg_type=resource_group_name_type,) everywhere.
with self.argument_context('servicebus') as c:
c.argument('resource_group_name', arg_type=resource_group_name_type)
| --name myauthorule | ||
| """ | ||
|
|
||
| helps['sb queue create'] = """ |
| text: az servicebus topic create --resource-group myresourcegroup --namespace-name mynamespace --name mytopic | ||
| """ | ||
|
|
||
| helps['sb topic show'] = """ |
| --subscription-name mysubscription --name myrule | ||
| """ | ||
|
|
||
| helps['sb rule list'] = """ |
|
Looks good. You can set the min version to 2.0.25. |
|
@derekbekoe I added the metadata file. |
This checklist is used to make sure that common guidelines for a pull request are followed.
General Guidelines
./scripts/ci/test_static.shlocally? (pip install pylint flake8required)python scripts/ci/test_integration.py -qlocally?