azure.eventgrid package

class azure.eventgrid.EventGridEvent(subject: str, event_type: str, data: object, data_version: str, **kwargs: Any)[source]

Properties of an event published to an Event Grid topic using the EventGrid Schema.

Variables are only populated by the server, and will be ignored when sending a request.

All required parameters must be populated in order to send to Azure.

Parameters:
  • subject (str) – Required. A resource path relative to the topic path.

  • event_type (str) – Required. The type of the event that occurred.

  • data (object) – Required. Event data specific to the event type.

  • data_version (str) – Required. The schema version of the data object. If not provided, will be stamped with an empty value.

Keyword Arguments:
  • topic (str) – The resource path of the event source. If not provided, Event Grid will stamp onto the event. This is required when sending event(s) to a domain.

  • metadata_version (Optional[str]) – The schema version of the event metadata. If provided, must match Event Grid Schema exactly. If not provided, EventGrid will stamp onto event.

  • id (str) – An identifier for the event. In not provided, a random UUID will be generated and used.

  • event_time (datetime) – The time (in UTC) of the event. If not provided, it will be the time (in UTC) the event was generated.

  • id – An unique identifier for the event. Required.

  • topic – The resource path of the event source.

  • subject (str) – A resource path relative to the topic path. Required.

  • data (JSON) – Event data specific to the event type. Required.

  • event_type (str) – The type of the event that occurred. Required.

  • event_time – The time (in UTC) the event was generated. Required.

  • data_version (str) – The schema version of the data object. Required.

Variables:
  • subject (str) – A resource path relative to the topic path.

  • event_type (str) – The type of the event that occurred.

  • data (object) – Event data specific to the event type.

  • data_version (str) – The schema version of the data object. If not provided, will be stamped with an empty value.

  • topic (str) – The resource path of the event source. If not provided, Event Grid will stamp onto the event.

  • metadata_version (str) – The schema version of the event metadata. If provided, must match Event Grid Schema exactly. If not provided, EventGrid will stamp onto event.

  • id (str) – An identifier for the event. In not provided, a random UUID will be generated and used.

  • event_time (datetime) – The time (in UTC) of the event. If not provided, it will be the time (in UTC) the event was generated.

as_dict(keep_readonly: bool = True, key_transformer: ~typing.Callable[[str, ~typing.Dict[str, ~typing.Any], ~typing.Any], ~typing.Any] = <function attribute_transformer>, **kwargs: ~typing.Any) MutableMapping[str, Any]

Return a dict that can be serialized using json.dump.

Advanced usage might optionally use a callback as parameter:

Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.

The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.

See the three examples in this file:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters:

key_transformer (function) – A key transformer function.

Returns:

A dict JSON compatible object

Return type:

dict

classmethod deserialize(data: Any, content_type: str | None = None) ModelType

Parse a str using the RestAPI syntax and return a model.

Parameters:
  • data (str) – A str using RestAPI structure. JSON by default.

  • content_type (str) – JSON by default, set application/xml if XML.

Returns:

An instance of this model

Raises:

DeserializationError if something went wrong

classmethod enable_additional_properties_sending() None
classmethod from_dict(data: Any, key_extractors: Callable[[str, Dict[str, Any], Any], Any] | None = None, content_type: str | None = None) ModelType

Parse a dict using given key extractor return a model.

By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)

Parameters:
  • data (dict) – A dict using RestAPI structure

  • content_type (str) – JSON by default, set application/xml if XML.

Returns:

An instance of this model

Raises:

DeserializationError if something went wrong

classmethod from_json(event: Any) EventGridEvent[source]

Returns the deserialized EventGridEvent object when a json payload is provided. :param event: The json string that should be converted into a EventGridEvent. This can also be a storage QueueMessage, eventhub’s EventData or ServiceBusMessage :type event: object :rtype: EventGridEvent :return: An EventGridEvent object. :raises ValueError: If the provided JSON is invalid.

classmethod is_xml_model() bool
serialize(keep_readonly: bool = False, **kwargs: Any) MutableMapping[str, Any]

Return the JSON that would be sent to azure from this model.

This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters:

keep_readonly (bool) – If you want to serialize the readonly attributes

Returns:

A dict JSON compatible object

Return type:

dict

class azure.eventgrid.EventGridPublisherClient(endpoint: str, credential: AzureKeyCredential | AzureSasCredential | TokenCredential, *, api_version: str | None = None, **kwargs: Any)[source]

EventGridPublisherClient publishes events to an EventGrid topic or domain. It can be used to publish either an EventGridEvent, a CloudEvent or a Custom Schema.

Parameters:
  • endpoint (str) – The topic endpoint to send the events to.

  • credential (AzureKeyCredential or AzureSasCredential or TokenCredential) – The credential object used for authentication which implements SAS key authentication or SAS token authentication or a TokenCredential.

