Skip to content

Commit 52f7a74

Browse files
l0lawrenceswathipil
andcommitted
[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]>
1 parent 8c9da89 commit 52f7a74

Some content is hidden

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

42 files changed

+1398
-437
lines changed

.vscode/cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@
297297
"mibps",
298298
"mgmt",
299299
"mhsm",
300+
"mros",
300301
"Nify",
301302
"mipsle",
302303
"mktime",

sdk/eventgrid/azure-eventgrid/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ This version and all future versions will require Python 3.8+.
3232
### Features Added
3333

3434
- Added new enums values to `SystemEventNames` related to Azure Storage and Azure VMware Solution.
35+
## 4.17.0b1 (2023-11-09)
36+
37+
### Features Added
38+
39+
- 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.
40+
- `lock_tokens` parameter in `reject_cloud_events`, `release_cloud_events`, and `acknowledge_cloud_events` renamed to `reject_options`, `release_options`, and `acknowledge_options`.
41+
- Added new models to support these new operations on EventGridClient.
3542

3643
## 4.16.0 (2023-11-08)
3744

sdk/eventgrid/azure-eventgrid/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "python",
44
"TagPrefix": "python/eventgrid/azure-eventgrid",
5-
"Tag": "python/eventgrid/azure-eventgrid_fce4958e09"
5+
"Tag": "python/eventgrid/azure-eventgrid_f155c8ac2d"
66
}

sdk/eventgrid/azure-eventgrid/azure/eventgrid/_client.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
from azure.core import PipelineClient
1313
from azure.core.credentials import AzureKeyCredential
14+
from azure.core.pipeline import policies
1415
from azure.core.rest import HttpRequest, HttpResponse
1516

1617
from ._configuration import EventGridClientConfiguration
@@ -32,7 +33,7 @@ class EventGridClient(EventGridClientOperationsMixin): # pylint: disable=client
3233
:type credential: ~azure.core.credentials.AzureKeyCredential or
3334
~azure.core.credentials.TokenCredential
3435
:keyword api_version: The API version to use for this operation. Default value is
35-
"2023-06-01-preview". Note that overriding this default value may result in unsupported
36+
"2023-10-01-preview". Note that overriding this default value may result in unsupported
3637
behavior.
3738
:paramtype api_version: str
3839
"""
@@ -45,7 +46,11 @@ def __init__(
4546
) -> None:
4647
_endpoint = '{endpoint}'
4748
self._config = EventGridClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)
48-
self._client: PipelineClient = PipelineClient(base_url=_endpoint, config=self._config, **kwargs)
49+
_policies = kwargs.pop('policies', None)
50+
if _policies is None:
51+
_policies = [policies.RequestIdPolicy(**kwargs),self._config.headers_policy,self._config.user_agent_policy,self._config.proxy_policy,policies.ContentDecodePolicy(**kwargs),self._config.redirect_policy,self._config.retry_policy,self._config.authentication_policy,self._config.custom_hook_policy,self._config.logging_policy,policies.DistributedTracingPolicy(**kwargs),policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,self._config.http_logging_policy]
52+
self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
53+
4954

5055
self._serialize = Serializer()
5156
self._deserialize = Deserializer()
@@ -54,7 +59,7 @@ def __init__(
5459

5560
def send_request(
5661
self,
57-
request: HttpRequest,
62+
request: HttpRequest, *, stream: bool = False,
5863
**kwargs: Any
5964
) -> HttpResponse:
6065
"""Runs the network request through the client's chained policies.
@@ -80,7 +85,7 @@ def send_request(
8085
}
8186

8287
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
83-
return self._client.send_request(request_copy, **kwargs)
88+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
8489

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

sdk/eventgrid/azure-eventgrid/azure/eventgrid/_configuration.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
from typing import Any, TYPE_CHECKING, Union
1010

11-
from azure.core.configuration import Configuration
1211
from azure.core.credentials import AzureKeyCredential
1312
from azure.core.pipeline import policies
1413

@@ -19,9 +18,7 @@
1918
from azure.core.credentials import TokenCredential
2019

2120

