-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
EventGrid extension for 2018-05-01-preview features #147
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b09ba7c
Initial commit based on current azure-cli-eventgrid version.
kalyanaj 3c79218
Add new SDK based on 2018-05-01-preview version.
kalyanaj c3244eb
CLI changes for EventGrid 2018-05-01-preview version.
kalyanaj f4fc4a9
Implementation for new commands and corresponding tests.
kalyanaj ebc5e5a
Updated test recordings.
kalyanaj 6cee3d1
Updated help text / minor refactoring.
kalyanaj 7dbe65d
Include extension metadata.
kalyanaj eeb674c
Linter fixes.
kalyanaj eb977c6
Merge remote-tracking branch 'upstream/master'
kalyanaj 51f7d1e
Fixes for flake8 issues.
kalyanaj 9b01f18
Updating CODEOWNERS file for eventgrid.
kalyanaj 7c09533
Incorporated CR feedback.
kalyanaj a942baa
Added missing license header.
kalyanaj 6ca9fee
Fixed event subscription update to honor the new endpoint types.
kalyanaj e752404
Flake8 fixes.
kalyanaj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,6 @@ | |
|
||
/src/dns/ @muwaqar | ||
|
||
/src/signalr/ @zackliu | ||
/src/signalr/ @zackliu | ||
|
||
/src/eventgrid/ @kalyanaj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
from azure.cli.core import AzCommandsLoader | ||
|
||
import azext_eventgrid._help # pylint: disable=unused-import | ||
|
||
|
||
class EventGridCommandsLoader(AzCommandsLoader): | ||
|
||
def __init__(self, cli_ctx=None): | ||
from azure.cli.core.commands import CliCommandType | ||
eventgrid_custom = CliCommandType(operations_tmpl='azext_eventgrid.custom#{}') | ||
super(EventGridCommandsLoader, self).__init__(cli_ctx=cli_ctx, | ||
custom_command_type=eventgrid_custom, | ||
min_profile='2017-03-10-profile') | ||
|
||
def load_command_table(self, args): | ||
from .commands import load_command_table | ||
load_command_table(self, args) | ||
return self.command_table | ||
|
||
def load_arguments(self, command): | ||
from ._params import load_arguments | ||
load_arguments(self, command) | ||
|
||
|
||
COMMAND_LOADER_CLS = EventGridCommandsLoader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
|
||
def cf_eventgrid(cli_ctx, **_): | ||
from azure.cli.core.commands.client_factory import get_mgmt_service_client | ||
from azext_eventgrid.mgmt.eventgrid import EventGridManagementClient | ||
return get_mgmt_service_client(cli_ctx, EventGridManagementClient) | ||
|
||
|
||
def topics_factory(cli_ctx, _): | ||
return cf_eventgrid(cli_ctx).topics | ||
|
||
|
||
def event_subscriptions_factory(cli_ctx, _): | ||
return cf_eventgrid(cli_ctx).event_subscriptions | ||
|
||
|
||
def topic_types_factory(cli_ctx, _): | ||
return cf_eventgrid(cli_ctx).topic_types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,217 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
# pylint: disable=line-too-long | ||
|
||
from knack.help_files import helps # pylint: disable=unused-import | ||
|
||
|
||
helps['eventgrid'] = """ | ||
type: group | ||
short-summary: Manage Azure Event Grid topics and subscriptions. | ||
""" | ||
helps['eventgrid topic'] = """ | ||
type: group | ||
short-summary: Manage Azure Event Grid topics. | ||
""" | ||
helps['eventgrid topic create'] = """ | ||
type: command | ||
short-summary: Create a topic. | ||
examples: | ||
- name: Create a new topic. | ||
text: az eventgrid topic create -g rg1 --name topic1 -l westus2 | ||
- name: Create a new topic with custom input mappings. | ||
text: az eventgrid topic create -g rg1 --name topic1 -l westus2 --input-schema customeventschema --input-mapping-fields topic=myTopicField eventType=myEventTypeField --input-mapping-default-values subject=DefaultSubject dataVersion=1.0 | ||
- name: Create a new topic that accepts events published in CloudEvents V0.1 schema. | ||
text: az eventgrid topic create -g rg1 --name topic1 -l westus2 --input-schema cloudeventv01 | ||
""" | ||
helps['eventgrid topic update'] = """ | ||
type: command | ||
short-summary: Update a topic. | ||
examples: | ||
- name: Update the properties of an existing topic. | ||
text: az eventgrid topic update -g rg1 --name topic1 --tags Dept=IT | ||
""" | ||
helps['eventgrid topic delete'] = """ | ||
type: command | ||
short-summary: Delete a topic. | ||
examples: | ||
- name: Delete a topic. | ||
text: az eventgrid topic delete -g rg1 --name topic1 | ||
""" | ||
helps['eventgrid topic list'] = """ | ||
type: command | ||
short-summary: List available topics. | ||
examples: | ||
- name: List all topics in the current Azure subscription. | ||
text: az eventgrid topic list | ||
- name: List all topics in a resource group. | ||
text: az eventgrid topic list -g rg1 | ||
""" | ||
helps['eventgrid topic show'] = """ | ||
type: command | ||
short-summary: Get the details of a topic. | ||
examples: | ||
- name: Show the details of a topic. | ||
text: az eventgrid topic show -g rg1 -n topic1 | ||
- name: Show the details of a topic based on resource ID. | ||
text: az eventgrid topic show --ids /subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/kalstest/providers/Microsoft.EventGrid/topics/topic1 | ||
""" | ||
helps['eventgrid topic key'] = """ | ||
type: group | ||
short-summary: Manage shared access keys of a topic. | ||
""" | ||
helps['eventgrid topic key list'] = """ | ||
type: command | ||
short-summary: List shared access keys of a topic. | ||
""" | ||
helps['eventgrid topic key regenerate'] = """ | ||
type: command | ||
short-summary: Regenerate a shared access key of a topic. | ||
""" | ||
helps['eventgrid event-subscription'] = """ | ||
type: group | ||
short-summary: Manage event subscriptions for an Event Grid topic or for an Azure resource. | ||
""" | ||
helps['eventgrid event-subscription create'] = """ | ||
type: command | ||
short-summary: Create a new event subscription for an Event Grid topic or for an Azure resource. | ||
examples: | ||
- name: Create a new event subscription for an Event Grid topic, using default filters. | ||
text: | | ||
az eventgrid event-subscription create -g rg1 --topic-name topic1 --name es1 \\ | ||
--endpoint https://contoso.azurewebsites.net/api/f1?code=code | ||
- name: Create a new event subscription for a subscription, using default filters. | ||
text: | | ||
az eventgrid event-subscription create --name es2 \\ | ||
--endpoint https://contoso.azurewebsites.net/api/f1?code=code | ||
- name: Create a new event subscription for a resource group, using default filters. | ||
text: | | ||
az eventgrid event-subscription create -g rg1 --name es3 \\ | ||
--endpoint https://contoso.azurewebsites.net/api/f1?code=code | ||
- name: Create a new event subscription for a storage account, using default filters. | ||
text: | | ||
az eventgrid event-subscription create --resource-id "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/kalstest/providers/Microsoft.Storage/storageaccounts/kalsegblob" --name es3 \\ | ||
--endpoint https://contoso.azurewebsites.net/api/f1?code=code | ||
- name: Create a new event subscription for a subscription, with a filter specifying a subject prefix. | ||
text: | | ||
az eventgrid event-subscription create --name es4 \\ | ||
--endpoint https://contoso.azurewebsites.net/api/f1?code=code \\ | ||
--subject-begins-with mysubject_prefix | ||
- name: Create a new event subscription for a resource group, with a filter specifying a subject suffix. | ||
text: | | ||
az eventgrid event-subscription create -g rg2 --name es5 \\ | ||
--endpoint https://contoso.azurewebsites.net/api/f1?code=code \\ | ||
--subject-ends-with mysubject_suffix | ||
- name: Create a new event subscription for a subscription, using default filters, and an EventHub as a destination. | ||
text: | | ||
az eventgrid event-subscription create --name es2 --endpoint-type eventhub \\ | ||
--endpoint /subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1 | ||
- name: Create a new event subscription for a subscription, using default filters, and an Azure Storage queue as a destination. | ||
text: | | ||
az eventgrid event-subscription create --name es2 --endpoint-type storagequeue \\ | ||
--endpoint /subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/sa1/queueservices/default/queues/queue1 | ||
- name: Create a new event subscription for a subscription, using default filters, and CloudEventV01 as the delivery schema. | ||
text: | | ||
az eventgrid event-subscription create --name es2 --endpoint https://contoso.azurewebsites.net/api/f1?code=code --event-delivery-schema cloudeventv01schema | ||
""" | ||
helps['eventgrid event-subscription update'] = """ | ||
type: command | ||
short-summary: Update an event subscription. | ||
examples: | ||
- name: Update an event subscription for an Event Grid topic to specify a new endpoint. | ||
text: | | ||
az eventgrid event-subscription update -g rg1 --topic-name topic1 --name es1 \\ | ||
--endpoint https://contoso.azurewebsites.net/api/f1?code=code | ||
- name: Update an event subscription for a subscription to specify a new subject-ends-with filter. | ||
text: | | ||
az eventgrid event-subscription update --name es2 --subject-ends-with .jpg | ||
- name: Update an event subscription for a resource group to specify a new endpoint and a new subject-ends-with filter. | ||
text: | | ||
az eventgrid event-subscription update -g rg1 --name es3 --subject-ends-with .png \\ | ||
--endpoint https://contoso.azurewebsites.net/api/f1?code=code | ||
- name: Update an event subscription for a storage account to specify a new list of included event types. | ||
text: | | ||
az eventgrid event-subscription update --resource-id "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/kalstest/providers/microsoft.storage/storageaccounts/kalsegblob" --name es3 \\ | ||
--included-event-types Microsoft.Storage.BlobCreated Microsoft.Storage.BlobDeleted | ||
""" | ||
helps['eventgrid event-subscription delete'] = """ | ||
type: command | ||
short-summary: Delete an event subscription. | ||
examples: | ||
- name: Delete an event subscription for an Event Grid topic. | ||
text: | | ||
az eventgrid event-subscription delete -g rg1 --topic-name topic1 --name es1 | ||
- name: Delete an event subscription for a subscription. | ||
text: | | ||
az eventgrid event-subscription delete --name es2 | ||
- name: Delete an event subscription for a resource group. | ||
text: | | ||
az eventgrid event-subscription delete -g rg1 --name es3 | ||
- name: Delete an event subscription for a storage account. | ||
text: | | ||
az eventgrid event-subscription delete --resource-id "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/kalstest/providers/microsoft.storage/storageaccounts/kalsegblob" --name es3 | ||
""" | ||
helps['eventgrid event-subscription list'] = """ | ||
type: command | ||
short-summary: List event subscriptions. | ||
examples: | ||
- name: List all event subscriptions for an Event Grid topic. | ||
text: | | ||
az eventgrid event-subscription list -g rg1 --topic-name topic1 | ||
- name: List all event subscriptions for a storage account. | ||
text: | | ||
az eventgrid event-subscription list --resource-id /subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/kalstest/providers/Microsoft.Storage/storageaccounts/kalsegblob | ||
- name: List all event subscriptions for a topic-type in a specific location (under the currently selected Azure subscription). | ||
text: | | ||
az eventgrid event-subscription list --topic-type Microsoft.Storage.StorageAccounts --location westus2 | ||
- name: List all event subscriptions for a topic-type in a specific location under a specified resource group. | ||
text: | | ||
az eventgrid event-subscription list --topic-type Microsoft.Storage.StorageAccounts --location westus2 --resource-group kalstest | ||
- name: List all regional event subscriptions in a specific location (under the currently selected Azure subscription). | ||
text: | | ||
az eventgrid event-subscription list --location westus2 | ||
- name: List all event subscriptions in a specific location under a specified resource group. | ||
text: | | ||
az eventgrid event-subscription list --location westus2 --resource-group kalstest | ||
- name: List all global event subscriptions (under the currently selected Azure subscription). | ||
text: | | ||
az eventgrid event-subscription list | ||
- name: List all global event subscriptions under the currently selected resource group. | ||
text: | | ||
az eventgrid event-subscription list --resource-group kalstest | ||
""" | ||
helps['eventgrid event-subscription show'] = """ | ||
type: command | ||
short-summary: Get the details of an event subscription. | ||
examples: | ||
- name: Show the details of an event subscription for an Event Grid topic. | ||
text: | | ||
az eventgrid event-subscription show -g rg1 --topic-name topic1 --name es1 | ||
- name: Show the details of an event subscription for a subscription. | ||
text: | | ||
az eventgrid event-subscription show --name es2 | ||
- name: Show the details of an event subscription for a resource group. | ||
text: | | ||
az eventgrid event-subscription show -g rg1 --name es3 | ||
- name: Show the details of an event subscription for a storage account. | ||
text: | | ||
az eventgrid event-subscription show --resource-id "/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/kalstest/providers/microsoft.storage/storageaccounts/kalsegblob" --name es3 | ||
""" | ||
helps['eventgrid topic-type'] = """ | ||
type: group | ||
short-summary: Get details for topic types. | ||
""" | ||
helps['eventgrid topic-type list'] = """ | ||
type: command | ||
short-summary: List registered topic types. | ||
""" | ||
helps['eventgrid topic-type show'] = """ | ||
type: command | ||
short-summary: Get the details for a topic type. | ||
""" | ||
helps['eventgrid topic-type list-event-types'] = """ | ||
type: command | ||
short-summary: List the event types supported by a topic type. | ||
""" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it likely that
az eventgrid topic-type event-types
would become a group with multiple commands underneath in the near future?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, there are no plans to make it a separate group.