-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make doc-owner recommended revisions to eventhub readme and samples. (#…
…13518) Move auth samples into samples and link from readme rather than line. Add snippets to the top of samples lacking any verbiage. Whitespace improvements in client auth sample Explicit samples for connstr auth to link from new terse readme auth section.
- Loading branch information
1 parent
a536041
commit ae0a902
Showing
5 changed files
with
69 additions
and
28 deletions.
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
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
24 changes: 24 additions & 0 deletions
24
sdk/eventhub/azure-eventhub/samples/async_samples/connection_string_authentication_async.py
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,24 @@ | ||
#!/usr/bin/env python | ||
|
||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
""" | ||
An example to show authentication using a connection string obtained via the Azure Portal, or the Azure CLI toolkit. | ||
""" | ||
|
||
import os | ||
from azure.eventhub.aio import EventHubConsumerClient | ||
|
||
CONNECTION_STR = os.environ["EVENT_HUB_CONN_STR"] | ||
EVENTHUB_NAME = os.environ['EVENT_HUB_NAME'] | ||
|
||
consumer_client = EventHubConsumerClient.from_connection_string( | ||
conn_str=CONNECTION_STR, | ||
consumer_group='$Default', | ||
eventhub_name=EVENTHUB_NAME, | ||
) | ||
|
||
async with consumer_client: | ||
pass # consumer_client is now ready to be used. |
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
24 changes: 24 additions & 0 deletions
24
sdk/eventhub/azure-eventhub/samples/sync_samples/connection_string_authentication.py
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,24 @@ | ||
#!/usr/bin/env python | ||
|
||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
""" | ||
An example to show authentication using a connection string obtained via the Azure Portal, or the Azure CLI toolkit. | ||
""" | ||
|
||
import os | ||
from azure.eventhub import EventHubConsumerClient | ||
|
||
CONNECTION_STR = os.environ["EVENT_HUB_CONN_STR"] | ||
EVENTHUB_NAME = os.environ['EVENT_HUB_NAME'] | ||
|
||
consumer_client = EventHubConsumerClient.from_connection_string( | ||
conn_str=CONNECTION_STR, | ||
consumer_group='$Default', | ||
eventhub_name=EVENTHUB_NAME, | ||
) | ||
|
||
with consumer_client: | ||
pass # consumer_client is now ready to be used. |