Keyword Arguments:

api_version (str) – Api Version. Will default to the most recent Api Version. Note that overriding this default value may result in unsupported behavior.

Return type:

None

Example:

Creating the EventGridPublisherClient with an endpoint and AzureKeyCredential.
import os
from azure.eventgrid import EventGridPublisherClient
from azure.core.credentials import AzureKeyCredential

topic_key = os.environ["EVENTGRID_TOPIC_KEY"]
endpoint = os.environ["EVENTGRID_TOPIC_ENDPOINT"]

credential_key = AzureKeyCredential(topic_key)
client = EventGridPublisherClient(endpoint, credential_key)
Creating the EventGridPublisherClient with an endpoint and AzureSasCredential.
import os
from azure.eventgrid import EventGridPublisherClient
from azure.core.credentials import AzureSasCredential

signature = os.environ["EVENTGRID_SAS"]
endpoint = os.environ["EVENTGRID_TOPIC_ENDPOINT"]

credential_sas = AzureSasCredential(signature)
client = EventGridPublisherClient(endpoint, credential_sas)
close() None[source]

Close the EventGridPublisherClient session.

send(events: CloudEvent | EventGridEvent | Dict | CNCFCloudEvent | List[CloudEvent] | List[EventGridEvent] | List[Dict] | List[CNCFCloudEvent], *, channel_name: str | None = None, **kwargs: Any) None[source]

Sends events to a topic or a domain specified during the client initialization.

A single instance or a list of dictionaries, CloudEvents or EventGridEvents are accepted.

Example:

Publishing an EventGridEvent.
import os
from azure.eventgrid import EventGridPublisherClient, EventGridEvent
from azure.core.credentials import AzureKeyCredential

topic_key = os.environ["EVENTGRID_TOPIC_KEY"]
endpoint = os.environ["EVENTGRID_TOPIC_ENDPOINT"]

credential = AzureKeyCredential(topic_key)
client = EventGridPublisherClient(endpoint, credential)

client.send([
	EventGridEvent(
		event_type="Contoso.Items.ItemReceived",
		data={
			"itemSku": "Contoso Item SKU #1"
		},
		subject="Door1",
		data_version="2.0"
	)
])
Publishing a CloudEvent.
import os
from azure.eventgrid import EventGridPublisherClient
from azure.core.credentials import AzureKeyCredential
from azure.core.messaging import CloudEvent

topic_key = os.environ["EVENTGRID_CLOUD_EVENT_TOPIC_KEY"]
endpoint = os.environ["EVENTGRID_CLOUD_EVENT_TOPIC_ENDPOINT"]

credential = AzureKeyCredential(topic_key)
client = EventGridPublisherClient(endpoint, credential)

client.send([
    CloudEvent(
        type="Contoso.Items.ItemReceived",
        source="/contoso/items",
        data={
            "itemSku": "Contoso Item SKU #1"
        },
        subject="Door1"
    )
])

Dict representation of respective serialized models is accepted as CloudEvent(s) or EventGridEvent(s) apart from the strongly typed objects.

Example:

Publishing a list of EventGridEvents using a dict-like representation.
credential = AzureKeyCredential(topic_key)
client = EventGridPublisherClient(endpoint, credential)

event0 = {	
    "eventType": "Contoso.Items.ItemReceived",	
    "data": {	
        "itemSku": "Contoso Item SKU #1"	
    },	
    "subject": "Door1",	
    "dataVersion": "2.0",	
    "id": "randomuuid11",	
    "eventTime": datetime.now(UTC())
}	
event1 = {	
    "eventType": "Contoso.Items.ItemReceived",	
    "data": {	
        "itemSku": "Contoso Item SKU #2"	
    },	
    "subject": "Door1",	
    "dataVersion": "2.0",	
    "id": "randomuuid12",	
    "eventTime": datetime.now(UTC())
}	
client.send([event0, event1])
Publishing a CloudEvent using a dict-like representation.
client.send([
    {
        "type": "Contoso.Items.ItemReceived",
        "source": "/contoso/items",	
        "data": {	
            "itemSku": "Contoso Item SKU #1"	
        },	
        "subject": "Door1",	
        "specversion": "1.0",	
        "id": "randomclouduuid11"
    }
])

When publishing a Custom Schema Event(s), dict-like representation is accepted. Either a single dictionary or a list of dictionaries can be passed.

Example:

Publishing a Custom Schema event.
custom_schema_event = {
    "customSubject": "sample",
    "customEventType": "sample.event",
    "customDataVersion": "2.0",
    "customId": uuid.uuid4(),
    "customEventTime": dt.datetime.now(UTC()).isoformat(),
    "customData": "sample data"
}

client.send(custom_schema_event)

