Skip to content

Commit 8abbc26

Browse files
[EG] GA Namespaces (#35831)
* [EGv2] Build Release (#30325) * move old sdk under legacy * gen typespec code * naming changes from archboard * samples * update patch naming * update imports with new gen * update samples * update client naming on aio * update receive op * update async to close client * update receive() * update gen code * moving around samples * updating samples * update samples * update patch and samples * patch internalmodels * spacing * updating model patch * update patch models * add both models back * update docstring * update docs * updating patch for receive * old EG models * add reject samples * patch * update format * update patch * eventgrid_client exceptions * update test imports * update total sample * receive patch fix * add in more tests * update test file * remove locktoken model * remove LockToken in patch * remove event delivery delay * eg client exceptions * .8.5 generation, and deliveryCount * rename sample * update version for beta * changelog * updating for gen * regen * generate via commit * publish result * fix docstring * publish docstring * return type * publish result * return publish result -- is none * format * update Publish result model * deliverycount patch * update from main * add copyright * added to readme * remove from readme * force publish_result response * update patch tp unindent * cspell * update mypy.ini * import order * mark livetest * update operations init * rename async * mypy * ignore mypy * pylint * pylint * ignore pylint for now to avoid gen code errors * ignore samples until ARM setup * update patches * remove publish result * remove PublishResult * remove publishresult * comma Co-authored-by: swathipil <[email protected]> * update publishResult * change to .value * gen code " to ' * remove comment * ran black * update changelog * update sample readme * gen code without query name * gen code * update tsp commit * remove publishresult * readme disclaimer * update changelog --------- Co-authored-by: swathipil <[email protected]> * link to samples * remove comment * remove uneeded test * [EGv2] doc updates (#30483) * doc updates * doc update * doc * [EGv2] Eg typing/formatting (#30492) * mypy pylint * update samples * remove version disclaimer * Beta LiveTests (#30728) * add bicep file for tests * update output * update test * secret sanitization * refactor failing test * update conftest * update assets and sanitizers * update preparer loc * update conftest * conftest * update conftest * remove variables for now * update assets * update tests * try to update regex * update recordings * update conftest * update preparer * update test * update exception test * update tests * update asset * update conftest * pr comments * default needs to be eastus * import * [EGv2] generate with newer emitter (#31962) * [EGv2] Build Release (#30325) * move old sdk under legacy * gen typespec code * naming changes from archboard * samples * update patch naming * update imports with new gen * update samples * update client naming on aio * update receive op * update async to close client * update receive() * update gen code * moving around samples * updating samples * update samples * update patch and samples * patch internalmodels * spacing * updating model patch * update patch models * add both models back * update docstring * update docs * updating patch for receive * old EG models * add reject samples * patch * update format * update patch * eventgrid_client exceptions * update test imports * update total sample * receive patch fix * add in more tests * update test file * remove locktoken model * remove LockToken in patch * remove event delivery delay * eg client exceptions * .8.5 generation, and deliveryCount * rename sample * update version for beta * changelog * updating for gen * regen * generate via commit * publish result * fix docstring * publish docstring * return type * publish result * return publish result -- is none * format * update Publish result model * deliverycount patch * update from main * add copyright * added to readme * remove from readme * force publish_result response * update patch tp unindent * cspell * update mypy.ini * import order * mark livetest * update operations init * rename async * mypy * ignore mypy * pylint * pylint * ignore pylint for now to avoid gen code errors * ignore samples until ARM setup * update patches * remove publish result * remove PublishResult * remove publishresult * comma Co-authored-by: swathipil <[email protected]> * update publishResult * change to .value * gen code " to ' * remove comment * ran black * update changelog * update sample readme * gen code without query name * gen code * update tsp commit * remove publishresult * readme disclaimer * update changelog --------- Co-authored-by: swathipil <[email protected]> * generate with newer emitter * update tsp * regen * update tests * update tspconfig * cspell * version * update serialization * update assets * update mypy --------- Co-authored-by: swathipil <[email protected]> * [EGv2] Binary mode (#32922) * [EGv2] Build Release (#30325) * move old sdk under legacy * gen typespec code * naming changes from archboard * samples * update patch naming * update imports with new gen * update samples * update client naming on aio * update receive op * update async to close client * update receive() * update gen code * moving around samples * updating samples * update samples * update patch and samples * patch internalmodels * spacing * updating model patch * update patch models * add both models back * update docstring * update docs * updating patch for receive * old EG models * add reject samples * patch * update format * update patch * eventgrid_client exceptions * update test imports * update total sample * receive patch fix * add in more tests * update test file * remove locktoken model * remove LockToken in patch * remove event delivery delay * eg client exceptions * .8.5 generation, and deliveryCount * rename sample * update version for beta * changelog * updating for gen * regen * generate via commit * publish result * fix docstring * publish docstring * return type * publish result * return publish result -- is none * format * update Publish result model * deliverycount patch * update from main * add copyright * added to readme * remove from readme * force publish_result response * update patch tp unindent * cspell * update mypy.ini * import order * mark livetest * update operations init * rename async * mypy * ignore mypy * pylint * pylint * ignore pylint for now to avoid gen code errors * ignore samples until ARM setup * update patches * remove publish result * remove PublishResult * remove publishresult * comma Co-authored-by: swathipil <[email protected]> * update publishResult * change to .value * gen code " to ' * remove comment * ran black * update changelog * update sample readme * gen code without query name * gen code * update tsp commit * remove publishresult * readme disclaimer * update changelog --------- Co-authored-by: swathipil <[email protected]> * Beta LiveTests (#30728) * add bicep file for tests * update output * update test * secret sanitization * refactor failing test * update conftest * update assets and sanitizers * update preparer loc * update conftest * conftest * update conftest * remove variables for now * update assets * update tests * try to update regex * update recordings * update conftest * update preparer * update test * update exception test * update tests * update asset * update conftest * pr comments * default needs to be eastus * import * [EGv2] Build Release (#30325) * move old sdk under legacy * gen typespec code * naming changes from archboard * samples * update patch naming * update imports with new gen * update samples * update client naming on aio * update receive op * update async to close client * update receive() * update gen code * moving around samples * updating samples * update samples * update patch and samples * patch internalmodels * spacing * updating model patch * update patch models * add both models back * update docstring * update docs * updating patch for receive * old EG models * add reject samples * patch * update format * update patch * eventgrid_client exceptions * update test imports * update total sample * receive patch fix * add in more tests * update test file * remove locktoken model * remove LockToken in patch * remove event delivery delay * eg client exceptions * .8.5 generation, and deliveryCount * rename sample * update version for beta * changelog * updating for gen * regen * generate via commit * publish result * fix docstring * publish docstring * return type * publish result * return publish result -- is none * format * update Publish result model * deliverycount patch * update from main * add copyright * added to readme * remove from readme * force publish_result response * update patch tp unindent * cspell * update mypy.ini * import order * mark livetest * update operations init * rename async * mypy * ignore mypy * pylint * pylint * ignore pylint for now to avoid gen code errors * ignore samples until ARM setup * update patches * remove publish result * remove PublishResult * remove publishresult * comma Co-authored-by: swathipil <[email protected]> * update publishResult * change to .value * gen code " to ' * remove comment * ran black * update changelog * update sample readme * gen code without query name * gen code * update tsp commit * remove publishresult * readme disclaimer * update changelog --------- Co-authored-by: swathipil <[email protected]> * fix merge * dont go to generated before binary * update patch * update patches * eventgrid client patch * changes * add * update test * update tyoe checking * pass through binary_mode for now -- * update patch aio * add async func * update * sys * update kwargs * add Todo and start adding more tests * update * differentiate between binary and not * update binary * no base64 in binary mode * binary * try JSONEncoder on everything if not str/bytes * update test * update test * update changes * whitespace * space * remove commented * str serialize extensions? * xml test * encode extensions as object * update test * update extension serialization for deserialize * move flag to operation level * extra comma * dont raise httpresponse * update patch * accept dict cloud events * spacing * remove content_type check * add live test * remove live test mark * update * use env vars * update test * only run live test * comment * typo * error incorrect * start comments * update test * add sample * update tests * update docstrings to add clarity * update err message * remove generated cloud event * update sample * update * update samples to include dict * update patch * spacing * add comments * formatting * update doc * update tests * update tests * tests * skip tests for now * typo * add dict binary mode * update docstring * update patch to allow throw error * first pass at comments * update patch eror * nit --------- Co-authored-by: swathipil <[email protected]> * [EventGrid] Ignite Release generate with new typespec (#32652) * Beta LiveTests (#30728) * add bicep file for tests * update output * update test * secret sanitization * refactor failing test * update conftest * update assets and sanitizers * update preparer loc * update conftest * conftest * update conftest * remove variables for now * update assets * update tests * try to update regex * update recordings * update conftest * update preparer * update test * update exception test * update tests * update asset * update conftest * pr comments * default needs to be eastus * import * [EGv2] Binary mode (#32922) * [EGv2] Build Release (#30325) * move old sdk under legacy * gen typespec code * naming changes from archboard * samples * update patch naming * update imports with new gen * update samples * update client naming on aio * update receive op * update async to close client * update receive() * update gen code * moving around samples * updating samples * update samples * update patch and samples * patch internalmodels * spacing * updating model patch * update patch models * add both models back * update docstring * update docs * updating patch for receive * old EG models * add reject samples * patch * update format * update patch * eventgrid_client exceptions * update test imports * update total sample * receive patch fix * add in more tests * update test file * remove locktoken model * remove LockToken in patch * remove event delivery delay * eg client exceptions * .8.5 generation, and deliveryCount * rename sample * update version for beta * changelog * updating for gen * regen * generate via commit * publish result * fix docstring * publish docstring * return type * publish result * return publish result -- is none * format * update Publish result model * deliverycount patch * update from main * add copyright * added to readme * remove from readme * force publish_result response * update patch tp unindent * cspell * update mypy.ini * import order * mark livetest * update operations init * rename async * mypy * ignore mypy * pylint * pylint * ignore pylint for now to avoid gen code errors * ignore samples until ARM setup * update patches * remove publish result * remove PublishResult * remove publishresult * comma Co-authored-by: swathipil <[email protected]> * update publishResult * change to .value * gen code " to ' * remove comment * ran black * update changelog * update sample readme * gen code without query name * gen code * update tsp commit * remove publishresult * readme disclaimer * update changelog --------- Co-authored-by: swathipil <[email protected]> * Beta LiveTests (#30728) * add bicep file for tests * update output * update test * secret sanitization * refactor failing test * update conftest * update assets and sanitizers * update preparer loc * update conftest * conftest * update conftest * remove variables for now * update assets * update tests * try to update regex * update recordings * update conftest * update preparer * update test * update exception test * update tests * update asset * update conftest * pr comments * default needs to be eastus * import * [EGv2] Build Release (#30325) * move old sdk under legacy * gen typespec code * naming changes from archboard * samples * update patch naming * update imports with new gen * update samples * update client naming on aio * update receive op * update async to close client * update receive() * update gen code * moving around samples * updating samples * update samples * update patch and samples * patch internalmodels * spacing * updating model patch * update patch models * add both models back * update docstring * update docs * updating patch for receive * old EG models * add reject samples * patch * update format * update patch * eventgrid_client exceptions * update test imports * update total sample * receive patch fix * add in more tests * update test file * remove locktoken model * remove LockToken in patch * remove event delivery delay * eg client exceptions * .8.5 generation, and deliveryCount * rename sample * update version for beta * changelog * updating for gen * regen * generate via commit * publish result * fix docstring * publish docstring * return type * publish result * return publish result -- is none * format * update Publish result model * deliverycount patch * update from main * add copyright * added to readme * remove from readme * force publish_result response * update patch tp unindent * cspell * update mypy.ini * import order * mark livetest * update operations init * rename async * mypy * ignore mypy * pylint * pylint * ignore pylint for now to avoid gen code errors * ignore samples until ARM setup * update patches * remove publish result * remove PublishResult * remove publishresult * comma Co-authored-by: swathipil <[email protected]> * update publishResult * change to .value * gen code " to ' * remove comment * ran black * update changelog * update sample readme * gen code without query name * gen code * update tsp commit * remove publishresult * readme disclaimer * update changelog --------- Co-authored-by: swathipil <[email protected]> * fix merge * dont go to generated before binary * update patch * update patches * eventgrid client patch * changes * add * update test * update tyoe checking * pass through binary_mode for now -- * update patch aio * add async func * update * sys * update kwargs * add Todo and start adding more tests * update * differentiate between binary and not * update binary * no base64 in binary mode * binary * try JSONEncoder on everything if not str/bytes * update test * update test * update changes * whitespace * space * remove commented * str serialize extensions? * xml test * encode extensions as object * update test * update extension serialization for deserialize * move flag to operation level * extra comma * dont raise httpresponse * update patch * accept dict cloud events * spacing * remove content_type check * add live test * remove live test mark * update * use env vars * update test * only run live test * comment * typo * error incorrect * start comments * update test * add sample * update tests * update docstrings to add clarity * update err message * remove generated cloud event * update sample * update * update samples to include dict * update patch * spacing * add comments * formatting * update doc * update tests * update tests * tests * skip tests for now * typo * add dict binary mode * update docstring * update patch to allow throw error * first pass at comments * update patch eror * nit --------- Co-authored-by: swathipil <[email protected]> * [EGv2] Build Release (#30325) * move old sdk under legacy * gen typespec code * naming changes from archboard * samples * update patch naming * update imports with new gen * update samples * update client naming on aio * update receive op * update async to close client * update receive() * update gen code * moving around samples * updating samples * update samples * update patch and samples * patch internalmodels * spacing * updating model patch * update patch models * add both models back * update docstring * update docs * updating patch for receive * old EG models * add reject samples * patch * update format * update patch * eventgrid_client exceptions * update test imports * update total sample * receive patch fix * add in more tests * update test file * remove locktoken model * remove LockToken in patch * remove event delivery delay * eg client exceptions * .8.5 generation, and deliveryCount * rename sample * update version for beta * changelog * updating for gen * regen * generate via commit * publish result * fix docstring * publish docstring * return type * publish result * return publish result -- is none * format * update Publish result model * deliverycount patch * update from main * add copyright * added to readme * remove from readme * force publish_result response * update patch tp unindent * cspell * update mypy.ini * import order * mark livetest * update operations init * rename async * mypy * ignore mypy * pylint * pylint * ignore pylint for now to avoid gen code errors * ignore samples until ARM setup * update patches * remove publish result * remove PublishResult * remove publishresult * comma Co-authored-by: swathipil <[email protected]> * update publishResult * change to .value * gen code " to ' * remove comment * ran black * update changelog * update sample readme * gen code without query name * gen code * update tsp commit * remove publishresult * readme disclaimer * update changelog --------- Co-authored-by: swathipil <[email protected]> * Beta LiveTests (#30728) * add bicep file for tests * update output * update test * secret sanitization * refactor failing test * update conftest * update assets and sanitizers * update preparer loc * update conftest * conftest * update conftest * remove variables for now * update assets * update tests * try to update regex * update recordings * update conftest * update preparer * update test * update exception test * update tests * update asset * update conftest * pr comments * default needs to be eastus * import * regen * new api version * samples for new features * update test-resources.json * update operation samples * add samples * more sample * update tests * add mros * gen * fix changelog * update tests * update preparer * point at canary until release * update test deployment area * update * add * try this tests * update samples * livetest mark * update tests * eastus working? * regen - removed azure refs in gen code * update comments * add other sample * update * remove stream - no response * update version and date for release --------- Co-authored-by: swathipil <[email protected]> * update for release * add changelog * [EG] Regenerate beta (#35014) * update generation * version * skip * [EG] Beta One Client (#34973) * [EG] dont hardcode api_version on request (#34965) * dont hardcode api_version on request * pylint fixes * revert * api version * Update sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_publisher_client_async.py * Update sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_publisher_client_async.py * add sync side patches * aio patches * update readme samples * all samples use EGClient * update readme samples * fix imports * import issue * missing pathc * allow sas cred * typo * updates * sas * client * self serialize cloudevent * add bakc in * updates * update ptach * update * update exception logic * async w client * aio [atch * typo * import * update links * tests * raise error * content type * use more fake url * remove content type * mypy * update apiversion * content type * unitttests * update auth * updates * add level * update readme * update * binary mode * args, kwargs * remove auth * add sample comments * testing * move around readme * content type * update tests * docstring * cncf event * add more tests * update doc * update inits to prevent typing errors * ran blakc * fix pylint patch * changes * add all kwargs * indent * reviews * nit * name changes * options * options/result rename * Revert "options" This reverts commit fe0623a. * Revert "options/result rename" This reverts commit 6d37422. * fix tests * remove or None * remove EGPubClient * remove options naming * Revert "remove EGPubClient" This reverts commit bf94364. * typeerror * update readme * readme nit * readme updates * add send operation samples * add datacontenttpye * typo * make Options bag models kwargs * remove models * import * exception * update changelog * shorten operation names * nit * [EG] Docstring/update changelog (#35108) * nits * Revert "shorten operation names" This reverts commit cd37161. * remove broken link * edit * update readme (#35147) * beta version * [EG] Readme updates (#35152) * simplify readme * update all links to feature branch * spacing * try * type error to value error (#35164) * [EG] rename release_delay (#35172) * rename * valueError * update version * version * [EG] regenerate to fix gen code bug (#35327) * regenerate to fix gen code bug * update serialization code * update * pylint * update faulty tests * use _patch * use _patch * add test type * fix test + add version * ver (#35345) * typo (#35348) * typo (#35351) * typo * update * [EG] Archboard Feedback (#35738) * regen * remove all samples/tests before fixing * move all topic/sub to client level * update * updates * update samples * add other publisher tests * missing * content type * consumerclient * upload consumer tests * updates * update * changes * updates * rename * update * patch * test update * update tests * fix * updates snippets * update readme * try updating api_version * typo Co-authored-by: swathipil <[email protected]> * typo2 Co-authored-by: swathipil <[email protected]> * renames/docs from comments * regen * update patch * remove import * caps --------- Co-authored-by: swathipil <[email protected]> * [EG] Update tests (#35833) * [EG] Update tests (#35752) * test * typo * update recordings * mark live * kwarg fix * updates * revert * kwargs * continue skip * rename * naming * remove _async * nit * typo * remove async * remove print (#35855) * [EG] update pyproject and samples (#35857) * update * pylint changes * update readme + version * regen * Update scripts/devops_tasks/test_run_samples.py * readme * typo * update * add tests * updates tests 2 * Revert "updates tests 2" This reverts commit 1b85d9e. * try * typeError * missing await * unused import --------- Co-authored-by: swathipil <[email protected]>
1 parent 9b6427c commit 8abbc26

File tree

118 files changed

+10260
-1751
lines changed

Some content is hidden

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

118 files changed

+10260
-1751
lines changed

.vscode/cspell.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@
200200
"centraluseuap",
201201
"creds",
202202
"ctoring",
203+
"ctxt",
203204
"ctypes",
204205
"curr",
205206
"dateutil",
@@ -209,6 +210,7 @@
209210
"dependened",
210211
"deque",
211212
"deserialization",
213+
"deserializers",
212214
"disablecov",
213215
"distilbert",
214216
"distilroberta",
@@ -297,6 +299,8 @@
297299
"mibps",
298300
"mgmt",
299301
"mhsm",
302+
"mros",
303+
"Nify",
300304
"mipsle",
301305
"mktime",
302306
"mlindex",
@@ -449,6 +453,7 @@
449453
"yarl",
450454
"SDDL",
451455
"dacl",
456+
"wday",
452457
"whls",
453458
"aiter",
454459
"solft",

sdk/eventgrid/azure-eventgrid/CHANGELOG.md

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,40 @@
11
# Release History
22

3-
## 4.19.1 (Unreleased)
3+
## 4.20.0 (Unreleased)
44

55
### Features Added
6-
76
### Breaking Changes
7+
### Bugs Fixed
8+
### Other Changes
9+
10+
## 4.20.0b2 (2024-04-25)
11+
12+
This is a Beta of the EventGridClient
813

914
### Bugs Fixed
1015

11-
### Other Changes
16+
- Fixed serialization issues with CloudEvent and CNCF Cloud Event
17+
18+
## 4.20.0b1 (2024-04-11)
19+
20+
### Features Added
21+
22+
- This is a Beta of the EventGridClient
23+
- EventGridClient `send` can be used for both Event Grid Namespace Resources and Event Grid Basic Resources.
24+
- Added a kwarg `level` in the EventGridClient constructor. The default value is `Standard` which creates a client for an Event Grid Namespace Resource.
25+
26+
### Breaking Changes
27+
28+
- Removed the `AcknowledgeOptions`,`ReleaseOptions`, `RejectOptions`, and `RenewLockOptions` models. `lock_tokens` can now be specified as a `kwarg` on the operation.
29+
- Renamed `publish_cloud_events` to `send`.
1230

1331
## 4.19.0 (2024-04-10)
1432

1533
### Features Added
1634

1735
- Added new enum values to `SystemEventNames` related to Azure Communication Services.
1836

19-
### Bugs Fixed
37+
### Breaking Changes
2038

2139
- Fixed a bug where the Api Version was being hardcoded to `2018-01-01` on any request sent to the service.
2240

@@ -32,6 +50,15 @@ This version and all future versions will require Python 3.8+.
3250
### Features Added
3351

3452
- Added new enums values to `SystemEventNames` related to Azure Storage and Azure VMware Solution.
53+
## 4.17.0b1 (2023-11-09)
54+
55+
### Features Added
56+
57+
- Beta EventGridClient features were added on top of the last GA version of EventGrid.
58+
- Added new features to the EventGridClient that supports `publish_cloud_events`, `receive_cloud_events`, `acknowledge_cloud_events` , `release_cloud_events`, and `reject_cloud_events` operations. These features include a `renew_cloud_event_locks` operation, as well as a `release_with_delay` parameter on the `release_cloud_events` operation.
59+
- The `lock_tokens` parameter in `reject_cloud_events`, `release_cloud_events`, and `acknowledge_cloud_events` was renamed to `reject_options`, `release_options`, and `acknowledge_options`.
60+
- The `binary_mode` keyword argument on `publish_cloud_events` was added to allow for binary mode support when publishing single Cloud Events.
61+
- Added new models to support these new operations on EventGridClient.
3562

3663
## 4.16.0 (2023-11-08)
3764

@@ -55,6 +82,7 @@ This version and all future versions will require Python 3.8+.
5582

5683
### Features Added
5784

85+
- Beta EventGridClient features were removed for this and future GA versions.
5886
- Added new enum values to `SystemEventNames` related to Azure Container Services.
5987

6088
## 4.12.0b1 (2023-05-22)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
recursive-include tests *.py *.yaml
2-
recursive-include samples *.py
31
include *.md
42
include LICENSE
5-
include azure/__init__.py
63
include azure/eventgrid/py.typed
4+
recursive-include tests *.py
5+
recursive-include samples *.py *.md
6+
include azure/__init__.py

sdk/eventgrid/azure-eventgrid/README.md

Lines changed: 134 additions & 145 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore

sdk/eventgrid/azure-eventgrid/azure/eventgrid/__init__.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,27 @@
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
44
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) Python Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
57
# --------------------------------------------------------------------------
68

7-
from ._publisher_client import EventGridPublisherClient
8-
from ._event_mappings import SystemEventNames
9-
from ._helpers import generate_sas
10-
from ._models import EventGridEvent
9+
from ._patch import EventGridPublisherClient
10+
from ._patch import EventGridConsumerClient
1111
from ._version import VERSION
1212

13+
__version__ = VERSION
14+
15+
try:
16+
from ._patch import __all__ as _patch_all
17+
from ._patch import * # pylint: disable=unused-wildcard-import
18+
except ImportError:
19+
_patch_all = []
20+
from ._patch import patch_sdk as _patch_sdk
21+
1322
__all__ = [
1423
"EventGridPublisherClient",
15-
"EventGridEvent",
16-
"generate_sas",
17-
"SystemEventNames",
24+
"EventGridConsumerClient",
1825
]
19-
__version__ = VERSION
26+
__all__.extend([p for p in _patch_all if p not in __all__])
27+
28+
_patch_sdk()
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) Python Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from copy import deepcopy
10+
from typing import Any, TYPE_CHECKING, Union
11+
12+
from azure.core import PipelineClient
13+
from azure.core.credentials import AzureKeyCredential
14+
from azure.core.pipeline import policies
15+
from azure.core.rest import HttpRequest, HttpResponse
16+
17+
from ._configuration import EventGridConsumerClientConfiguration, EventGridPublisherClientConfiguration
18+
from ._operations import EventGridConsumerClientOperationsMixin, EventGridPublisherClientOperationsMixin
19+
from ._serialization import Deserializer, Serializer
20+
21+
if TYPE_CHECKING:
22+
# pylint: disable=unused-import,ungrouped-imports
23+
from azure.core.credentials import TokenCredential
24+
25+
26+
class EventGridPublisherClient(
27+
EventGridPublisherClientOperationsMixin
28+
): # pylint: disable=client-accepts-api-version-keyword
29+
"""EventGridPublisherClient.
30+
31+
:param endpoint: The host name of the namespace, e.g.
32+
namespaceName1.westus-1.eventgrid.azure.net. Required.
33+
:type endpoint: str
34+
:param credential: Credential used to authenticate requests to the service. Is either a
35+
AzureKeyCredential type or a TokenCredential type. Required.
36+
:type credential: ~azure.core.credentials.AzureKeyCredential or
37+
~azure.core.credentials.TokenCredential
38+
:keyword api_version: The API version to use for this operation. Default value is "2024-06-01".
39+
Note that overriding this default value may result in unsupported behavior.
40+
:paramtype api_version: str
41+
"""
42+
43+
def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
44+
_endpoint = "{endpoint}"
45+
self._config = EventGridPublisherClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)
46+
_policies = kwargs.pop("policies", None)
47+
if _policies is None:
48+
_policies = [
49+
policies.RequestIdPolicy(**kwargs),
50+
self._config.headers_policy,
51+
self._config.user_agent_policy,
52+
self._config.proxy_policy,
53+
policies.ContentDecodePolicy(**kwargs),
54+
self._config.redirect_policy,
55+
self._config.retry_policy,
56+
self._config.authentication_policy,
57+
self._config.custom_hook_policy,
58+
self._config.logging_policy,
59+
policies.DistributedTracingPolicy(**kwargs),
60+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
61+
self._config.http_logging_policy,
62+
]
63+
self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
64+
65+
self._serialize = Serializer()
66+
self._deserialize = Deserializer()
67+
self._serialize.client_side_validation = False
68+
69+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
70+
"""Runs the network request through the client's chained policies.
71+
72+
>>> from azure.core.rest import HttpRequest
73+
>>> request = HttpRequest("GET", "https://www.example.org/")
74+
<HttpRequest [GET], url: 'https://www.example.org/'>
75+
>>> response = client.send_request(request)
76+
<HttpResponse: 200 OK>
77+
78+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
79+
80+
:param request: The network request you want to make. Required.
81+
:type request: ~azure.core.rest.HttpRequest
82+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
83+
:return: The response of your network call. Does not do error handling on your response.
84+
:rtype: ~azure.core.rest.HttpResponse
85+
"""
86+
87+
request_copy = deepcopy(request)
88+
path_format_arguments = {
89+
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
90+
}
91+
92+
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
93+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
94+
95+
def close(self) -> None:
96+
self._client.close()
97+
98+
def __enter__(self) -> "EventGridPublisherClient":
99+
self._client.__enter__()
100+
return self
101+
102+
def __exit__(self, *exc_details: Any) -> None:
103+
self._client.__exit__(*exc_details)
104+
105+
106+
class EventGridConsumerClient(
107+
EventGridConsumerClientOperationsMixin
108+
): # pylint: disable=client-accepts-api-version-keyword
109+
"""EventGridConsumerClient.
110+
111+
:param endpoint: The host name of the namespace, e.g.
112+
namespaceName1.westus-1.eventgrid.azure.net. Required.
113+
:type endpoint: str
114+
:param credential: Credential used to authenticate requests to the service. Is either a
115+
AzureKeyCredential type or a TokenCredential type. Required.
116+
:type credential: ~azure.core.credentials.AzureKeyCredential or
117+
~azure.core.credentials.TokenCredential
118+
:keyword api_version: The API version to use for this operation. Default value is "2024-06-01".
119+
Note that overriding this default value may result in unsupported behavior.
120+
:paramtype api_version: str
121+
"""
122+
123+
def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
124+
_endpoint = "{endpoint}"
125+
self._config = EventGridConsumerClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)
126+
_policies = kwargs.pop("policies", None)
127+
if _policies is None:
128+
_policies = [
129+
policies.RequestIdPolicy(**kwargs),
130+
self._config.headers_policy,
131+
self._config.user_agent_policy,
132+
self._config.proxy_policy,
133+
policies.ContentDecodePolicy(**kwargs),
134+
self._config.redirect_policy,
135+
self._config.retry_policy,
136+
self._config.authentication_policy,
137+
self._config.custom_hook_policy,
138+
self._config.logging_policy,
139+
policies.DistributedTracingPolicy(**kwargs),
140+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
141+
self._config.http_logging_policy,
142+
]
143+
self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
144+
145+
self._serialize = Serializer()
146+
self._deserialize = Deserializer()
147+
self._serialize.client_side_validation = False
148+
149+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
150+
"""Runs the network request through the client's chained policies.
151+
152+
>>> from azure.core.rest import HttpRequest
153+
>>> request = HttpRequest("GET", "https://www.example.org/")
154+
<HttpRequest [GET], url: 'https://www.example.org/'>
155+
>>> response = client.send_request(request)
156+
<HttpResponse: 200 OK>
157+
158+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
159+
160+
:param request: The network request you want to make. Required.
161+
:type request: ~azure.core.rest.HttpRequest
162+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
163+
:return: The response of your network call. Does not do error handling on your response.
164+
:rtype: ~azure.core.rest.HttpResponse
165+
"""
166+
167+
request_copy = deepcopy(request)
168+
path_format_arguments = {
169+
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
170+
}
171+
172+
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
173+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
174+
175+
def close(self) -> None:
176+
self._client.close()
177+
178+
def __enter__(self) -> "EventGridConsumerClient":
179+
self._client.__enter__()
180+
return self
181+
182+
def __exit__(self, *exc_details: Any) -> None:
183+
self._client.__exit__(*exc_details)

0 commit comments

Comments
 (0)