Skip to content
Merged
Show file tree
Hide file tree
Changes from 86 commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
a25793b
move old sdk under legacy
l0lawrence Apr 24, 2023
ad72024
gen typespec code
l0lawrence Apr 24, 2023
f81c227
naming changes from archboard
l0lawrence Apr 27, 2023
486735f
samples
l0lawrence Apr 27, 2023
1fa0d92
update patch naming
l0lawrence Apr 27, 2023
e284adf
update imports with new gen
l0lawrence Apr 27, 2023
5efd365
update samples
l0lawrence Apr 27, 2023
aebdf0c
update client naming on aio
l0lawrence Apr 27, 2023
276d51a
update receive op
l0lawrence Apr 27, 2023
81161a8
update async to close client
l0lawrence Apr 27, 2023
d419cf2
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
l0lawrence Apr 27, 2023
32efd54
update receive()
l0lawrence May 1, 2023
b1eeca8
update gen code
l0lawrence May 1, 2023
5634655
moving around samples
l0lawrence May 1, 2023
36976bd
updating samples
l0lawrence May 1, 2023
328a71a
update samples
l0lawrence May 1, 2023
ba088a2
update patch and samples
l0lawrence May 1, 2023
bdf3bc0
patch internalmodels
l0lawrence May 1, 2023
57c6ada
spacing
l0lawrence May 1, 2023
4100767
updating model patch
l0lawrence May 1, 2023
69a61e1
update patch models
l0lawrence May 1, 2023
594ba71
add both models back
l0lawrence May 1, 2023
abd97bc
update docstring
l0lawrence May 1, 2023
cb4d9a2
update docs
l0lawrence May 1, 2023
3429e60
updating patch for receive
l0lawrence May 2, 2023
9d7cf66
old EG models
l0lawrence May 2, 2023
199542a
add reject samples
l0lawrence May 2, 2023
8f77e83
patch
l0lawrence May 2, 2023
a31e9fa
update format
l0lawrence May 2, 2023
710f8c3
update patch
l0lawrence May 4, 2023
bdec4b8
eventgrid_client exceptions
l0lawrence May 4, 2023
5bca49d
update test imports
l0lawrence May 4, 2023
b9a4d6f
update total sample
l0lawrence May 4, 2023
b0e50c3
receive patch fix
l0lawrence May 4, 2023
135b0c7
add in more tests
l0lawrence May 4, 2023
19573e2
update test file
l0lawrence May 8, 2023
24b2535
remove locktoken model
l0lawrence May 9, 2023
9a12471
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
l0lawrence May 9, 2023
dc2d26c
remove LockToken in patch
l0lawrence May 9, 2023
cec8bd0
remove event delivery delay
l0lawrence May 11, 2023
a26c1e7
eg client exceptions
l0lawrence May 11, 2023
cf80540
.8.5 generation, and deliveryCount
l0lawrence May 12, 2023
c1f1ae7
rename sample
l0lawrence May 15, 2023
8538458
update version for beta
l0lawrence May 15, 2023
4e7b141
changelog
l0lawrence May 15, 2023
7713d3b
updating for gen
l0lawrence May 15, 2023
e9eab96
regen
l0lawrence May 16, 2023
36ac074
generate via commit
l0lawrence May 16, 2023
b58773e
publish result
l0lawrence May 16, 2023
459b403
fix docstring
l0lawrence May 16, 2023
e091bb9
publish docstring
l0lawrence May 16, 2023
eb50871
return type
l0lawrence May 16, 2023
1edd9ac
publish result
l0lawrence May 16, 2023
7fb9946
return publish result -- is none
l0lawrence May 16, 2023
f1f18f5
format
l0lawrence May 16, 2023
1646322
update Publish result model
l0lawrence May 16, 2023
0da1768
deliverycount patch
l0lawrence May 16, 2023
7ef5bbe
update from main
l0lawrence May 16, 2023
07da8c7
Merge branch 'feature/eventgrid' of https://github.com/Azure/azure-sd…
l0lawrence May 16, 2023
ed4c53c
add copyright
l0lawrence May 16, 2023
da155ae
added to readme
l0lawrence May 16, 2023
11708ec
remove from readme
l0lawrence May 16, 2023
6acc4bc
force publish_result response
l0lawrence May 16, 2023
5c97aed
update patch tp unindent
l0lawrence May 16, 2023
994ab41
cspell
l0lawrence May 16, 2023
060c9ce
update mypy.ini
l0lawrence May 16, 2023
d72039c
import order
l0lawrence May 16, 2023
e16a255
mark livetest
l0lawrence May 16, 2023
df0430f
update operations init
l0lawrence May 16, 2023
830fd1d
rename async
l0lawrence May 16, 2023
30bc939
mypy
l0lawrence May 16, 2023
fb0479e
ignore mypy
l0lawrence May 16, 2023
2a050e1
pylint
l0lawrence May 16, 2023
26dfdef
pylint
l0lawrence May 16, 2023
37e7341
ignore pylint for now to avoid gen code errors
l0lawrence May 16, 2023
99bbe93
ignore samples until ARM setup
l0lawrence May 17, 2023
bcf7d34
update patches
l0lawrence May 17, 2023
4927ac1
remove publish result
l0lawrence May 17, 2023
4bde87e
remove PublishResult
l0lawrence May 17, 2023
78605f2
remove publishresult
l0lawrence May 17, 2023
b050474
comma
l0lawrence May 17, 2023
e0ff0ed
update publishResult
l0lawrence May 18, 2023
34ff7a3
Merge branch 'llaw/build_eventgrid' of https://github.com/l0lawrence/…
l0lawrence May 18, 2023
4f26e01
change to .value
l0lawrence May 18, 2023
80f0384
gen code " to '
l0lawrence May 18, 2023
58b4d7e
remove comment
l0lawrence May 18, 2023
fea7384
ran black
l0lawrence May 18, 2023
c557de0
update changelog
l0lawrence May 19, 2023
522e90c
update sample readme
l0lawrence May 19, 2023
7349da4
gen code without query name
l0lawrence May 19, 2023
204a6d6
gen code
l0lawrence May 19, 2023
adb9f45
update tsp commit
l0lawrence May 19, 2023
0fdc51f
remove publishresult
l0lawrence May 19, 2023
1442893
readme disclaimer
l0lawrence May 19, 2023
b820027
update changelog
l0lawrence May 19, 2023
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
4 changes: 4 additions & 0 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"centraluseuap",
"creds",
"ctoring",
"ctxt",
"ctypes",
"curr",
"dateutil",
Expand All @@ -169,6 +170,7 @@
"dependened",
"deque",
"deserialization",
"deserializers",
"disablecov",
"distilbert",
"distilroberta",
Expand Down Expand Up @@ -255,6 +257,7 @@
"mhsm",
"mipsle",
"mktime",
"mros",
"msal",
"msrest",
"msrestazure",
Expand Down Expand Up @@ -400,6 +403,7 @@
"yarl",
"SDDL",
"dacl",
"wday",
"whls",
"aiter"
],
Expand Down
15 changes: 14 additions & 1 deletion scripts/devops_tasks/test_run_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,20 @@
"consume_cloud_events_from_eventhub.py",
"consume_eventgrid_events_from_service_bus_queue.py",
"sample_publish_events_to_a_topic_using_sas_credential.py",
"sample_publish_events_to_a_topic_using_sas_credential_async.py"
"sample_publish_events_to_a_topic_using_sas_credential_async.py",
'sample_publish_operation.py',
'sample_receive_operation.py',
'sample_reject_operation.py',
'sample_eg_client_authentication.py',
'sample_all_operations.py',
'sample_release_operation.py',
'sample_acknowledge_operation.py',
'sample_publish_operation_async.py',
'sample_release_operation_async.py',
'sample_reject_operation_async.py',
'sample_acknowledge_operation_async.py',
'sample_receive_operation_async.py',
'sample_all_operations_async.py'
],
"azure-eventhub": [
"client_identity_authentication.py", # TODO: remove after fixing issue #29177
Expand Down
5 changes: 4 additions & 1 deletion sdk/eventgrid/azure-eventgrid/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Release History

## 4.11.1 (Unreleased)
## 4.12.0b1 (Unreleased)

### Features Added

- Added a new EventGridClient that supports publish, receive, acknowledge, release, and reject operations for CloudEvents.
- Added new models to support the new operations on EventGridClient.

### Breaking Changes

### Bugs Fixed
Expand Down
6 changes: 3 additions & 3 deletions sdk/eventgrid/azure-eventgrid/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
recursive-include tests *.py *.yaml
recursive-include samples *.py
include *.md
include LICENSE
include azure/__init__.py
include azure/eventgrid/py.typed
recursive-include tests *.py
recursive-include samples *.py *.md
include azure/__init__.py
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
24 changes: 15 additions & 9 deletions sdk/eventgrid/azure-eventgrid/azure/eventgrid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,24 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._publisher_client import EventGridPublisherClient
from ._event_mappings import SystemEventNames
from ._helpers import generate_sas
from ._models import EventGridEvent
from ._client import EventGridClient
from ._version import VERSION

__version__ = VERSION

try:
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
__all__ = [
"EventGridPublisherClient",
"EventGridEvent",
"generate_sas",
"SystemEventNames",
'EventGridClient',
]
__version__ = VERSION
__all__.extend([p for p in _patch_all if p not in __all__])

_patch_sdk()
87 changes: 87 additions & 0 deletions sdk/eventgrid/azure-eventgrid/azure/eventgrid/_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from copy import deepcopy
from typing import Any

from azure.core import PipelineClient
from azure.core.credentials import AzureKeyCredential
from azure.core.rest import HttpRequest, HttpResponse

from ._configuration import EventGridClientConfiguration
from ._operations import EventGridClientOperationsMixin
from ._serialization import Deserializer, Serializer

class EventGridClient(EventGridClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword
"""Azure Messaging EventGrid Client.

:param endpoint: The host name of the namespace, e.g.
namespaceName1.westus-1.eventgrid.azure.net. Required.
:type endpoint: str
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential
:keyword api_version: The API version to use for this operation. Default value is
"2023-06-01-preview". Note that overriding this default value may result in unsupported
behavior.
:paramtype api_version: str
"""

def __init__(
self,
endpoint: str,
credential: AzureKeyCredential,
**kwargs: Any
) -> None:
_endpoint = '{endpoint}'
self._config = EventGridClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)
self._client: PipelineClient = PipelineClient(base_url=_endpoint, config=self._config, **kwargs)

self._serialize = Serializer()
self._deserialize = Deserializer()
self._serialize.client_side_validation = False


def send_request(
self,
request: HttpRequest,
**kwargs: Any
) -> HttpResponse:
"""Runs the network request through the client's chained policies.

>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client.send_request(request)
<HttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request

:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.rest.HttpResponse
"""

request_copy = deepcopy(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
}

request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
return self._client.send_request(request_copy, **kwargs)

def close(self) -> None:
self._client.close()

def __enter__(self) -> "EventGridClient":
self._client.__enter__()
return self

def __exit__(self, *exc_details: Any) -> None:
self._client.__exit__(*exc_details)
70 changes: 70 additions & 0 deletions sdk/eventgrid/azure-eventgrid/azure/eventgrid/_configuration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import Any

from azure.core.configuration import Configuration
from azure.core.credentials import AzureKeyCredential
from azure.core.pipeline import policies

from ._version import VERSION


class EventGridClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
"""Configuration for EventGridClient.

Note that all parameters used to create this instance are saved as instance
attributes.

:param endpoint: The host name of the namespace, e.g.
namespaceName1.westus-1.eventgrid.azure.net. Required.
:type endpoint: str
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential
:keyword api_version: The API version to use for this operation. Default value is
"2023-06-01-preview". Note that overriding this default value may result in unsupported
behavior.
:paramtype api_version: str
"""

def __init__(
self,
endpoint: str,
credential: AzureKeyCredential,
**kwargs: Any
) -> None:
super(EventGridClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop('api_version', "2023-06-01-preview")

if endpoint is None:
raise ValueError("Parameter 'endpoint' must not be None.")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")

self.endpoint = endpoint
self.credential = credential
self.api_version = api_version
kwargs.setdefault('sdk_moniker', 'eventgrid/{}'.format(VERSION))
self._configure(**kwargs)


def _configure(
self,
**kwargs: Any
) -> None:
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.AzureKeyCredentialPolicy(self.credential, "SharedAccessKey", **kwargs)
Loading