Skip to content

Commit 7f7a52c

Browse files
l0lawrenceswathipil
andcommitted
[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]>
1 parent b7c99cf commit 7f7a52c

File tree

125 files changed

+7867
-1090
lines changed

Some content is hidden

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

125 files changed

+7867
-1090
lines changed

.vscode/cspell.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@
198198
"centraluseuap",
199199
"creds",
200200
"ctoring",
201+
"ctxt",
201202
"ctypes",
202203
"curr",
203204
"dateutil",
@@ -207,6 +208,7 @@
207208
"dependened",
208209
"deque",
209210
"deserialization",
211+
"deserializers",
210212
"disablecov",
211213
"distilbert",
212214
"distilroberta",
@@ -447,6 +449,7 @@
447449
"yarl",
448450
"SDDL",
449451
"dacl",
452+
"wday",
450453
"whls",
451454
"aiter",
452455
"solft",

scripts/devops_tasks/test_run_samples.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,20 @@
8787
"consume_cloud_events_from_eventhub.py",
8888
"consume_eventgrid_events_from_service_bus_queue.py",
8989
"sample_publish_events_to_a_topic_using_sas_credential.py",
90-
"sample_publish_events_to_a_topic_using_sas_credential_async.py"
90+
"sample_publish_events_to_a_topic_using_sas_credential_async.py",
91+
'sample_publish_operation.py',
92+
'sample_receive_operation.py',
93+
'sample_reject_operation.py',
94+
'sample_eg_client_authentication.py',
95+
'sample_all_operations.py',
96+
'sample_release_operation.py',
97+
'sample_acknowledge_operation.py',
98+
'sample_publish_operation_async.py',
99+
'sample_release_operation_async.py',
100+
'sample_reject_operation_async.py',
101+
'sample_acknowledge_operation_async.py',
102+
'sample_receive_operation_async.py',
103+
'sample_all_operations_async.py'
91104
],
92105
"azure-eventhub": [
93106
"client_identity_authentication.py", # TODO: remove after fixing issue #29177
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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ Azure Event Grid is a fully-managed intelligent event routing service that allow
1010
| [Samples][python-eg-samples]
1111
| [Changelog][python-eg-changelog]
1212

13+
## _Disclaimer_
14+
15+
This is the first beta release of Azure EventGrid's `EventGridClient`, along with the GA `EventGridPublisherClient`. `EventGridClient` supports `publish_cloud_events`, `receive_cloud_events`, `acknowledge_cloud_events` , `release_cloud_events`, and `reject_cloud_events` operations. Please refer to the [samples](https://github.com/Azure/azure-sdk-for-python/tree/feature/eventgrid/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples) for further information.
16+
1317
## Getting started
1418

1519
### Prerequisites
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: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,24 @@
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 ._client import EventGridClient
1110
from ._version import VERSION
1211

12+
__version__ = VERSION
13+
14+
try:
15+
from ._patch import __all__ as _patch_all
16+
from ._patch import * # pylint: disable=unused-wildcard-import
17+
except ImportError:
18+
_patch_all = []
19+
from ._patch import patch_sdk as _patch_sdk
1320
__all__ = [
14-
"EventGridPublisherClient",
15-
"EventGridEvent",
16-
"generate_sas",
17-
"SystemEventNames",
21+
'EventGridClient',
1822
]
19-
__version__ = VERSION
23+
__all__.extend([p for p in _patch_all if p not in __all__])
24+
25+
_patch_sdk()
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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
11+
12+
from azure.core import PipelineClient
13+
from azure.core.credentials import AzureKeyCredential
14+
from azure.core.rest import HttpRequest, HttpResponse
15+
16+
from ._configuration import EventGridClientConfiguration
17+
from ._operations import EventGridClientOperationsMixin
18+
from ._serialization import Deserializer, Serializer
19+
20+
class EventGridClient(EventGridClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword
21+
"""Azure Messaging EventGrid Client.
22+
23+
:param endpoint: The host name of the namespace, e.g.
24+
namespaceName1.westus-1.eventgrid.azure.net. Required.
25+
:type endpoint: str
26+
:param credential: Credential needed for the client to connect to Azure. Required.
27+
:type credential: ~azure.core.credentials.AzureKeyCredential
28+
:keyword api_version: The API version to use for this operation. Default value is
29+
"2023-06-01-preview". Note that overriding this default value may result in unsupported
30+
behavior.
31+
:paramtype api_version: str
32+
"""
33+
34+
def __init__(
35+
self,
36+
endpoint: str,
37+
credential: AzureKeyCredential,
38+
**kwargs: Any
39+
) -> None:
40+
_endpoint = '{endpoint}'
41+
self._config = EventGridClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)
42+
self._client: PipelineClient = PipelineClient(base_url=_endpoint, config=self._config, **kwargs)
43+
44+
self._serialize = Serializer()
45+
self._deserialize = Deserializer()
46+
self._serialize.client_side_validation = False
47+
48+
49+
def send_request(
50+
self,
51+
request: HttpRequest,
52+
**kwargs: Any
53+
) -> HttpResponse:
54+
"""Runs the network request through the client's chained policies.
55+
56+
>>> from azure.core.rest import HttpRequest
57+
>>> request = HttpRequest("GET", "https://www.example.org/")
58+
<HttpRequest [GET], url: 'https://www.example.org/'>
59+
>>> response = client.send_request(request)
60+
<HttpResponse: 200 OK>
61+
62+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
63+
64+
:param request: The network request you want to make. Required.
65+
:type request: ~azure.core.rest.HttpRequest
66+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
67+
:return: The response of your network call. Does not do error handling on your response.
68+
:rtype: ~azure.core.rest.HttpResponse
69+
"""
70+
71+
request_copy = deepcopy(request)
72+
path_format_arguments = {
73+
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
74+
}
75+
76+
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
77+
return self._client.send_request(request_copy, **kwargs)
78+
79+
def close(self) -> None:
80+
self._client.close()
81+
82+
def __enter__(self) -> "EventGridClient":
83+
self._client.__enter__()
84+
return self
85+
86+
def __exit__(self, *exc_details: Any) -> None:
87+
self._client.__exit__(*exc_details)
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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 typing import Any
10+
11+
from azure.core.configuration import Configuration
12+
from azure.core.credentials import AzureKeyCredential
13+
from azure.core.pipeline import policies
14+
15+
from ._version import VERSION
16+
17+
18+
class EventGridClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
19+
"""Configuration for EventGridClient.
20+
21+
Note that all parameters used to create this instance are saved as instance
22+
attributes.
23+
24+
:param endpoint: The host name of the namespace, e.g.
25+
namespaceName1.westus-1.eventgrid.azure.net. Required.
26+
:type endpoint: str
27+
:param credential: Credential needed for the client to connect to Azure. Required.
28+
:type credential: ~azure.core.credentials.AzureKeyCredential
29+
:keyword api_version: The API version to use for this operation. Default value is
30+
"2023-06-01-preview". Note that overriding this default value may result in unsupported
31+
behavior.
32+
:paramtype api_version: str
33+
"""
34+
35+
def __init__(
36+
self,
37+
endpoint: str,
38+
credential: AzureKeyCredential,
39+
**kwargs: Any
40+
) -> None:
41+
super(EventGridClientConfiguration, self).__init__(**kwargs)
42+
api_version: str = kwargs.pop('api_version', "2023-06-01-preview")
43+
44+
if endpoint is None:
45+
raise ValueError("Parameter 'endpoint' must not be None.")
46+
if credential is None:
47+
raise ValueError("Parameter 'credential' must not be None.")
48+
49+
self.endpoint = endpoint
50+
self.credential = credential
51+
self.api_version = api_version
52+
kwargs.setdefault('sdk_moniker', 'eventgrid/{}'.format(VERSION))
53+
self._configure(**kwargs)
54+
55+
56+
def _configure(
57+
self,
58+
**kwargs: Any
59+
) -> None:
60+
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
61+
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
62+
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
63+
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
64+
self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
65+
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
66+
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
67+
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
68+
self.authentication_policy = kwargs.get('authentication_policy')
69+
if self.credential and not self.authentication_policy:
70+
self.authentication_policy = policies.AzureKeyCredentialPolicy(self.credential, "SharedAccessKey", **kwargs)

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

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
# --------------------------------------------------------------------------
6+
7+
from ._publisher_client import EventGridPublisherClient
8+
from ._event_mappings import SystemEventNames
9+
from ._helpers import generate_sas
10+
from ._models import EventGridEvent
11+
from ._version import VERSION
12+
13+
__all__ = [
14+
"EventGridPublisherClient",
15+
"EventGridEvent",
16+
"generate_sas",
17+
"SystemEventNames",
18+
]
19+
__version__ = VERSION

0 commit comments

Comments
 (0)