operator
operator
__all__ = ['GoogleEmailSendOperator']
module-attribute
GoogleEmailSendOperator
Bases: GoogleBaseEventOperator
Operator for sending emails using Google Email Hook.
__init__() -> None
Initializes the GoogleEmailSendOperator.
build_error_message(message: str, data: dict) -> dict
Builds an error message specific to event operations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message
|
str
|
The error message. |
required |
data
|
dict
|
The associated data. |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
A constructed error message. |
chain_messages(messages: list) -> tuple
Chains messages together for processing.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
messages
|
list
|
A list of messages to chain. |
required |
Returns:
Name | Type | Description |
---|---|---|
tuple |
tuple
|
A tuple containing chained message data and the first topic. |
execute(data: dict, topic: str) -> None
Executes the email sending process.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
dict
|
The data containing email information. |
required |
topic
|
str
|
The Pub/Sub topic. |
required |
extract_message_id(cloud_event) -> str
Extracts the message ID from the cloud event.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cloud_event
|
CloudEvent
|
The cloud event from which to extract the message ID. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The extracted message ID. |
report_error(message: str, data: dict = None)
Reports an error by logging it and publishing to a queue.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message
|
str
|
The error message to report. |
required |
data
|
dict
|
Additional data associated with the error. Defaults to None. |
None
|
run(cloud_event) -> None
Processes the incoming cloud event and executes event logic.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cloud_event
|
CloudEvent
|
The cloud event containing metadata about the event. |
required |
run_next(tasks: list) -> None
Executes the next tasks in the pipeline.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tasks
|
list
|
A list of tasks to execute next. |
required |