Skip to content
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

[EG] Beta One Client #34973

Merged
merged 84 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
c8b92f5
[EG] dont hardcode api_version on request (#34965)
l0lawrence Mar 27, 2024
d5c7f31
add sync side patches
l0lawrence Mar 27, 2024
b33f24e
aio patches
l0lawrence Mar 29, 2024
10275c3
update readme samples
l0lawrence Mar 29, 2024
4b972fb
all samples use EGClient
l0lawrence Mar 29, 2024
6afe650
update readme samples
l0lawrence Mar 29, 2024
c2da0d2
fix imports
l0lawrence Mar 29, 2024
6e30992
import issue
l0lawrence Mar 29, 2024
3a3dfd5
missing pathc
l0lawrence Mar 29, 2024
1d2e3fb
allow sas cred
l0lawrence Mar 29, 2024
36156ee
typo
l0lawrence Mar 29, 2024
1ffe29c
updates
l0lawrence Mar 29, 2024
d31a9ad
sas
l0lawrence Mar 29, 2024
eddc282
client
l0lawrence Mar 29, 2024
9195ef8
self serialize cloudevent
l0lawrence Apr 1, 2024
5e4face
add bakc in
l0lawrence Apr 1, 2024
dc9dfb1
updates
l0lawrence Apr 1, 2024
18e30ab
update ptach
l0lawrence Apr 1, 2024
9e0ab3d
update
l0lawrence Apr 1, 2024
da460d5
update exception logic
l0lawrence Apr 1, 2024
f445558
async w client
l0lawrence Apr 1, 2024
b1568d3
aio [atch
l0lawrence Apr 1, 2024
e5666bc
typo
l0lawrence Apr 1, 2024
8ce9377
import
l0lawrence Apr 1, 2024
a55861b
update links
l0lawrence Apr 1, 2024
3e9231a
tests
l0lawrence Apr 1, 2024
cce33cc
raise error
l0lawrence Apr 1, 2024
8e68c4c
content type
l0lawrence Apr 1, 2024
009d24b
use more fake url
l0lawrence Apr 1, 2024
a0e055f
remove content type
l0lawrence Apr 1, 2024
9a5fb89
mypy
l0lawrence Apr 1, 2024
4f42263
update apiversion
l0lawrence Apr 1, 2024
2737e9e
content type
l0lawrence Apr 1, 2024
a3a78ac
unitttests
l0lawrence Apr 2, 2024
ef4b2eb
update auth
l0lawrence Apr 2, 2024
37e7839
updates
l0lawrence Apr 2, 2024
de8f2bd
add level
l0lawrence Apr 2, 2024
241cdc2
update readme
l0lawrence Apr 2, 2024
d744e99
update
l0lawrence Apr 2, 2024
4dfa335
binary mode
l0lawrence Apr 2, 2024
cb9354d
args, kwargs
l0lawrence Apr 2, 2024
240e959
remove auth
l0lawrence Apr 2, 2024
339a9d6
add sample comments
l0lawrence Apr 2, 2024
0938e4b
testing
l0lawrence Apr 2, 2024
7c4934b
move around readme
l0lawrence Apr 2, 2024
ccd5c85
content type
l0lawrence Apr 3, 2024
307668a
update tests
l0lawrence Apr 3, 2024
55ace2e
docstring
l0lawrence Apr 3, 2024
e078283
cncf event
l0lawrence Apr 3, 2024
38007d7
add more tests
l0lawrence Apr 3, 2024
fe2d551
update doc
l0lawrence Apr 3, 2024
0769169
update inits to prevent typing errors
l0lawrence Apr 3, 2024
3afea29
ran blakc
l0lawrence Apr 3, 2024
5a6f41a
fix pylint patch
l0lawrence Apr 3, 2024
03ff6b3
changes
l0lawrence Apr 3, 2024
51737b4
add all kwargs
l0lawrence Apr 3, 2024
0f4ab57
indent
l0lawrence Apr 3, 2024
fd8adfc
reviews
l0lawrence Apr 3, 2024
bf35f7b
nit
l0lawrence Apr 3, 2024
bd4ea4e
name changes
l0lawrence Apr 3, 2024
fe0623a
options
l0lawrence Apr 3, 2024
6d37422
options/result rename
l0lawrence Apr 3, 2024
291e88c
Revert "options"
l0lawrence Apr 4, 2024
93fb64b
Revert "options/result rename"
l0lawrence Apr 4, 2024
61e81c0
fix tests
l0lawrence Apr 4, 2024
475ed6a
remove or None
l0lawrence Apr 4, 2024
bf94364
remove EGPubClient
l0lawrence Apr 4, 2024
7d4e712
remove options naming
l0lawrence Apr 4, 2024
e5c92a6
Merge branch 'llawrence/eg/oneclient' of https://github.com/l0lawrenc…
l0lawrence Apr 4, 2024
788a3e3
Revert "remove EGPubClient"
l0lawrence Apr 4, 2024
92543d8
typeerror
l0lawrence Apr 4, 2024
6c293ac
update readme
l0lawrence Apr 4, 2024
bb514b7
readme nit
l0lawrence Apr 4, 2024
f4fc072
readme updates
l0lawrence Apr 4, 2024
31a200a
add send operation samples
l0lawrence Apr 4, 2024
1a5b355
add datacontenttpye
l0lawrence Apr 4, 2024
1abb59f
typo
l0lawrence Apr 5, 2024
c906efa
make Options bag models kwargs
l0lawrence Apr 5, 2024
484cea4
remove models
l0lawrence Apr 5, 2024
67b5ba3
import
l0lawrence Apr 5, 2024
bb45754
exception
l0lawrence Apr 5, 2024
19ca9e0
update changelog
l0lawrence Apr 5, 2024
cd37161
shorten operation names
l0lawrence Apr 5, 2024
e793e38
nit
l0lawrence Apr 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions sdk/eventgrid/azure-eventgrid/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@

### Features Added

### Breaking Changes
- This is a Beta of the EventGridClient
- EventGridClient `send` can be used for both Event Grid Namespace Resources and Event Grid Basic Resources.
- Added a kwarg `level` in the EventGridClient constructor. The default value is `Standard` which creates a client for an Event Grid Namespace Resource.

### Bugs Fixed
### Breaking Changes
- Removed the `AcknowledgeOptions`,`ReleaseOptions`, `RejectOptions`, and `RenewLockOptions` models. `lock_tokens` can now be specified as a `kwarg` on the operation.
- Renamed `publish_cloud_events` to `send`, `receive_cloud_events` to `receive`, `release_cloud_events` to `release`, `acknowledge_cloud_events` to `acknowledge`, `reject_cloud_events` to `reject`, and `renew_cloud_event_locks` to `renew_locks`.

### Other Changes

## 4.18.0 (2024-03-12)

Expand Down
324 changes: 190 additions & 134 deletions sdk/eventgrid/azure-eventgrid/README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sdk/eventgrid/azure-eventgrid/azure/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._client import EventGridClient
from ._patch import EventGridClient
from ._version import VERSION

__version__ = VERSION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def _from_cncf_events(event): # pylint: disable=inconsistent-return-statements
raise ValueError(msg) from err


def _build_request(endpoint, content_type, events, *, channel_name=None):
def _build_request(endpoint, content_type, events, *, channel_name=None, api_version=constants.DEFAULT_API_VERSION):
serialize = Serializer()
header_parameters: Dict[str, Any] = {}
header_parameters['Content-Type'] = serialize.header("content_type", content_type, 'str')
Expand All @@ -181,7 +181,7 @@ def _build_request(endpoint, content_type, events, *, channel_name=None):
header_parameters["aeg-channel-name"] = channel_name

query_parameters: Dict[str, Any] = {}
query_parameters['api-version'] = serialize.query("api_version", "2018-01-01", 'str')
query_parameters['api-version'] = serialize.query("api_version", api_version, 'str')

body = serialize.body(events, "[object]")
if body is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
EventGridPublisherClient as EventGridPublisherClientImpl,
)
from ._policies import CloudEventDistributedTracingPolicy
from ._constants import DEFAULT_API_VERSION
from ._version import VERSION

if TYPE_CHECKING:
Expand Down Expand Up @@ -81,6 +82,9 @@ class EventGridPublisherClient(
implements SAS key authentication or SAS token authentication or a TokenCredential.
:type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.AzureSasCredential or
~azure.core.credentials.TokenCredential
:keyword api_version: Api Version. Will default to the most recent Api Version. Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:rtype: None

.. admonition:: Example:
Expand All @@ -100,12 +104,19 @@ class EventGridPublisherClient(
:caption: Creating the EventGridPublisherClient with an endpoint and AzureSasCredential.
"""

def __init__(self, endpoint, credential, **kwargs):
# type: (str, Union[AzureKeyCredential, AzureSasCredential, TokenCredential], Any) -> None
def __init__(
self,
endpoint: str,
credential: Union["AzureKeyCredential", "AzureSasCredential", "TokenCredential"],
*,
api_version: Optional[str] = None,
**kwargs: Any
) -> None:
self._endpoint = endpoint
self._client = EventGridPublisherClientImpl(
policies=EventGridPublisherClient._policies(credential, **kwargs), **kwargs
)
self._api_version = api_version if api_version is not None else DEFAULT_API_VERSION

@staticmethod
def _policies(credential, **kwargs):
Expand Down Expand Up @@ -217,9 +228,8 @@ def send(
_eventgrid_data_typecheck(event)
response = self._client.send_request( # pylint: disable=protected-access
_build_request(
self._endpoint, content_type, events, channel_name=channel_name
),
**kwargs
self._endpoint,content_type, events, channel_name=channel_name, api_version=self._api_version),
**kwargs
)
error_map = {
401: ClientAuthenticationError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
_get_authentication_policy,
_from_cncf_events,
)
from .._constants import DEFAULT_API_VERSION
from .._generated.aio import EventGridPublisherClient as EventGridPublisherClientAsync
from .._version import VERSION

Expand Down Expand Up @@ -73,6 +74,9 @@ class EventGridPublisherClient: # pylint: disable=client-accepts-api-version-ke
SAS key authentication or SAS token authentication or an AsyncTokenCredential.
:type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.AzureSasCredential or
~azure.core.credentials_async.AsyncTokenCredential
:keyword api_version: Api Version. Will default to the most recent Api Version. Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:rtype: None

.. admonition:: Example:
Expand All @@ -98,12 +102,15 @@ def __init__(
credential: Union[
"AsyncTokenCredential", AzureKeyCredential, AzureSasCredential
],
*,
api_version: Optional[str] = None,
**kwargs: Any
) -> None:
self._client = EventGridPublisherClientAsync(
policies=EventGridPublisherClient._policies(credential, **kwargs), **kwargs
)
self._endpoint = endpoint
self._api_version = api_version if api_version is not None else DEFAULT_API_VERSION

@staticmethod
def _policies(
Expand Down Expand Up @@ -220,9 +227,8 @@ async def send(
for event in events:
_eventgrid_data_typecheck(event)
response = await self._client.send_request( # pylint: disable=protected-access
_build_request(
self._endpoint, content_type, events, channel_name=channel_name
),
_build_request(self._endpoint, content_type, events,
channel_name=channel_name, api_version=self._api_version),
**kwargs
)
error_map = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._operations import EventGridClientOperationsMixin
from ._patch import EventGridClientOperationsMixin

from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
Expand Down
Loading