22-
class EventGridClientConfiguration( # pylint: disable=too-many-instance-attributes,name-too-long
23-
Configuration
24-
):
21+
class EventGridClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
2522
"""Configuration for EventGridClient.
2623
2724
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +32,7 @@ class EventGridClientConfiguration( # pylint: disable=too-many-instance-attri
3532
:type credential: ~azure.core.credentials.AzureKeyCredential or
3633
~azure.core.credentials.TokenCredential
3734
:keyword api_version: The API version to use for this operation. Default value is
38-
"2023-06-01-preview". Note that overriding this default value may result in unsupported
35+
"2023-10-01-preview". Note that overriding this default value may result in unsupported
3936
behavior.
4037
:paramtype api_version: str
4138
"""
@@ -46,8 +43,7 @@ def __init__(
4643
credential: Union[AzureKeyCredential, "TokenCredential"],
4744
**kwargs: Any
4845
) -> None:
49-
super(EventGridClientConfiguration, self).__init__(**kwargs)
50-
api_version: str = kwargs.pop('api_version', "2023-06-01-preview")
46+
api_version: str = kwargs.pop('api_version', "2023-10-01-preview")
5147

5248
if endpoint is None:
5349
raise ValueError("Parameter 'endpoint' must not be None.")
@@ -59,6 +55,7 @@ def __init__(
5955
self.api_version = api_version
6056
self.credential_scopes = kwargs.pop('credential_scopes', ['https://eventgrid.azure.net/.default'])
6157
kwargs.setdefault('sdk_moniker', 'eventgrid/{}'.format(VERSION))
58+
self.polling_interval = kwargs.get("polling_interval", 30)
6259
self._configure(**kwargs)
6360

6461
def _infer_policy(self, **kwargs):
@@ -77,9 +74,9 @@ def _configure(
7774
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
7875
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
7976
self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
80-
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
8177
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
8278
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
79+
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
8380
self.authentication_policy = kwargs.get('authentication_policy')
8481
if self.credential and not self.authentication_policy:
8582
self.authentication_policy = self._infer_policy(**kwargs)

sdk/eventgrid/azure-eventgrid/azure/eventgrid/_model_base.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
_LOGGER = logging.getLogger(__name__)
3333

34-
__all__ = ["AzureJSONEncoder", "Model", "rest_field", "rest_discriminator"]
34+
__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"]
3535

3636
TZ_UTC = timezone.utc
3737

@@ -125,7 +125,7 @@ def _is_readonly(p):
125125
return False
126126

127127

128-
class AzureJSONEncoder(JSONEncoder):
128+
class SdkJSONEncoder(JSONEncoder):
129129
"""A JSON encoder that's capable of serializing datetime objects and bytes."""
130130

131131
def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs):
@@ -140,7 +140,7 @@ def default(self, o): # pylint: disable=too-many-return-statements
140140
return {k: v for k, v in o.items() if k not in readonly_props}
141141
return dict(o.items())
142142
try:
143-
return super(AzureJSONEncoder, self).default(o)
143+
return super(SdkJSONEncoder, self).default(o)
144144
except TypeError:
145145
if isinstance(o, _Null):
146146
return None
@@ -157,7 +157,7 @@ def default(self, o): # pylint: disable=too-many-return-statements
157157
except AttributeError:
158158
# This will be raised when it hits value.total_seconds in the method above
159159
pass
160-
return super(AzureJSONEncoder, self).default(o)
160+
return super(SdkJSONEncoder, self).default(o)
161161

162162

163163
_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?")
@@ -553,7 +553,7 @@ def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.
553553
if exclude_readonly:
554554
readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)]
555555
for k, v in self.items():
556-
if exclude_readonly and k in readonly_props: # pyright: reportUnboundVariable=false
556+
if exclude_readonly and k in readonly_props: # pyright: ignore[reportUnboundVariable]
557557
continue
558558
result[k] = Model._as_dict_value(v, exclude_readonly=exclude_readonly)
559559
return result
@@ -754,9 +754,12 @@ def _deserialize(
754754
value: typing.Any,
755755
module: typing.Optional[str] = None,
756756
rf: typing.Optional["_RestField"] = None,
757+
format: typing.Optional[str] = None,
757758
) -> typing.Any:
758759
if isinstance(value, PipelineResponse):
759760
value = value.http_response.json()
761+
if rf is None and format:
762+
rf = _RestField(format=format)
760763
deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf)
761764
return _deserialize_with_callable(deserializer, value)
762765

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from ._patch import EventGridClientOperationsMixin
9+
from ._operations import EventGridClientOperationsMixin
1010

1111
from ._patch import __all__ as _patch_all
1212
from ._patch import * # pylint: disable=unused-wildcard-import

0 commit comments

Comments
 (0)