Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EventHub - cli extension #37

Merged
merged 13 commits into from
Jan 25, 2018
14 changes: 12 additions & 2 deletions src/eventhubs/azext_eventhub/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@

helps['eventhubs namespace authorizationrule'] = """
type: group
short-summary: Manage Azure Service Bus AuthorizationRule for Namespace
short-summary: Manage Azure Event Hubs AuthorizationRule for Namespace
"""

helps['eventhubs namespace authorizationrule keys'] = """
type: group
short-summary: Manage Azure AuthorizationRule connection strings for Namespace
short-summary: Manage Azure Event Hubs AuthorizationRule connection strings for Namespace
"""

helps['eventhubs eventhub'] = """
Expand Down Expand Up @@ -50,6 +50,16 @@
short-summary: Manage Azure Event Hubs Geo Recovery configuration Alias
"""

helps['eventhubs georecovery-alias authorizationrule'] = """
type: group
short-summary: Manage Azure Event Hubs AuthorizationRule for Geo Recovery configuration Alias
"""

helps['eventhubs georecovery-alias authorizationrule keys'] = """
type: group
short-summary: Manage Azure Event Hubs AuthorizationRule connection strings for Geo Recovery configuration Alias
"""

helps['eventhubs namespace exists'] = """
type: command
short-summary: check for the availability of the given name for the Namespace
Expand Down
2 changes: 1 addition & 1 deletion src/eventhubs/azext_eventhub/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def load_arguments_eventhub(self, _):
c.argument('event_hub_name', options_list=['--event-hub-name'], help='name of the EventHub')

with self.argument_context('eventhubs eventhub authorizationrule create') as c:
c.argument('accessrights', options_list=['--access-rights'], help='AuthorizationRule rights of type list, allowed values are Send, Listen or Manage')
c.argument('accessrights', options_list=['--access-rights'], arg_type=get_enum_type(['Send', 'Listen', 'Manage']), help='AuthorizationRule rights of type list, allowed values are Send, Listen or Manage')
Copy link
Member

Choose a reason for hiding this comment

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

Please now remove , allowed values are Send, Listen or Manage') otherwise it will appear twice.

Copy link
Member Author

Choose a reason for hiding this comment

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

my bad. corrected the help text.


with self.argument_context('eventhubs eventhub authorizationrule keys renew') as c:
c.argument('key_type', options_list=['--key-name'], arg_type=get_enum_type(['PrimaryKey', 'SecondaryKey']))
Expand Down
3 changes: 3 additions & 0 deletions src/eventhubs/azext_eventhub/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ def cli_namespace_list(client, resource_group_name=None):
if resource_group_name:
cmd_result = client.list_by_resource_group(resource_group_name)

if not resource_group_name:
cmd_result = client.list()

return cmd_result
Copy link
Member

Choose a reason for hiding this comment

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

Surely you still need the client.list() for when resource_group_name is not specified.

Copy link
Member Author

Choose a reason for hiding this comment

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

added

Copy link
Member

Choose a reason for hiding this comment

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

This can really just be:

def cli_namespace_list(client, resource_group_name=None):
    if resource_group_name:
        return client.list_by_resource_group(resource_group_name)
    return client.list()

Up to you if you want to make this change though.



Expand Down