Skip to content

Commit

Permalink
[EG] Regenerate Code (#17053)
Browse files Browse the repository at this point in the history
* Regenerate Code

* test

* changelog
  • Loading branch information
Rakshith Bhyravabhotla authored Mar 3, 2021
1 parent 8c726ac commit 760a273
Show file tree
Hide file tree
Showing 13 changed files with 2,077 additions and 534 deletions.
5 changes: 5 additions & 0 deletions sdk/eventgrid/azure-eventgrid/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## 2.0.0b6 (Unreleased)

**Breaking Changes**
- All the `SystemEventNames` related to Azure Communication Service starting with `ACS****` are renamed to `Acs***` to honor pascal case.

**Features**
- Added support for two new `SystemEvents` - `ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventData` and `ServiceBusActiveMessagesAvailablePeriodicNotificationsEventData`

## 2.0.0b5 (2021-02-10)

Expand Down
26 changes: 16 additions & 10 deletions sdk/eventgrid/azure-eventgrid/azure/eventgrid/_event_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,28 @@ class SystemEventNames(str, Enum):
visit https://docs.microsoft.com/azure/event-grid/system-topics.
"""

ACSChatMemberAddedToThreadWithUserEventName = (
AcsChatMemberAddedToThreadWithUserEventName = (
"Microsoft.Communication.ChatMemberAddedToThreadWithUser"
)
ACSChatMemberRemovedFromThreadWithUserEventName = (
AcsChatMemberRemovedFromThreadWithUserEventName = (
"Microsoft.Communication.ChatMemberRemovedFromThreadWithUser"
)
ACSChatMessageDeletedEventName = "Microsoft.Communication.ChatMessageDeleted"
ACSChatMessageEditedEventName = "Microsoft.Communication.ChatMessageEdited"
ACSChatMessageReceivedEventName = "Microsoft.Communication.ChatMessageReceived"
ACSChatThreadCreatedWithUserEventName = (
AcsChatMessageDeletedEventName = "Microsoft.Communication.ChatMessageDeleted"
AcsChatMessageEditedEventName = "Microsoft.Communication.ChatMessageEdited"
AcsChatMessageReceivedEventName = "Microsoft.Communication.ChatMessageReceived"
AcsChatThreadCreatedWithUserEventName = (
"Microsoft.Communication.ChatThreadCreatedWithUser"
)
ACSChatThreadPropertiesUpdatedPerUserEventName = (
AcsChatThreadPropertiesUpdatedPerUserEventName = (
"Microsoft.Communication.ChatThreadPropertiesUpdatedPerUser"
)
ACSChatThreadWithUserDeletedEventName = (
AcsChatThreadWithUserDeletedEventName = (
"Microsoft.Communication.ChatThreadWithUserDeleted"
)
ACSSMSDeliveryReportReceivedEventName = (
AcsSmsDeliveryReportReceivedEventName = (
"Microsoft.Communication.SMSDeliveryReportReceived"
)
ACSSMSReceivedEventName = "Microsoft.Communication.SMSReceived"
AcsSmsReceivedEventName = "Microsoft.Communication.SMSReceived"
AppConfigurationKeyValueDeletedEventName = (
"Microsoft.AppConfiguration.KeyValueDeleted"
)
Expand Down Expand Up @@ -143,6 +143,12 @@ class SystemEventNames(str, Enum):
ServiceBusDeadletterMessagesAvailableWithNoListenerEventName = (
"Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListener"
)
ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventName = (
"Microsoft.ServiceBus.DeadletterMessagesAvailablePeriodicNotifications"
)
ServiceBusActiveMessagesAvailablePeriodicNotificationsEventName = (
"Microsoft.ServiceBus.ActiveMessagesAvailablePeriodicNotifications"
)
StorageBlobCreatedEventName = "Microsoft.Storage.BlobCreated"
StorageBlobDeletedEventName = "Microsoft.Storage.BlobDeleted"
StorageBlobRenamedEventName = "Microsoft.Storage.BlobRenamed"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# pylint: disable=unused-import,ungrouped-imports
from typing import Any

from azure.core.pipeline.transport import HttpRequest, HttpResponse

from ._configuration import EventGridPublisherClientConfiguration
from .operations import EventGridPublisherClientOperationsMixin
from . import models
Expand All @@ -36,9 +38,25 @@ def __init__(

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)


def _send_request(self, http_request, **kwargs):
# type: (HttpRequest, Any) -> HttpResponse
"""Runs the network request through the client's chained policies.
:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.HttpResponse
"""
http_request.url = self._client.format_url(http_request.url)
stream = kwargs.pop("stream", True)
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response

def close(self):
# type: () -> None
self._client.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._event_grid_publisher_client_async import EventGridPublisherClient
from ._event_grid_publisher_client import EventGridPublisherClient
__all__ = ['EventGridPublisherClient']
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from typing import Any

from azure.core import AsyncPipelineClient
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from msrest import Deserializer, Serializer

from ._configuration import EventGridPublisherClientConfiguration
Expand All @@ -31,9 +32,24 @@ def __init__(

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)


async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse:
"""Runs the network request through the client's chained policies.
:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.AsyncHttpResponse
"""
http_request.url = self._client.format_url(http_request.url)
stream = kwargs.pop("stream", True)
pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar
import warnings

from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest

from ... import models
from ... import models as _models

T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
Expand All @@ -22,7 +22,7 @@ class EventGridPublisherClientOperationsMixin:
async def publish_events(
self,
topic_hostname: str,
events: List["models.EventGridEvent"],
events: List["_models.EventGridEvent"],
**kwargs
) -> None:
"""Publishes a batch of events to an Azure Event Grid topic.
Expand All @@ -37,7 +37,9 @@ async def publish_events(
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType[None]
error_map = {404: ResourceNotFoundError, 409: ResourceExistsError}
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2018-01-01"
content_type = kwargs.pop("content_type", "application/json")
Expand Down Expand Up @@ -76,7 +78,7 @@ async def publish_events(
async def publish_cloud_event_events(
self,
topic_hostname: str,
events: List["models.CloudEvent"],
events: List["_models.CloudEvent"],
**kwargs
) -> None:
"""Publishes a batch of events to an Azure Event Grid topic.
Expand All @@ -91,7 +93,9 @@ async def publish_cloud_event_events(
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType[None]
error_map = {404: ResourceNotFoundError, 409: ResourceExistsError}
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2018-01-01"
content_type = kwargs.pop("content_type", "application/cloudevents-batch+json; charset=utf-8")
Expand Down Expand Up @@ -145,7 +149,9 @@ async def publish_custom_event_events(
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType[None]
error_map = {404: ResourceNotFoundError, 409: ResourceExistsError}
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2018-01-01"
content_type = kwargs.pop("content_type", "application/json")
Expand Down
Loading

0 comments on commit 760a273

Please sign in to comment.