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

Azure Event Grid 0.4.1 #633

Merged
merged 24 commits into from
Apr 11, 2019
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
2 changes: 1 addition & 1 deletion src/eventgrid/azext_eventgrid/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

def cf_eventgrid(cli_ctx, **_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azext_eventgrid.mgmt.eventgrid import EventGridManagementClient
from azext_eventgrid.vendored_sdks.eventgrid import EventGridManagementClient
return get_mgmt_service_client(cli_ctx, EventGridManagementClient)


Expand Down
34 changes: 28 additions & 6 deletions src/eventgrid/azext_eventgrid/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

helps['eventgrid'] = """
type: group
short-summary: Manage Azure Event Grid topics, event subscriptions and domains.
short-summary: Manage Azure Event Grid topics, event subscriptions, domains and domain topics.
"""
helps['eventgrid topic'] = """
type: group
Expand Down Expand Up @@ -123,7 +123,21 @@
"""
helps['eventgrid domain topic'] = """
type: group
short-summary: View information about topics in a domain.
short-summary: Manage event domain topics.
"""
helps['eventgrid domain topic create'] = """
type: command
short-summary: Create a domain topic under a domain.
examples:
- name: Create a new domain topic under domain.
text: az eventgrid domain topic create -g rg1 --domain-name domain1 --name domaintopic1
"""
helps['eventgrid domain topic delete'] = """
type: command
short-summary: Delete a domain topic under a domain.
examples:
- name: Delete a domain topic.
text: az eventgrid domain topic delete -g rg1 --domain-name domain1 --name domaintopic1
"""
helps['eventgrid domain key list'] = """
type: command
Expand All @@ -138,14 +152,14 @@
short-summary: List available topics in a domain.
examples:
- name: List all topics in a domain.
text: az eventgrid domain topic list -g rg1 -n domain1
text: az eventgrid domain topic list -g rg1 --domain-name domain1
"""
helps['eventgrid domain topic show'] = """
type: command
short-summary: Get the details of a domain topic.
examples:
- name: Show the details of a domain topic.
text: az eventgrid domain topic show -g rg1 -n domain1 --topic-name topic1
text: az eventgrid domain topic show -g rg1 --domain-name domain1 --name topic1
"""
helps['eventgrid event-subscription'] = """
type: group
Expand Down Expand Up @@ -188,7 +202,8 @@
long-summary: |
Example: --deadletter-endpoint /subscriptions/{SubID}/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/sa1/blobServices/default/containers/containerName
- name: --endpoint-type
short-summary: The type of the destination endpoint.
short-summary: The type of the destination endpoint. It is expected that the destination endpoint be created and available for use before executing any Event Grid command.

examples:
- name: Create a new event subscription for an Event Grid topic, using default filters.
text: |
Expand Down Expand Up @@ -241,6 +256,13 @@
--source-resource-id /subscriptions/{SubID} \\
--endpoint-type storagequeue \\
--endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/sa1/queueservices/default/queues/q1
- name: Create a new event subscription for an Azure subscription, using default filters, and an Azure ServiceBusQueue as a destination.
text: |
az eventgrid event-subscription create --name es2 \\
--source-resource-id /subscriptions/{SubID} \\
--endpoint-type servicebusqueue \\
--endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ns1/queues/queue1

- name: Create a new event subscription for an Event Grid domain, using default filters, and CloudEventV01 as the delivery schema.
text: |
az eventgrid event-subscription create --name es2 \\
Expand Down Expand Up @@ -396,7 +418,7 @@
az eventgrid event-subscription list --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/domains/d1
- name: List all event subscriptions for an Event Grid domain topic.
text: |
az eventgrid event-subscription list --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/domains/d1/topics/topic1"
az eventgrid event-subscription list --source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/domains/d1/topics/topic1
- name: List all Storage event subscriptions (under the currently selected Azure subscription) in westus2.
text: |
az eventgrid event-subscription list --topic-type Microsoft.Storage.StorageAccounts --location westus2
Expand Down
56 changes: 45 additions & 11 deletions src/eventgrid/azext_eventgrid/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from .advanced_filter import EventSubscriptionAddFilter

included_event_types_type = CLIArgumentType(
help="A space-separated list of event types. Example: Microsoft.Storage.BlobCreated Microsoft.Storage.BlobDeleted. To subscribe to all event types, the string \"All\" should be specified.",
help="A space-separated list of event types. Example: Microsoft.Storage.BlobCreated Microsoft.Storage.BlobDeleted. To subscribe to all default event types, do not specify any value for this argument.",
nargs='+'
)

Expand All @@ -44,15 +44,32 @@
arg_type=tags_type
)

odata_query_type = CLIArgumentType(
help="The query used to filter the results using OData syntax.",
options_list=['--odata-query']
)

domain_name_type = CLIArgumentType(
help='Name of the domain.',
arg_type=name_type,
options_list=['--domain-name'],
completer=get_resource_name_completion_list('Microsoft.EventGrid/domains'))

domain_topic_name_type = CLIArgumentType(
help='Name of the domain topic.',
arg_type=name_type,
options_list=['--domain-topic-name'],
completer=get_resource_name_completion_list('Microsoft.EventGrid/domains/topic'))


def load_arguments(self, _):
def load_arguments(self, _): # pylint: disable=too-many-statements
with self.argument_context('eventgrid') as c:
c.argument('resource_group_name', arg_type=resource_group_name_type)
c.argument('location', arg_type=get_location_type(self.cli_ctx))
c.argument('tags', arg_type=tags_type)
c.argument('included_event_types', arg_type=included_event_types_type)
c.argument('labels', arg_type=labels_type)
c.argument('endpoint_type', arg_type=get_enum_type(['webhook', 'eventhub', 'storagequeue', 'hybridconnection'], default='webhook'))
c.argument('endpoint_type', arg_type=get_enum_type(['webhook', 'eventhub', 'storagequeue', 'hybridconnection', 'servicebusqueue'], default='webhook'))
c.argument('source_resource_id', help="Fully qualified identifier of the source Azure resource.")
c.argument('resource_id', deprecate_info=c.deprecate(redirect="--source-resource-id", expiration='2.1.0', hide=True), help="Fully qualified identifier of the Azure resource.")
c.argument('endpoint', help="Endpoint where EventGrid should deliver events matching this event subscription. For webhook endpoint type, this should be the corresponding webhook URL. For other endpoint types, this should be the Azure resource identifier of the endpoint.")
Expand All @@ -64,25 +81,39 @@ def load_arguments(self, _):
c.argument('input_mapping_fields', arg_type=input_mapping_fields_type)
c.argument('input_mapping_default_values', arg_type=input_mapping_default_values_type)
c.argument('input_schema', arg_type=input_schema_type)
c.argument('odata_query', arg_type=odata_query_type)
c.argument('domain_name', arg_type=domain_name_type)
c.argument('domain_topic_name', arg_type=domain_topic_name_type)

with self.argument_context('eventgrid topic') as c:
c.argument('topic_name', arg_type=name_type, help='Name of the topic', id_part='name', completer=get_resource_name_completion_list('Microsoft.EventGrid/topics'))
c.argument('topic_name', arg_type=name_type, help='Name of the topic.', id_part='name', completer=get_resource_name_completion_list('Microsoft.EventGrid/topics'))

with self.argument_context('eventgrid topic key list') as c:
with self.argument_context('eventgrid topic key') as c:
c.argument('topic_name', arg_type=name_type, help='Name of the topic', id_part=None, completer=get_resource_name_completion_list('Microsoft.EventGrid/topics'))

with self.argument_context('eventgrid topic list') as c:
c.argument('odata_query', arg_type=odata_query_type, id_part=None)

with self.argument_context('eventgrid domain') as c:
c.argument('domain_name', arg_type=name_type, help='Name of the domain', id_part='name', completer=get_resource_name_completion_list('Microsoft.EventGrid/domains'))
c.argument('domain_name', arg_type=domain_name_type, options_list=['--name', '-n'], id_part='name')

with self.argument_context('eventgrid domain list') as c:
c.argument('odata_query', arg_type=odata_query_type, id_part=None)

with self.argument_context('eventgrid domain key list') as c:
c.argument('domain_name', arg_type=name_type, help='Name of the domain', id_part=None, completer=get_resource_name_completion_list('Microsoft.EventGrid/domains'))
with self.argument_context('eventgrid domain key') as c:
c.argument('domain_name', arg_type=domain_name_type, options_list=['--name', '-n'], id_part=None)

with self.argument_context('eventgrid domain topic') as c:
c.argument('domain_name', arg_type=domain_name_type, id_part='name')
c.argument('domain_topic_name', arg_type=domain_topic_name_type, options_list=['--name', '-n'], id_part='topics')

with self.argument_context('eventgrid domain topic list') as c:
c.argument('domain_name', arg_type=name_type, help='Name of the domain', id_part=None, completer=get_resource_name_completion_list('Microsoft.EventGrid/domains'))
c.argument('domain_name', arg_type=domain_name_type, id_part=None)
c.argument('odata_query', arg_type=odata_query_type, id_part=None)

with self.argument_context('eventgrid event-subscription') as c:
c.argument('topic_name', deprecate_info=c.deprecate(expiration='2.1.0', hide=True), help='Name of Event Grid topic', options_list=['--topic-name'], completer=get_resource_name_completion_list('Microsoft.EventGrid/topics'))
c.argument('event_subscription_name', arg_type=name_type, help='Name of the event subscription')
c.argument('topic_name', deprecate_info=c.deprecate(expiration='2.1.0', hide=True), help='Name of Event Grid topic.', options_list=['--topic-name'], completer=get_resource_name_completion_list('Microsoft.EventGrid/topics'))
c.argument('event_subscription_name', arg_type=name_type, help='Name of the event subscription.')
c.argument('event_delivery_schema', arg_type=get_enum_type(['eventgridschema', 'custominputschema', 'cloudeventv01schema']), help='The schema in which events should be delivered for this event subscription. By default, events will be delivered in the same schema in which they are published (based on the corresponding topic\'s input schema).')
c.argument('max_delivery_attempts', help="Maximum number of delivery attempts. Must be a number between 1 and 30.")
c.argument('event_ttl', help="Event time to live (in minutes). Must be a number between 1 and 1440.")
Expand All @@ -99,6 +130,9 @@ def load_arguments(self, _):
with self.argument_context('eventgrid event-subscription update') as c:
c.argument('resource_group_name', deprecate_info=c.deprecate(expiration='2.1.0', hide=True), arg_type=resource_group_name_type)

with self.argument_context('eventgrid event-subscription list') as c:
c.argument('odata_query', arg_type=odata_query_type, id_part=None)

with self.argument_context('eventgrid event-subscription show') as c:
c.argument('resource_group_name', deprecate_info=c.deprecate(expiration='2.1.0', hide=True), arg_type=resource_group_name_type)
c.argument('include_full_endpoint_url', arg_type=get_three_state_flag(), options_list=['--include-full-endpoint-url'], help="Specify to indicate whether the full endpoint URL should be returned. True if flag present.", )
Expand Down
2 changes: 1 addition & 1 deletion src/eventgrid/azext_eventgrid/advanced_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import argparse
from knack.util import CLIError

from azext_eventgrid.mgmt.eventgrid.models import (
from azext_eventgrid.vendored_sdks.eventgrid.models import (
NumberGreaterThanAdvancedFilter,
NumberGreaterThanOrEqualsAdvancedFilter,
NumberInAdvancedFilter,
Expand Down
14 changes: 8 additions & 6 deletions src/eventgrid/azext_eventgrid/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@

def load_command_table(self, _):
topics_mgmt_util = CliCommandType(
operations_tmpl='azext_eventgrid.mgmt.eventgrid.operations.topics_operations#TopicsOperations.{}',
operations_tmpl='azext_eventgrid.vendored_sdks.eventgrid.operations.topics_operations#TopicsOperations.{}',
client_factory=topics_factory,
client_arg_name='self'
)

domains_mgmt_util = CliCommandType(
operations_tmpl='azext_eventgrid.mgmt.eventgrid.operations.domains_operations#DomainsOperations.{}',
operations_tmpl='azext_eventgrid.vendored_sdks.eventgrid.operations.domains_operations#DomainsOperations.{}',
client_factory=domains_factory,
client_arg_name='self'
)

domain_topics_mgmt_util = CliCommandType(
operations_tmpl='azext_eventgrid.mgmt.eventgrid.operations.domain_topics_operations#DomainTopicsOperations.{}',
operations_tmpl='azext_eventgrid.vendored_sdks.eventgrid.operations.domain_topics_operations#DomainTopicsOperations.{}',
client_factory=domain_topics_factory,
client_arg_name='self'
)

topic_type_mgmt_util = CliCommandType(
operations_tmpl='azext_eventgrid.mgmt.eventgrid.operations.topic_types_operations#TopicTypesOperations.{}',
operations_tmpl='azext_eventgrid.vendored_sdks.eventgrid.operations.topic_types_operations#TopicTypesOperations.{}',
client_factory=topic_types_factory,
client_arg_name='self'
)
Expand All @@ -48,15 +48,17 @@ def load_command_table(self, _):

with self.command_group('eventgrid domain topic', domain_topics_mgmt_util, client_factory=domain_topics_factory) as g:
g.command('show', 'get')
g.command('list', 'list_by_domain')
g.custom_command('list', 'cli_domain_topic_list')
g.custom_command('delete', 'cli_domain_topic_delete')
g.custom_command('create', 'cli_domain_topic_create_or_update')

with self.command_group('eventgrid domain', domains_mgmt_util, client_factory=domains_factory) as g:
g.command('show', 'get')
g.command('key list', 'list_shared_access_keys')
g.command('key regenerate', 'regenerate_key')
g.command('delete', 'delete')
g.custom_command('list', 'cli_domain_list')
g.custom_command('create', 'cli_domain_create_or_update')
g.command('delete', 'delete')
g.generic_update_command('update',
getter_name='get',
setter_name='update',
Expand Down
Loading