WARNING: When sending a list of multiple events at one time, iterating over and sending each event will not result in optimal performance. For best performance, it is highly recommended to send a list of events.

Parameters:

events (CloudEvent or EventGridEvent or dict or List[CloudEvent] or List[EventGridEvent] or List[dict]) – A single instance or a list of dictionaries/CloudEvent/EventGridEvent to be sent.

Keyword Arguments:
  • content_type (str) – The type of content to be used to send the events. Has default value “application/json; charset=utf-8” for EventGridEvents, with “cloudevents-batch+json” for CloudEvents

  • channel_name (str or None namespaces with partner topic. For more details, visit https://docs.microsoft.com/azure/event-grid/partner-events-overview) – Optional. Used to specify the name of event channel when publishing to partner.

Return type:

None

class azure.eventgrid.SystemEventNames(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

This enum represents the names of the various event types for the system events published to Azure Event Grid. To check the list of recognizable system topics, visit https://docs.microsoft.com/azure/event-grid/system-topics.

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if the string is printable, False otherwise.

A string is printable if all of its characters are considered printable in repr() or if it is empty.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

AcsAdvancedMessageDeliveryStatusUpdatedEventName = 'Microsoft.Communication.AdvancedMessageDeliveryStatusUpdated'
AcsAdvancedMessageReceivedEventName = 'Microsoft.Communication.AdvancedMessageReceived'
AcsChatMemberAddedToThreadWithUserEventName = 'Microsoft.Communication.ChatMemberAddedToThreadWithUser'
AcsChatMemberRemovedFromThreadWithUserEventName = 'Microsoft.Communication.ChatMemberRemovedFromThreadWithUser'
AcsChatMessageDeletedEventName = 'Microsoft.Communication.ChatMessageDeleted'
AcsChatMessageDeletedInThreadEventName = 'Microsoft.Communication.ChatMessageDeletedInThread'
AcsChatMessageEditedEventName = 'Microsoft.Communication.ChatMessageEdited'
AcsChatMessageEditedInThreadEventName = 'Microsoft.Communication.ChatMessageEditedInThread'
AcsChatMessageReceivedEventName = 'Microsoft.Communication.ChatMessageReceived'
AcsChatMessageReceivedInThreadEventName = 'Microsoft.Communication.ChatMessageReceivedInThread'
AcsChatParticipantAddedToThreadEventName = 'Microsoft.Communication.ChatThreadParticipantAdded'
AcsChatParticipantAddedToThreadWithUserEventName = 'Microsoft.Communication.ChatParticipantAddedToThreadWithUser'
AcsChatParticipantRemovedFromThreadEventName = 'Microsoft.Communication.ChatThreadParticipantRemoved'
AcsChatParticipantRemovedFromThreadWithUserEventName = 'Microsoft.Communication.ChatParticipantRemovedFromThreadWithUser'
AcsChatThreadCreatedEventName = 'Microsoft.Communication.ChatThreadCreated'
AcsChatThreadCreatedWithUserEventName = 'Microsoft.Communication.ChatThreadCreatedWithUser'
AcsChatThreadDeletedEventName = 'Microsoft.Communication.ChatThreadDeleted'
AcsChatThreadParticipantAddedEventName = 'Microsoft.Communication.ChatThreadParticipantAdded'
AcsChatThreadParticipantRemovedEventName = 'Microsoft.Communication.ChatThreadParticipantRemoved'
AcsChatThreadPropertiesUpdatedEventName = 'Microsoft.Communication.ChatThreadPropertiesUpdated'
AcsChatThreadPropertiesUpdatedPerUserEventName = 'Microsoft.Communication.ChatThreadPropertiesUpdatedPerUser'
AcsChatThreadWithUserDeletedEventName = 'Microsoft.Communication.ChatThreadWithUserDeleted'
AcsEmailDeliveryReportReceivedEventName = 'Microsoft.Communication.EmailDeliveryReportReceived'
AcsEmailEngagementTrackingReportReceivedEventName = 'Microsoft.Communication.EmailEngagementTrackingReportReceived'
AcsIncomingCallEventName = 'Microsoft.Communication.IncomingCall'
AcsRecordingFileStatusUpdatedEventName = 'Microsoft.Communication.RecordingFileStatusUpdated'
AcsRouterJobCancelledEventName = 'Microsoft.Communication.RouterJobCancelled'
AcsRouterJobClassificationFailedEventName = 'Microsoft.Communication.RouterJobClassificationFailed'
AcsRouterJobClassifiedEventName = 'Microsoft.Communication.RouterJobClassified'
AcsRouterJobClosedEventName = 'Microsoft.Communication.RouterJobClosed'
AcsRouterJobCompletedEventName = 'Microsoft.Communication.RouterJobCompleted'
AcsRouterJobDeletedEventName = 'Microsoft.Communication.RouterJobDeleted'
AcsRouterJobExceptionTriggeredEventName = 'Microsoft.Communication.RouterJobExceptionTriggered'
AcsRouterJobQueuedEventName = 'Microsoft.Communication.RouterJobQueued'
AcsRouterJobReceivedEventName = 'Microsoft.Communication.RouterJobReceived'
AcsRouterJobSchedulingFailedEventName = 'Microsoft.Communication.RouterJobSchedulingFailed'
AcsRouterJobUnassignedEventName = 'Microsoft.Communication.RouterJobUnassigned'
AcsRouterJobWaitingForActivationEventName = 'Microsoft.Communication.RouterJobWaitingForActivation'
AcsRouterJobWorkerSelectorsExpiredEventName = 'Microsoft.Communication.RouterJobWorkerSelectorsExpired'
AcsRouterWorkerDeletedEventName = 'Microsoft.Communication.RouterWorkerDeleted'
AcsRouterWorkerDeregisteredEventName = 'Microsoft.Communication.RouterWorkerDeregistered'
AcsRouterWorkerOfferAcceptedEventName = 'Microsoft.Communication.RouterWorkerOfferAccepted'
AcsRouterWorkerOfferDeclinedEventName = 'Microsoft.Communication.RouterWorkerOfferDeclined'
AcsRouterWorkerOfferExpiredEventName = 'Microsoft.Communication.RouterWorkerOfferExpired'
AcsRouterWorkerOfferIssuedEventName = 'Microsoft.Communication.RouterWorkerOfferIssued'
AcsRouterWorkerOfferRevokedEventName = 'Microsoft.Communication.RouterWorkerOfferRevoked'
AcsRouterWorkerRegisteredEventName = 'Microsoft.Communication.RouterWorkerRegistered'
AcsRouterWorkerUpdatedEventName = 'Microsoft.Communication.RouterWorkerUpdated'
AcsSmsDeliveryReportReceivedEventName = 'Microsoft.Communication.SMSDeliveryReportReceived'
AcsSmsReceivedEventName = 'Microsoft.Communication.SMSReceived'
AcsUserDisconnectedEventName = 'Microsoft.Communication.UserDisconnected'
ApiCenterApiDefinitionAddedEventName = 'Microsoft.ApiCenter.ApiDefinitionAdded'
ApiCenterApiDefinitionUpdatedEventName = 'Microsoft.ApiCenter.ApiDefinitionUpdated'
ApiManagementApiCreatedEventName = 'Microsoft.ApiManagement.APICreated'
ApiManagementApiDeletedEventName = 'Microsoft.ApiManagement.APIDeleted'
ApiManagementApiReleaseCreatedEventName = 'Microsoft.ApiManagement.APIReleaseCreated'
ApiManagementApiReleaseDeletedEventName = 'Microsoft.ApiManagement.APIReleaseDeleted'
ApiManagementApiReleaseUpdatedEventName = 'Microsoft.ApiManagement.APIReleaseUpdated'
ApiManagementApiUpdatedEventName = 'Microsoft.ApiManagement.APIUpdated'
ApiManagementGatewayApiAddedEventName = 'Microsoft.ApiManagement.GatewayAPIAdded'
ApiManagementGatewayApiRemovedEventName = 'Microsoft.ApiManagement.GatewayAPIRemoved'
ApiManagementGatewayCertificateAuthorityCreatedEventName = 'Microsoft.ApiManagement.GatewayCertificateAuthorityCreated'
ApiManagementGatewayCertificateAuthorityDeletedEventName = 'Microsoft.ApiManagement.GatewayCertificateAuthorityDeleted'
ApiManagementGatewayCertificateAuthorityUpdatedEventName = 'Microsoft.ApiManagement.GatewayCertificateAuthorityUpdated'
ApiManagementGatewayCreatedEventName = 'Microsoft.ApiManagement.GatewayCreated'
ApiManagementGatewayDeletedEventName = 'Microsoft.ApiManagement.GatewayDeleted'
ApiManagementGatewayHostnameConfigurationCreatedEventName = 'Microsoft.ApiManagement.GatewayHostnameConfigurationCreated'
ApiManagementGatewayHostnameConfigurationDeletedEventName = 'Microsoft.ApiManagement.GatewayHostnameConfigurationDeleted'
ApiManagementGatewayHostnameConfigurationUpdatedEventName = 'Microsoft.ApiManagement.GatewayHostnameConfigurationUpdated'
ApiManagementGatewayUpdatedEventName = 'Microsoft.ApiManagement.GatewayUpdated'
ApiManagementProductCreatedEventName = 'Microsoft.ApiManagement.ProductCreated'
ApiManagementProductDeletedEventName = 'Microsoft.ApiManagement.ProductDeleted'
ApiManagementProductUpdatedEventName = 'Microsoft.ApiManagement.ProductUpdated'
ApiManagementSubscriptionCreatedEventName = 'Microsoft.ApiManagement.SubscriptionCreated'
ApiManagementSubscriptionDeletedEventName = 'Microsoft.ApiManagement.SubscriptionDeleted'
ApiManagementSubscriptionUpdatedEventName = 'Microsoft.ApiManagement.SubscriptionUpdated'
ApiManagementUserCreatedEventName = 'Microsoft.ApiManagement.UserCreated'
ApiManagementUserDeletedEventName = 'Microsoft.ApiManagement.UserDeleted'
ApiManagementUserUpdatedEventName = 'Microsoft.ApiManagement.UserUpdated'
AppConfigurationKeyValueDeletedEventName = 'Microsoft.AppConfiguration.KeyValueDeleted'
AppConfigurationKeyValueModifiedEventName = 'Microsoft.AppConfiguration.KeyValueModified'
AppConfigurationSnapshotCreatedEventName = 'Microsoft.AppConfiguration.SnapshotCreated'
AppConfigurationSnapshotModifiedEventName = 'Microsoft.AppConfiguration.SnapshotModified'
AvsClusterCreatedEventName = 'Microsoft.AVS.ClusterCreated'
AvsClusterDeletedEventName = 'Microsoft.AVS.ClusterDeleted'
AvsClusterFailedEventName = 'Microsoft.AVS.ClusterFailed'
AvsClusterUpdatedEventName = 'Microsoft.AVS.ClusterUpdated'
AvsClusterUpdatingEventName = 'Microsoft.AVS.ClusterUpdating'
AvsPrivateCloudFailedEventName = 'Microsoft.AVS.PrivateCloudFailed'
AvsPrivateCloudUpdatedEventName = 'Microsoft.AVS.PrivateCloudUpdated'
AvsPrivateCloudUpdatingEventName = 'Microsoft.AVS.PrivateCloudUpdating'
AvsScriptExecutionCancelledEventName = 'Microsoft.AVS.ScriptExecutionCancelled'
AvsScriptExecutionFailedEventName = 'Microsoft.AVS.ScriptExecutionFailed'
AvsScriptExecutionFinishedEventName = 'Microsoft.AVS.ScriptExecutionFinished'
AvsScriptExecutionStartedEventName = 'Microsoft.AVS.ScriptExecutionStarted'
ContainerRegistryArtifactEventName = 'Microsoft.AppConfiguration.KeyValueModified'
ContainerRegistryChartDeletedEventName = 'Microsoft.ContainerRegistry.ChartDeleted'
ContainerRegistryChartPushedEventName = 'Microsoft.ContainerRegistry.ChartPushed'
ContainerRegistryEventName = 'Microsoft.ContainerRegistry.ChartPushed'
ContainerRegistryImageDeletedEventName = 'Microsoft.ContainerRegistry.ImageDeleted'
ContainerRegistryImagePushedEventName = 'Microsoft.ContainerRegistry.ImagePushed'
ContainerServiceClusterSupportEndedEventName = 'Microsoft.ContainerService.ClusterSupportEnded'
ContainerServiceClusterSupportEndingEventName = 'Microsoft.ContainerService.ClusterSupportEnding'
ContainerServiceNewKubernetesVersionAvailableEventName = 'Microsoft.ContainerService.NewKubernetesVersionAvailable'
ContainerServiceNodePoolRollingFailedEventName = 'Microsoft.ContainerService.NodePoolRollingFailed'
ContainerServiceNodePoolRollingStartedEventName = 'Microsoft.ContainerService.NodePoolRollingStarted'
ContainerServiceNodePoolRollingSucceededEventName = 'Microsoft.ContainerService.NodePoolRollingSucceeded'
DataBoxCopyCompletedEventName = 'Microsoft.DataBox.CopyCompleted'
DataBoxCopyStartedEventName = 'Microsoft.DataBox.CopyStarted'
DataBoxOrderCompletedEventName = 'Microsoft.DataBox.OrderCompleted'
EventGridMQTTClientCreatedOrUpdatedEventName = 'Microsoft.EventGrid.MQTTClientCreatedOrUpdated'
EventGridMQTTClientDeletedEventName = 'Microsoft.EventGrid.MQTTClientDeleted'
EventGridMQTTClientSessionConnectedEventName = 'Microsoft.EventGrid.MQTTClientSessionConnected'
EventGridMQTTClientSessionDisconnectedEventName = 'Microsoft.EventGrid.MQTTClientSessionDisconnected'
EventGridSubscriptionDeletedEventName = 'Microsoft.EventGrid.SubscriptionDeletedEvent'
EventGridSubscriptionValidationEventName = 'Microsoft.EventGrid.SubscriptionValidationEvent'
EventHubCaptureFileCreatedEventName = 'Microsoft.EventHub.CaptureFileCreated'
HealthcareDicomImageCreatedEventName = 'Microsoft.HealthcareApis.DicomImageCreated'
HealthcareDicomImageDeletedEventName = 'Microsoft.HealthcareApis.DicomImageDeleted'
HealthcareDicomImageUpdatedEventName = 'Microsoft.HealthcareApis.DicomImageUpdated'
HealthcareFhirResourceCreatedEventName = 'Microsoft.HealthcareApis.FhirResourceCreated'
HealthcareFhirResourceDeletedEventName = 'Microsoft.HealthcareApis.FhirResourceDeleted'
HealthcareFhirResourceUpdatedEventName = 'Microsoft.HealthcareApis.FhirResourceUpdated'
IoTHubDeviceConnectedEventName = 'Microsoft.Devices.DeviceConnected'
IoTHubDeviceCreatedEventName = 'Microsoft.Devices.DeviceCreated'
IoTHubDeviceDeletedEventName = 'Microsoft.Devices.DeviceDeleted'
IoTHubDeviceDisconnectedEventName = 'Microsoft.Devices.DeviceDisconnected'
IotHubDeviceConnectedEventName = 'Microsoft.Devices.DeviceConnected'
IotHubDeviceCreatedEventName = 'Microsoft.Devices.DeviceCreated'
IotHubDeviceDeletedEventName = 'Microsoft.Devices.DeviceDeleted'
IotHubDeviceDisconnectedEventName = 'Microsoft.Devices.DeviceDisconnected'
IotHubDeviceTelemetryEventName = 'Microsoft.Devices.DeviceTelemetry'
KeyVaultAccessPolicyChangedEventName = 'Microsoft.KeyVault.VaultAccessPolicyChanged'
KeyVaultCertificateExpiredEventName = 'Microsoft.KeyVault.CertificateExpired'
KeyVaultCertificateNearExpiryEventName = 'Microsoft.KeyVault.CertificateNearExpiry'
KeyVaultCertificateNewVersionCreatedEventName = 'Microsoft.KeyVault.CertificateNewVersionCreated'
KeyVaultKeyExpiredEventName = 'Microsoft.KeyVault.KeyExpired'
KeyVaultKeyNearExpiryEventName = 'Microsoft.KeyVault.KeyNearExpiry'
KeyVaultKeyNewVersionCreatedEventName = 'Microsoft.KeyVault.KeyNewVersionCreated'
KeyVaultSecretExpiredEventName = 'Microsoft.KeyVault.SecretExpired'
KeyVaultSecretNearExpiryEventName = 'Microsoft.KeyVault.SecretNearExpiry'
KeyVaultSecretNewVersionCreatedEventName = 'Microsoft.KeyVault.SecretNewVersionCreated'
KeyVaultVaultAccessPolicyChangedEventName = 'Microsoft.KeyVault.VaultAccessPolicyChanged'
MachineLearningServicesDatasetDriftDetectedEventName = 'Microsoft.MachineLearningServices.DatasetDriftDetected'
MachineLearningServicesModelDeployedEventName = 'Microsoft.MachineLearningServices.ModelDeployed'
MachineLearningServicesModelRegisteredEventName = 'Microsoft.MachineLearningServices.ModelRegistered'
MachineLearningServicesRunCompletedEventName = 'Microsoft.MachineLearningServices.RunCompleted'
MachineLearningServicesRunStatusChangedEventName = 'Microsoft.MachineLearningServices.RunStatusChanged'
MapsGeofenceEnteredEventName = 'Microsoft.Maps.GeofenceEntered'
MapsGeofenceExitedEventName = 'Microsoft.Maps.GeofenceExited'
MapsGeofenceResultEventName = 'Microsoft.Maps.GeofenceResult'
MediaJobCanceledEventName = 'Microsoft.Media.JobCanceled'
MediaJobCancelingEventName = 'Microsoft.Media.JobCanceling'
MediaJobErroredEventName = 'Microsoft.Media.JobErrored'
MediaJobFinishedEventName = 'Microsoft.Media.JobFinished'
MediaJobOutputCanceledEventName = 'Microsoft.Media.JobOutputCanceled'
MediaJobOutputCancelingEventName = 'Microsoft.Media.JobOutputCanceling'
MediaJobOutputErroredEventName = 'Microsoft.Media.JobOutputErrored'
MediaJobOutputFinishedEventName = 'Microsoft.Media.JobOutputFinished'
MediaJobOutputProcessingEventName = 'Microsoft.Media.JobOutputProcessing'
MediaJobOutputProgressEventName = 'Microsoft.Media.JobOutputProgress'
MediaJobOutputScheduledEventName = 'Microsoft.Media.JobOutputScheduled'
MediaJobOutputStateChangeEventName = 'Microsoft.Media.JobOutputStateChange'
MediaJobProcessingEventName = 'Microsoft.Media.JobProcessing'
MediaJobScheduledEventName = 'Microsoft.Media.JobScheduled'
MediaJobStateChangeEventName = 'Microsoft.Media.JobStateChange'
MediaLiveEventChannelArchiveHeartbeatEventName = 'Microsoft.Media.LiveEventChannelArchiveHeartbeat'
MediaLiveEventConnectionRejectedEventName = 'Microsoft.Media.LiveEventConnectionRejected'
MediaLiveEventEncoderConnectedEventName = 'Microsoft.Media.LiveEventEncoderConnected'
MediaLiveEventEncoderDisconnectedEventName = 'Microsoft.Media.LiveEventEncoderDisconnected'
MediaLiveEventIncomingDataChunkDroppedEventName = 'Microsoft.Media.LiveEventIncomingDataChunkDropped'
MediaLiveEventIncomingStreamReceivedEventName = 'Microsoft.Media.LiveEventIncomingStreamReceived'
MediaLiveEventIncomingStreamsOutOfSyncEventName = 'Microsoft.Media.LiveEventIncomingStreamsOutOfSync'
MediaLiveEventIncomingVideoStreamsOutOfSyncEventName = 'Microsoft.Media.LiveEventIncomingVideoStreamsOutOfSync'
MediaLiveEventIngestHeartbeatEventName = 'Microsoft.Media.LiveEventIngestHeartbeat'
MediaLiveEventTrackDiscontinuityDetectedEventName = 'Microsoft.Media.LiveEventTrackDiscontinuityDetected'
PolicyInsightsPolicyStateChangedEventName = 'Microsoft.PolicyInsights.PolicyStateChanged'
PolicyInsightsPolicyStateCreatedEventName = 'Microsoft.PolicyInsights.PolicyStateCreated'
PolicyInsightsPolicyStateDeletedEventName = 'Microsoft.PolicyInsights.PolicyStateDeleted'
RedisExportRDBCompletedEventName = 'Microsoft.Cache.ExportRDBCompleted'
RedisImportRDBCompletedEventName = 'Microsoft.Cache.ImportRDBCompleted'
RedisPatchingCompletedEventName = 'Microsoft.Cache.PatchingCompleted'
RedisScalingCompletedEventName = 'Microsoft.Cache.ScalingCompleted'
ResourceActionCancelEventName = 'Microsoft.Resources.ResourceActionCancel'
ResourceActionCancelName = 'Microsoft.Resources.ResourceActionCancel'
ResourceActionFailureEventName = 'Microsoft.Resources.ResourceActionFailure'
ResourceActionFailureName = 'Microsoft.Resources.ResourceActionFailure'
ResourceActionSuccessEventName = 'Microsoft.Resources.ResourceActionSuccess'
ResourceActionSuccessName = 'Microsoft.Resources.ResourceActionSuccess'
ResourceDeleteCancelEventName = 'Microsoft.Resources.ResourceDeleteCancel'
ResourceDeleteCancelName = 'Microsoft.Resources.ResourceDeleteCancel'
ResourceDeleteFailureEventName = 'Microsoft.Resources.ResourceDeleteFailure'
ResourceDeleteFailureName = 'Microsoft.Resources.ResourceDeleteFailure'
ResourceDeleteSuccessEventName = 'Microsoft.Resources.ResourceDeleteSuccess'
ResourceDeleteSuccessName = 'Microsoft.Resources.ResourceDeleteSuccess'
ResourceNotificationsHealthResourcesAnnotatedEventName = 'Microsoft.ResourceNotifications.HealthResources.ResourceAnnotated'
ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventName = 'Microsoft.ResourceNotifications.HealthResources.AvailabilityStatusChanged'
ResourceNotificationsResourceManagementCreatedOrUpdatedEventName = 'Microsoft.ResourceNotifications.Resources.CreatedOrUpdated'
ResourceNotificationsResourceManagementDeletedEventName = 'Microsoft.ResourceNotifications.Resources.Deleted'
ResourceWriteCancelEventName = 'Microsoft.Resources.ResourceWriteCancel'
ResourceWriteCancelName = 'Microsoft.Resources.ResourceWriteCancel'
ResourceWriteFailureEventName = 'Microsoft.Resources.ResourceWriteFailure'
ResourceWriteFailureName = 'Microsoft.Resources.ResourceWriteFailure'
ResourceWriteSuccessEventName = 'Microsoft.Resources.ResourceWriteSuccess'
ResourceWriteSuccessName = 'Microsoft.Resources.ResourceWriteSuccess'
ServiceBusActiveMessagesAvailablePeriodicNotificationsEventName = 'Microsoft.ServiceBus.ActiveMessagesAvailablePeriodicNotifications'
ServiceBusActiveMessagesAvailableWithNoListenersEventName = 'Microsoft.ServiceBus.ActiveMessagesAvailableWithNoListeners'
ServiceBusDeadletterMessagesAvailablePeriodicNotificationsEventName = 'Microsoft.ServiceBus.DeadletterMessagesAvailablePeriodicNotifications'
ServiceBusDeadletterMessagesAvailableWithNoListenerEventName = 'Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListeners'
ServiceBusDeadletterMessagesAvailableWithNoListenersEventName = 'Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListeners'
SignalRServiceClientConnectionConnectedEventName = 'Microsoft.SignalRService.ClientConnectionConnected'
SignalRServiceClientConnectionDisconnectedEventName = 'Microsoft.SignalRService.ClientConnectionDisconnected'
StorageAsyncOperationInitiatedEventName = 'Microsoft.Storage.AsyncOperationInitiated'
StorageBlobCreatedEventName = 'Microsoft.Storage.BlobCreated'
StorageBlobDeletedEventName = 'Microsoft.Storage.BlobDeleted'
StorageBlobInventoryPolicyCompletedEventName = 'Microsoft.Storage.BlobInventoryPolicyCompleted'
StorageBlobRenamedEventName = 'Microsoft.Storage.BlobRenamed'
StorageBlobTierChangedEventName = 'Microsoft.Storage.BlobTierChanged'
StorageDirectoryCreatedEventName = 'Microsoft.Storage.DirectoryCreated'
StorageDirectoryDeletedEventName = 'Microsoft.Storage.DirectoryDeleted'
StorageDirectoryRenamedEventName = 'Microsoft.Storage.DirectoryRenamed'
StorageLifecyclePolicyCompletedEventName = 'Microsoft.Storage.LifecyclePolicyCompleted'
StorageTaskAssignmentCompletedEventName = 'Microsoft.Storage.StorageTaskAssignmentCompleted'
StorageTaskAssignmentQueuedEventName = 'Microsoft.Storage.StorageTaskAssignmentQueued'
StorageTaskCompletedEventName = 'Microsoft.Storage.StorageTaskCompleted'
StorageTaskQueuedEventName = 'Microsoft.Storage.StorageTaskQueued'
SubscriptionDeletedEventName = 'Microsoft.EventGrid.SubscriptionDeletedEvent'
SubscriptionValidationEventName = 'Microsoft.EventGrid.SubscriptionValidationEvent'
WebAppServicePlanUpdatedEventName = 'Microsoft.Web.AppServicePlanUpdated'
WebAppUpdatedEventName = 'Microsoft.Web.AppUpdated'
WebBackupOperationCompletedEventName = 'Microsoft.Web.BackupOperationCompleted'
WebBackupOperationFailedEventName = 'Microsoft.Web.BackupOperationFailed'
WebBackupOperationStartedEventName = 'Microsoft.Web.BackupOperationStarted'
WebRestoreOperationCompletedEventName = 'Microsoft.Web.RestoreOperationCompleted'
WebRestoreOperationFailedEventName = 'Microsoft.Web.RestoreOperationFailed'
WebRestoreOperationStartedEventName = 'Microsoft.Web.RestoreOperationStarted'
WebSlotSwapCompletedEventName = 'Microsoft.Web.SlotSwapCompleted'
WebSlotSwapFailedEventName = 'Microsoft.Web.SlotSwapFailed'
WebSlotSwapStartedEventName = 'Microsoft.Web.SlotSwapStarted'
WebSlotSwapWithPreviewCancelledEventName = 'Microsoft.Web.SlotSwapWithPreviewCancelled'
WebSlotSwapWithPreviewStartedEventName = 'Microsoft.Web.SlotSwapWithPreviewStarted'
azure.eventgrid.generate_sas(endpoint: str, shared_access_key: str, expiration_date_utc: datetime, *, api_version: str = '2018-01-01') str[source]

Helper method to generate shared access signature given hostname, key, and expiration date. :param str endpoint: The topic endpoint to send the events to. Similar to <YOUR-TOPIC-NAME>.<YOUR-REGION-NAME>-1.eventgrid.azure.net :param str shared_access_key: The shared access key to be used for generating the token :param datetime.datetime expiration_date_utc: The expiration datetime in UTC for the signature. :keyword str api_version: The API Version to include in the signature. If not provided, the default API version will be used. :return: A shared access signature string. :rtype: str

Example:

Generate a shared access signature.
import os
from azure.eventgrid import generate_sas
from datetime import datetime, timedelta

topic_key = os.environ["EVENTGRID_TOPIC_KEY"]
endpoint = os.environ["EVENTGRID_TOPIC_ENDPOINT"]

#represents the expiration date for sas
expiration_date_utc = datetime.utcnow() + timedelta(hours=10)

signature = generate_sas(endpoint, topic_key, expiration_date_utc)

Subpackages