Skip to content

Commit 433b99a

Browse files
authored
move samples (#35966)
* sample * readme updates * links * delete duplicates * doc updates * plural
1 parent 10c3c79 commit 433b99a

File tree

56 files changed

+615
-171
lines changed

Some content is hidden

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

56 files changed

+615
-171
lines changed

sdk/eventgrid/azure-eventgrid/README.md

Lines changed: 43 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ This is a GA release of Azure Event Grid's `EventGridPublisherClient` and `Event
2525
### Event Grid Resources
2626

2727
Azure Event Grid Namespaces supports both pull and push delivery. Azure Event Grid Basic supports only push delivery.
28-
More information on the two resource types can be found [here](https://learn.microsoft.com/azure/event-grid/choose-right-tier).
28+
More information on the two resource tiers can be found [here](https://learn.microsoft.com/azure/event-grid/choose-right-tier).
2929

3030
**Note:** Azure Event Grid Namespaces only supports the Cloud Event v1.0 Schema.
3131

@@ -401,7 +401,14 @@ The following section provides several code snippets illustrating common pattern
401401

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

404-
#### Basic Event Grid Scenarios
404+
#### Additional Namespace Event Grid Scenarios
405+
406+
* Authenticate the client: [sample_namespace_authentication_async.py][python-eg-namespace-authenticate-async]
407+
* Publish to the namespace topic: [sample_publish_cloud_event_async.py][python-eg-namespace-publish-cloud-async]
408+
* Consume and Process from an event subscription: [sample_consume_process_events.py][python-eg-namespace-consume-async]
409+
410+
411+
#### Additional Basic Event Grid Scenarios
405412

406413
* Generate Shared Access Signature: [sample_generate_sas.py][python-eg-generate-sas]
407414

@@ -455,29 +462,40 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con
455462
[azure_core_ref_docs]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-core#configurations
456463
[azure_subscription]: https://azure.microsoft.com/free/
457464

458-
[python-eg-auth]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_authentication.py
459-
[python-eg-generate-sas]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_generate_sas.py
460-
[python-eg-sample-send-using-sas]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_publish_events_to_a_topic_using_sas_credential.py
461-
[python-eg-sample-eg-event]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_publish_eg_events_to_a_topic.py
462-
[python-eg-sample-eg-event-to-domain]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_publish_eg_events_to_a_domain.py
463-
[python-eg-sample-send-cloudevent]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_publish_events_using_cloud_events_1.0_schema.py
464-
[python-eg-publish-custom-schema]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_publish_custom_schema_to_a_topic.py
465-
[python-eg-sample-send-eg-as-dict]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_publish_eg_event_using_dict.py
466-
[python-eg-sample-send-cloudevent-as-dict]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_publish_cloud_event_using_dict.py
467-
468-
[python-eg-auth-async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/async_samples/sample_authentication_async.py
469-
[python-eg-sample-send-using-sas-async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/async_samples/sample_publish_events_to_a_topic_using_sas_credential_async.py
470-
[python-eg-sample-eg-event-async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/async_samples/sample_publish_eg_events_to_a_topic_async.py
471-
[python-eg-sample-eg-event-to-domain-async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/async_samples/sample_publish_eg_events_to_a_domain_async.py
472-
[python-eg-sample-send-cloudevent-async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/async_samples/sample_publish_events_using_cloud_events_1.0_schema_async.py
473-
[python-eg-publish-custom-schema-async]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/async_samples/sample_publish_custom_schema_to_a_topic_async.py
474-
[python-eg-sample-send-eg-as-dict-async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/async_samples/sample_publish_eg_event_using_dict_async.py
475-
[python-eg-sample-send-cloudevent-as-dict-async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/async_samples/sample_publish_cloud_event_using_dict_async.py
476-
477-
[python-eg-publish-samples]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/publish_samples
478-
[python-eg-consume-samples]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/consume_samples
479-
[python-eg-sample-consume-custom-payload]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_consume_custom_payload.py
480-
465+
[python-eg-auth]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/basic/sync_samples/sample_authentication.py
466+
[python-eg-generate-sas]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/basic/sync_samples/sample_generate_sas.py
467+
[python-eg-sample-send-using-sas]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/basic/sync_samples/sample_publish_events_to_a_topic_using_sas_credential.py
468+
[python-eg-sample-eg-event]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/basic/sync_samples/sample_publish_eg_events_to_a_topic.py
469+
[python-eg-sample-eg-event-to-domain]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/basic/sync_samples/sample_publish_eg_events_to_a_domain.py
470+
[python-eg-sample-send-cloudevent]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/basic/sync_samples/sample_publish_events_using_cloud_events_1.0_schema.py
471+
[python-eg-publish-custom-schema]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/basic/sync_samples/sample_publish_custom_schema_to_a_topic.py
472+
[python-eg-sample-send-eg-as-dict]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/basic/sync_samples/sample_publish_eg_event_using_dict.py
473+
[python-eg-sample-send-cloudevent-as-dict]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/basic/sync_samples/sample_publish_cloud_event_using_dict.py
474+
475+
[python-eg-auth-async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/basic/async_samples/sample_authentication_async.py
476+
[python-eg-sample-send-using-sas-async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/basic/async_samples/sample_publish_events_to_a_topic_using_sas_credential_async.py
477+
[python-eg-sample-eg-event-async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/basic/async_samples/sample_publish_eg_events_to_a_topic_async.py
478+
[python-eg-sample-eg-event-to-domain-async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/basic/async_samples/sample_publish_eg_events_to_a_domain_async.py
479+
[python-eg-sample-send-cloudevent-async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/basic/async_samples/sample_publish_events_using_cloud_events_1.0_schema_async.py
480+
[python-eg-publish-custom-schema-async]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/basic/async_samples/sample_publish_custom_schema_to_a_topic_async.py
481+
[python-eg-sample-send-eg-as-dict-async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/basic/async_samples/sample_publish_eg_event_using_dict_async.py
482+
[python-eg-sample-send-cloudevent-as-dict-async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/basic/async_samples/sample_publish_cloud_event_using_dict_async.py
483+
484+
[python-eg-publish-samples]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/basic/publish_samples
485+
[python-eg-consume-samples]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/basic/consume_samples
486+
[python-eg-sample-consume-custom-payload]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/basic/sync_samples/sample_consume_custom_payload.py
487+
488+
489+
[python-eg-namespace-authenticate]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/namespace/sync_samples/sample_namespace_authentication.py
490+
[python-eg-namespace-publish-cncf]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/namespace/sync_samples/sample_publish_cncf_events.py
491+
[python-eg-namespace-publish-cloud]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/namespace/sync_samples/sample_publish_cloud_event.py
492+
[python-eg-namespace-consume]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/namespace/samples/sync_samples/sample_consume_process_events.py
493+
494+
495+
[python-eg-namespace-authenticate-async]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/namespace/async_samples/sample_namespace_authentication_async.py
496+
[python-eg-namespace-publish-cncf-async]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/namespace/async_samples/sample_publish_cncf_events_async.py
497+
[python-eg-namespace-publish-cloud-async]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/namespace/async_samples/sample_publish_cloud_event_async.py
498+
[python-eg-namespace-consume-async]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/namespace/async_samples/sample_consume_process_events_async.py
481499

482500
[cla]: https://cla.microsoft.com
483501
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/

sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/_patch.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ def send(
8181
) -> None: # pylint: disable=docstring-should-be-keyword, docstring-missing-param
8282
"""Send events to the Event Grid Service.
8383
84-
:param events: The event(s) to send. If sending to an Event Grid Namespace, the dict or list of dicts
85-
should be in the format of a CloudEvent.
84+
:param events: The event(s) to send. If sending to an Event Grid Namespace, the dict, list of dicts,
85+
or event(s) should be in the format of a CloudEvent.
8686
:type events: CloudEvent or List[CloudEvent] or Dict[str, Any] or List[Dict[str, Any]]
8787
or CNCFCloudEvent or List[CNCFCloudEvent] or EventGridEvent or List[EventGridEvent]
8888
:keyword channel_name: The name of the channel to send the event to. Event Grid Basic Resource only.
@@ -154,15 +154,15 @@ def receive(
154154
"""Receive Batch of Cloud Events from the Event Subscription.
155155
156156
:keyword max_events: Max Events count to be received. Minimum value is 1, while maximum value
157-
is 100 events. If not specified, the default value is 1. Default value is None.
157+
is 100 events. The default is None, meaning it will receive one event if available.
158158
:paramtype max_events: int
159159
:keyword max_wait_time: Max wait time value for receive operation in Seconds. It is the time in
160160
seconds that the server approximately waits for the availability of an event and responds to
161161
the request. If an event is available, the broker responds immediately to the client. Minimum
162-
value is 10 seconds, while maximum value is 120 seconds. If not specified, the default value is
163-
60 seconds. Default value is None.
162+
value is 10 seconds, while maximum value is 120 seconds. The default value is None, meaning it
163+
will wait for 60 seconds.
164164
:paramtype max_wait_time: int
165-
:return: Receive Details.
165+
:return: ReceiveDetails list of received events and their broker properties.
166166
:rtype: list[~azure.eventgrid.models.ReceiveDetails]
167167
:raises ~azure.core.exceptions.HttpResponseError:
168168
"""

sdk/eventgrid/azure-eventgrid/azure/eventgrid/_patch.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class EventGridPublisherClient(InternalEventGridPublisherClient):
3030
"""EventGridPublisherClient.
3131
3232
Sends events to a basic topic, basic domain, or a namespace topic
33-
specified during the client initialization.
33+
specified during the client initialization.
3434
3535
A single instance or a list of dictionaries, CloudEvents or EventGridEvents are accepted.
3636
If a list is provided, the list must contain only one type of event.
@@ -44,10 +44,11 @@ class EventGridPublisherClient(InternalEventGridPublisherClient):
4444
AzureKeyCredential type or a TokenCredential type. Required.
4545
:type credential: ~azure.core.credentials.AzureKeyCredential or
4646
~azure.core.credentials.TokenCredential
47-
:keyword namespace_topic: The name of the topic to publish events to. Required for EventGrid Namespaces.
48-
Default value is None, which is used for EventGrid Basic.
47+
:keyword namespace_topic: The name of the topic to publish events to. Required for Event Grid Namespaces.
48+
Default value is None, which is used for Event Grid Basic.
4949
:paramtype namespace_topic: str or None
50-
:keyword api_version: The API version to use for this operation. Default value is "2024-06-01".
50+
:keyword api_version: The API version to use for this operation. Default value for Event Grid Namespace
51+
is "2024-06-01", default value for Event Grid Basic is "2018-01-01".
5152
Note that overriding this default value may result in unsupported behavior.
5253
:paramtype api_version: str
5354
"""
@@ -96,7 +97,7 @@ class EventGridConsumerClient(InternalEventGridConsumerClient):
9697
"""EventGridConsumerClient.
9798
9899
Consumes and manages events from a namespace topic
99-
and event subscription specified during the client initialization.
100+
and event subscription specified during the client initialization.
100101
101102
:param endpoint: The host name of the namespace, e.g.
102103
namespaceName1.westus-1.eventgrid.azure.net. Required.
@@ -107,7 +108,7 @@ class EventGridConsumerClient(InternalEventGridConsumerClient):
107108
~azure.core.credentials.TokenCredential
108109
:keyword namespace_topic: The name of the topic to consume events from. Required.
109110
:paramtype namespace_topic: str
110-
:subscription: The name of the subscription to consume events from. Required.
111+
:keyword subscription: The name of the subscription to consume events from. Required.
111112
:paramtype subscription: str
112113
:keyword api_version: The API version to use for this operation. Default value is "2024-06-01".
113114
Note that overriding this default value may result in unsupported behavior.

sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_operations/_patch.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ async def send(
6464
) -> None: # pylint: disable=docstring-should-be-keyword, docstring-missing-param
6565
"""Send events to the Event Grid Service.
6666
67-
:param events: The event(s) to send. If sending to an Event Grid Namespace, the dict or list of dicts
68-
should be in the format of a CloudEvent.
67+
:param events: The event(s) to send. If sending to an Event Grid Namespace, the dict, list of dicts,
68+
or event(s) should be in the format of a CloudEvent.
6969
:type events: CloudEvent or List[CloudEvent] or Dict[str, Any] or List[Dict[str, Any]]
7070
or CNCFCloudEvent or List[CNCFCloudEvent] or EventGridEvent or List[EventGridEvent]
7171
:keyword channel_name: The name of the channel to send the event to. Event Grid Basic Resource only.
@@ -138,15 +138,15 @@ async def receive(
138138
"""Receive Batch of Cloud Events from the Event Subscription.
139139
140140
:keyword max_events: Max Events count to be received. Minimum value is 1, while maximum value
141-
is 100 events. If not specified, the default value is 1. Default value is None.
141+
is 100 events. The default is None, meaning it will receive one event if available.
142142
:paramtype max_events: int
143143
:keyword max_wait_time: Max wait time value for receive operation in Seconds. It is the time in
144144
seconds that the server approximately waits for the availability of an event and responds to
145145
the request. If an event is available, the broker responds immediately to the client. Minimum
146-
value is 10 seconds, while maximum value is 120 seconds. If not specified, the default value is
147-
60 seconds. Default value is None.
146+
value is 10 seconds, while maximum value is 120 seconds. The default value is None, meaning it
147+
will wait for 60 seconds.
148148
:paramtype max_wait_time: int
149-
:return: ReceiveDetails
149+
:return: ReceiveDetails list of received events and their broker properties.
150150
:rtype: list[~azure.eventgrid.models.ReceiveDetails]
151151
:raises ~azure.core.exceptions.HttpResponseError:
152152
"""

sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_patch.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class EventGridPublisherClient(InternalEventGridPublisherClient):
3030
"""EventGridPublisherClient.
3131
3232
Sends events to a basic topic, basic domain, or a namespace topic
33-
specified during the client initialization.
33+
specified during the client initialization.
3434
3535
A single instance or a list of dictionaries, CloudEvents or EventGridEvents are accepted.
3636
If a list is provided, the list must contain only one type of event.
@@ -44,10 +44,11 @@ class EventGridPublisherClient(InternalEventGridPublisherClient):
4444
AzureKeyCredential type or a AsyncTokenCredential type. Required.
4545
:type credential: ~azure.core.credentials.AzureKeyCredential or
4646
~azure.core.credentials_async.AsyncTokenCredential
47-
:keyword namespace_topic: The name of the topic to publish events to. Required for EventGrid Namespaces.
48-
Default value is None, which is used for EventGrid Basic.
47+
:keyword namespace_topic: The name of the topic to publish events to. Required for Event Grid Namespaces.
48+
Default value is None, which is used for Event Grid Basic.
4949
:paramtype namespace_topic: str or None
50-
:keyword api_version: The API version to use for this operation. Default value is "2024-06-01".
50+
:keyword api_version: The API version to use for this operation. Default value for Event Grid Namespace
51+
is "2024-06-01", default value for Event Grid Basic is "2018-01-01".
5152
Note that overriding this default value may result in unsupported behavior.
5253
:paramtype api_version: str
5354
"""
@@ -94,7 +95,7 @@ class EventGridConsumerClient(InternalEventGridConsumerClient):
9495
"""EventGridConsumerClient.
9596
9697
Consumes and manages events from a namespace topic
97-
and event subscription specified during the client initialization.
98+
and event subscription specified during the client initialization.
9899
99100
:param endpoint: The host name of the namespace, e.g.
100101
namespaceName1.westus-1.eventgrid.azure.net. Required.
@@ -105,7 +106,7 @@ class EventGridConsumerClient(InternalEventGridConsumerClient):
105106
~azure.core.credentials_async.AsyncTokenCredential
106107
:keyword namespace_topic: The name of the topic to consume events from. Required.
107108
:paramtype namespace_topic: str
108-
:subscription: The name of the subscription to consume events from. Required.
109+
:keyword subscription: The name of the subscription to consume events from. Required.
109110
:paramtype subscription: str
110111
:keyword api_version: The API version to use for this operation. Default value is "2024-06-01".
111112
Note that overriding this default value may result in unsupported behavior.

0 commit comments

Comments
 (0)