Skip to content

Commit 3c4f257

Browse files
Rakshith Bhyravabhotlaswathipil
Rakshith Bhyravabhotla
andauthored
Improve samples in EG (#16821)
* Add async samples * changes - 2 * update links * fix samples * add secret * links * fix * more links * more changes * read me link * Apply suggestions from code review Co-authored-by: swathipil <[email protected]> * chagens * delete md file * add more samples * ci * Apply suggestions from code review Co-authored-by: swathipil <[email protected]> Co-authored-by: swathipil <[email protected]>
1 parent 890de77 commit 3c4f257

File tree

44 files changed

+704
-547
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+704
-547
lines changed

scripts/devops_tasks/test_run_samples.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@
2424
"azure-eventgrid": [
2525
"__init__.py",
2626
"consume_cloud_events_from_eventhub.py",
27-
"consume_cloud_events_from_service_bus_queue.py",
28-
"consume_cloud_events_from_storage_queue.py"],
27+
"consume_eventgrid_events_from_service_bus_queue.py",
28+
"consume_cloud_events_from_storage_queue.py",
29+
"sample_publish_events_to_a_topic_using_sas_credential.py",
30+
"sample_publish_events_to_a_topic_using_sas_credential_async.py"],
2931
"azure-eventhub": [
3032
"authenticate_with_sas_token.py",
3133
"connection_to_custom_endpoint_address.py",

sdk/eventgrid/azure-eventgrid/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ The following section provides several code snippets illustrating common pattern
145145

146146
These code samples show common champion scenario operations with the Azure Event Grid client library.
147147

148-
* Publish Custom Events to a topic: [cs1_publish_custom_events_to_a_topic.py][python-eg-sample-customevent]
149-
* Publish Custom events to a domain topic: [cs2_publish_custom_events_to_a_domain_topic.py][python-eg-sample-customevent-to-domain]
150-
* Publish a Cloud Event: [cs6_publish_events_using_cloud_events_1.0_schema.py][python-eg-sample-send-cloudevent]
148+
* Publish EventGrid Events to a topic: [sample_publish_eg_events_to_a_topic.py][python-eg-sample-egevent]
149+
* Publish EventGrid Events to a domain: [sample_publish_eg_events_to_a_domain.py][python-eg-sample-egevent-to-domain]
150+
* Publish a Cloud Event: [sample_publish_events_using_cloud_events_1.0_schema.py][python-eg-sample-send-cloudevent]
151151

152152
More samples can be found [here][python-eg-samples].
153153

@@ -180,9 +180,9 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con
180180
[azure_core_ref_docs]: https://aka.ms/azsdk/python/core/docs
181181
[azure_subscription]: https://azure.microsoft.com/free/
182182

183-
[python-eg-sample-customevent]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/champion_scenarios/cs1_publish_custom_events_to_a_topic.py
184-
[python-eg-sample-customevent-to-domain]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/champion_scenarios/cs2_publish_custom_events_to_a_domain_topic.py
185-
[python-eg-sample-send-cloudevent]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/champion_scenarios/cs5_publish_events_using_cloud_events_1.0_schema.py
183+
[python-eg-sample-egevent]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_publish_eg_events_to_a_topic.py
184+
[python-eg-sample-egevent-to-domain]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_publish_eg_events_to_a_domain.py
185+
[python-eg-sample-send-cloudevent]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_publish_events_using_cloud_events_1.0_schema.py
186186
[publisher-service-doc]: https://docs.microsoft.com/azure/event-grid/concepts
187187

188188
[cla]: https://cla.microsoft.com

sdk/eventgrid/azure-eventgrid/migration_guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ cloud_event = {
6363

6464
| In v1.3 | Equivalent in v2.0 | Sample |
6565
|---|---|---|
66-
|`EventGridClient(credentials)`|`EventGridPublisherClient(endpoint, credential)`|[Sample for client construction](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/champion_scenarios/cs5_publish_events_using_cloud_events_1.0_schema.py)|
66+
|`EventGridClient(credentials)`|`EventGridPublisherClient(endpoint, credential)`|[Sample for client construction](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_publish_events_using_cloud_events_1.0_schema.py)|
6767

6868
### Publishing Events
6969

7070
The `publish_events` API is replaced with `send` in v2.0. Additionally, `send` API accepts `CloudEvent`, `EventGridEvent` along with their dict representations.
7171

7272
| In v1.3 | Equivalent in v2.0 | Sample |
7373
|---|---|---|
74-
|`EventGridClient(credentials).publish_events(topic_hostname, events)`|`EventGridPublisherClient(endpoint, credential).send(events)`|[Sample for client construction](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/champion_scenarios/cs5_publish_events_using_cloud_events_1.0_schema.py)|
74+
|`EventGridClient(credentials).publish_events(topic_hostname, events)`|`EventGridPublisherClient(endpoint, credential).send(events)`|[Sample for client construction](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_publish_events_using_cloud_events_1.0_schema.py)|
7575

7676
## Additional samples
7777

sdk/eventgrid/azure-eventgrid/samples/README.md

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,60 @@ urlFragment: azure-eventgrid-samples
1010

1111
# Azure Event Grid Client Library Python Samples
1212

13+
## Sync samples
1314
These code samples show common champion scenario operations with the Azure Event Grid client library.
1415

15-
* Publish Custom Events to a topic: [cs1_publish_custom_events_to_a_topic.py][python-eg-sample-customevent]
16-
* Publish Custom events to a domain topic: [cs2_publish_custom_events_to_a_domain_topic.py][python-eg-sample-customevent-to-domain]
17-
* Publish a Cloud Event: [cs6_publish_events_using_cloud_events_1.0_schema.py][python-eg-sample-send-cloudevent]
16+
* Generate Shared Access Signature: [sample_generate_sas.py][python-eg-generate-sas]
17+
18+
* Publish events to a topic using SAS: [sample_publish_events_to_a_topic_using_sas_credential_async.py][python-eg-sample-send-using-sas]
19+
* Publish Event Grid Events to a topic: [sample_publish_eg_events_to_a_topic.py][python-eg-sample-eg-event]
20+
* Publish EventGrid Events to a domain topic: [sample_publish_eg_events_to_a_domain_topic.py][python-eg-sample-eg-event-to-domain]
21+
* Publish a Cloud Event: [sample_publish_events_using_cloud_events_1.0_schema.py][python-eg-sample-send-cloudevent]
22+
* Publish a Custom Schema: [sample_publish_custom_schema_to_a_topic.py][python-eg-publish-custom-schema]
23+
24+
To publish events, dict representation of the models could also be used as follows:
25+
* Publish EventGridEvent as dict like representation: [sample_publish_eg_event_using_dict.py][python-eg-sample-send-eg-as-dict]
26+
* Publish CloudEvent as dict like representation: [sample_publish_cloud_event_using_dict.py][python-eg-sample-send-cloudevent-as-dict]
27+
28+
* Consume a Custom Payload of raw cloudevent data: [sample_consume_custom_payload.py][python-eg-sample-consume-custom-payload]
29+
30+
## Async samples
31+
These code samples show common champion scenario operations with the Azure Event Grid client library using the async client.
32+
33+
* Publish events to a topic using SAS: [sample_publish_events_to_a_topic_using_sas_credential_async.py][python-eg-sample-send-using-sas-async]
34+
* Publish EventGrid Events to a topic: [sample_publish_eg_events_to_a_topic_async.py][python-eg-sample-eg-event-async]
35+
* Publish EventGrid Events to a domain topic: [sample_publish_eg_events_to_a_domain_topic_async.py][python-eg-sample-eg-event-to-domain-async]
36+
* Publish a Cloud Event: [sample_publish_events_using_cloud_events_1.0_schema_async.py][python-eg-sample-send-cloudevent-async]
37+
* Publish a Custom Schema: [sample_publish_custom_schema_to_a_topic_async.py][python-eg-publish-custom-schema-async]
38+
39+
To publish events, dict representation of the models could also be used as follows:
40+
* Publish EventGridEvent as dict like representation: [sample_publish_eg_event_using_dict_async.py][python-eg-sample-send-eg-as-dict-async]
41+
* Publish CloudEvent as dict like representation: [sample_publish_cloud_event_using_dict_async.py][python-eg-sample-send-cloudevent-as-dict-async]
42+
43+
## More Samples
44+
45+
* More samples related to the send scenario can be seen [here][python-eg-publish-samples].
46+
* To see more samples related to consuming a payload from different messaging services as a typed object, please visit [Consume Samples][python-eg-consume-samples]
47+
48+
49+
[python-eg-generate-sas]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_generate_sas.py
50+
[python-eg-sample-send-using-sas]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_publish_events_to_a_topic_using_sas_credential.py
51+
[python-eg-sample-eg-event]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_publish_eg_events_to_a_topic.py
52+
[python-eg-sample-eg-event-to-domain]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_publish_eg_events_to_a_domain.py
53+
[python-eg-sample-send-cloudevent]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_publish_events_using_cloud_events_1.0_schema.py
54+
[python-eg-publish-custom-schema]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_publish_custom_schema_to_a_topic.py
55+
[python-eg-sample-send-eg-as-dict]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_publish_eg_event_using_dict.py
56+
[python-eg-sample-send-cloudevent-as-dict]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_publish_cloud_event_using_dict.py
57+
58+
[python-eg-sample-send-using-sas-async]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/async_samples/sample_publish_events_to_a_topic_using_sas_credential_async.py
59+
[python-eg-sample-eg-event-async]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/async_samples/sample_publish_eg_events_to_a_topic_async.py
60+
[python-eg-sample-eg-event-to-domain-async]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/async_samples/sample_publish_eg_events_to_a_domain_async.py
61+
[python-eg-sample-send-cloudevent-async]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/async_samples/sample_publish_events_using_cloud_events_1.0_schema_async.py
62+
[python-eg-publish-custom-schema-async]:https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/async_samples/sample_publish_custom_schema_to_a_topic_async.py
63+
[python-eg-sample-send-eg-as-dict-async]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/async_samples/sample_publish_eg_event_using_dict_async.py
64+
[python-eg-sample-send-cloudevent-as-dict-async]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/async_samples/sample_publish_cloud_event_using_dict_async.py
65+
66+
[python-eg-publish-samples]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/publish_samples
67+
[python-eg-consume-samples]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/consume_samples
1868

19-
[python-eg-sample-customevent]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/champion_scenarios/cs1_publish_custom_events_to_a_topic.py
20-
[python-eg-sample-customevent-to-domain]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/champion_scenarios/cs2_publish_custom_events_to_a_domain_topic.py
21-
[python-eg-sample-send-cloudevent]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventgrid/azure-eventgrid/samples/champion_scenarios/cs5_publish_events_using_cloud_events_1.0_schema.py
2269
[publisher-service-doc]: https://docs.microsoft.com/azure/event-grid/concepts
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# --------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for
4+
# license information.
5+
# --------------------------------------------------------------------------
6+
"""
7+
FILE: sample_publish_cloud_event_using_dict_async.py
8+
DESCRIPTION:
9+
These samples demonstrate creating a list of CloudEvents using dict representations
10+
and sending then as a list.
11+
USAGE:
12+
python sample_publish_cloud_event_using_dict_async.py
13+
Set the environment variables with your own values before running the sample:
14+
1) CLOUD_ACCESS_KEY - The access key of your eventgrid account.
15+
2) CLOUD_TOPIC_HOSTNAME - The topic hostname. Typically it exists in the format
16+
"<YOUR-TOPIC-NAME>.<REGION-NAME>.eventgrid.azure.net".
17+
"""
18+
import os
19+
import asyncio
20+
from azure.eventgrid import CloudEvent
21+
from azure.eventgrid.aio import EventGridPublisherClient
22+
from azure.core.credentials import AzureKeyCredential
23+
24+
topic_key = os.environ["CLOUD_ACCESS_KEY"]
25+
endpoint = os.environ["CLOUD_TOPIC_HOSTNAME"]
26+
27+
async def publish():
28+
credential = AzureKeyCredential(topic_key)
29+
client = EventGridPublisherClient(endpoint, credential)
30+
31+
async with client:
32+
client.send([
33+
{
34+
"type": "Contoso.Items.ItemReceived",
35+
"source": "/contoso/items",
36+
"data": {
37+
"itemSku": "Contoso Item SKU #1"
38+
},
39+
"subject": "Door1",
40+
"specversion": "1.0",
41+
"id": "randomclouduuid11"
42+
}
43+
])
44+
45+
if __name__ == '__main__':
46+
loop = asyncio.get_event_loop()
47+
loop.run_until_complete(publish())
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# --------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for
4+
# license information.
5+
# --------------------------------------------------------------------------
6+
"""
7+
FILE: sample_publish_custom_schema_to_a_topic_async.py
8+
DESCRIPTION:
9+
These samples demonstrate creating a list of Custom Events and sending them as a list.
10+
USAGE:
11+
python sample_publish_custom_schema_to_a_topic_async.py
12+
Set the environment variables with your own values before running the sample:
13+
1) CUSTOM_SCHEMA_ACCESS_KEY - The access key of your eventgrid account.
14+
2) CUSTOM_SCHEMA_TOPIC_HOSTNAME - The topic hostname. Typically it exists in the format
15+
"<YOUR-TOPIC-NAME>.<REGION-NAME>.eventgrid.azure.net".
16+
"""
17+
import os
18+
import asyncio
19+
from random import randint, sample
20+
import time
21+
import uuid
22+
from msrest.serialization import UTC
23+
import datetime as dt
24+
25+
from azure.core.credentials import AzureKeyCredential
26+
from azure.eventgrid.aio import EventGridPublisherClient
27+
28+
key = os.environ["CUSTOM_SCHEMA_ACCESS_KEY"]
29+
endpoint = os.environ["CUSTOM_SCHEMA_TOPIC_HOSTNAME"]
30+
31+
async def publish_event():
32+
# authenticate client
33+
credential = AzureKeyCredential(key)
34+
client = EventGridPublisherClient(endpoint, credential)
35+
36+
custom_schema_event = {
37+
"customSubject": "sample",
38+
"customEventType": "sample.event",
39+
"customDataVersion": "2.0",
40+
"customId": uuid.uuid4(),
41+
"customEventTime": dt.datetime.now(UTC()).isoformat(),
42+
"customData": "sample data"
43+
}
44+
45+
# publish events
46+
for _ in range(3):
47+
48+
event_list = [] # list of events to publish
49+
# create events and append to list
50+
for j in range(randint(1, 3)):
51+
event_list.append(custom_schema_event)
52+
53+
async with client:
54+
# publish list of events
55+
client.send(event_list)
56+
print("Batch of size {} published".format(len(event_list)))
57+
time.sleep(randint(1, 5))
58+
59+
60+
if __name__ == '__main__':
61+
loop = asyncio.get_event_loop()
62+
loop.run_until_complete(publish_event())
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# --------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for
4+
# license information.
5+
# --------------------------------------------------------------------------
6+
"""
7+
FILE: sample_publish_eg_event_using_dict_async.py
8+
DESCRIPTION:
9+
These samples demonstrate sending an EventGrid Event as a dict representation
10+
directly to a topic. The dict representation should be that of the serialized
11+
model of EventGridEvent.
12+
USAGE:
13+
python sample_publish_eg_event_using_dict_async.py
14+
Set the environment variables with your own values before running the sample:
15+
1) EG_ACCESS_KEY - The access key of your eventgrid account.
16+
2) EG_TOPIC_HOSTNAME - The topic hostname. Typically it exists in the format
17+
"<YOUR-TOPIC-NAME>.<REGION-NAME>.eventgrid.azure.net".
18+
"""
19+
import os
20+
import asyncio
21+
from datetime import datetime
22+
from azure.eventgrid import EventGridEvent
23+
from azure.eventgrid.aio import EventGridPublisherClient
24+
from azure.core.credentials import AzureKeyCredential
25+
26+
topic_key = os.environ["EG_ACCESS_KEY"]
27+
endpoint = os.environ["EG_TOPIC_HOSTNAME"]
28+
29+
async def publish():
30+
credential = AzureKeyCredential(topic_key)
31+
client = EventGridPublisherClient(endpoint, credential)
32+
event0 = {
33+
"eventType": "Contoso.Items.ItemReceived",
34+
"data": {
35+
"itemSku": "Contoso Item SKU #1"
36+
},
37+
"subject": "Door1",
38+
"dataVersion": "2.0",
39+
"id": "randomuuid11",
40+
"eventTime": datetime.utcnow()
41+
}
42+
event1 = {
43+
"eventType": "Contoso.Items.ItemReceived",
44+
"data": {
45+
"itemSku": "Contoso Item SKU #2"
46+
},
47+
"subject": "Door1",
48+
"dataVersion": "2.0",
49+
"id": "randomuuid12",
50+
"eventTime": datetime.utcnow()
51+
}
52+
53+
async with client:
54+
await client.send([event0, event1])
55+
56+
if __name__ == '__main__':
57+
loop = asyncio.get_event_loop()
58+
loop.run_until_complete(publish())
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# --------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for
4+
# license information.
5+
# --------------------------------------------------------------------------
6+
"""
7+
FILE: sample_publish_eg_events_to_a_domain_async.py
8+
DESCRIPTION:
9+
These samples demonstrate creating a list of EventGrid Events and sending them as a list to a topic
10+
in a domain.
11+
USAGE:
12+
python sample_publish_eg_events_to_a_domain_async.py
13+
Set the environment variables with your own values before running the sample:
14+
1) EG_ACCESS_KEY - The access key of your eventgrid account.
15+
2) EG_TOPIC_HOSTNAME - The topic hostname. Typically it exists in the format
16+
"<YOUR-TOPIC-NAME>.<REGION-NAME>.eventgrid.azure.net".
17+
"""
18+
import os
19+
import asyncio
20+
from azure.eventgrid import EventGridEvent
21+
from azure.eventgrid.aio import EventGridPublisherClient
22+
from azure.core.credentials import AzureKeyCredential
23+
24+
domain_key = os.environ["EG_DOMAIN_ACCESS_KEY"]
25+
domain_hostname = os.environ["EG_DOMAIN_TOPIC_HOSTNAME"]
26+
27+
async def publish():
28+
credential = AzureKeyCredential(domain_key)
29+
client = EventGridPublisherClient(domain_hostname, credential)
30+
31+
await client.send([
32+
EventGridEvent(
33+
topic="MyCustomDomainTopic1",
34+
event_type="Contoso.Items.ItemReceived",
35+
data={
36+
"itemSku": "Contoso Item SKU #1"
37+
},
38+
subject="Door1",
39+
data_version="2.0"
40+
),
41+
EventGridEvent(
42+
topic="MyCustomDomainTopic2",
43+
event_type="Contoso.Items.ItemReceived",
44+
data={
45+
"itemSku": "Contoso Item SKU #2"
46+
},
47+
subject="Door1",
48+
data_version="2.0"
49+
)
50+
])
51+
52+
if __name__ == '__main__':
53+
loop = asyncio.get_event_loop()
54+
loop.run_until_complete(publish())

0 commit comments

Comments
 (0)