|  | 
| 18 | 18 | from stepfunctions.steps.integration_resources import IntegrationPattern, get_service_integration_arn | 
| 19 | 19 | 
 | 
| 20 | 20 | DYNAMODB_SERVICE_NAME = "dynamodb" | 
|  | 21 | +ELASTICMAPREDUCE_SERVICE_NAME = "elasticmapreduce" | 
|  | 22 | +EVENTBRIDGE_SERVICE_NAME = "events" | 
| 21 | 23 | SNS_SERVICE_NAME = "sns" | 
| 22 | 24 | SQS_SERVICE_NAME = "sqs" | 
| 23 |  | -ELASTICMAPREDUCE_SERVICE_NAME = "elasticmapreduce" | 
|  | 25 | + | 
| 24 | 26 | 
 | 
| 25 | 27 | 
 | 
| 26 | 28 | class DynamoDBApi(Enum): | 
| @@ -48,6 +50,10 @@ class ElasticMapReduceApi(Enum): | 
| 48 | 50 |  ModifyInstanceGroupByName = "modifyInstanceGroupByName" | 
| 49 | 51 | 
 | 
| 50 | 52 | 
 | 
|  | 53 | +class EventBridgeApi(Enum): | 
|  | 54 | + PutEvents = "putEvents" | 
|  | 55 | + | 
|  | 56 | + | 
| 51 | 57 | class DynamoDBGetItemStep(Task): | 
| 52 | 58 |  """ | 
| 53 | 59 |  Creates a Task state to get an item from DynamoDB. See `Call DynamoDB APIs with Step Functions <https://docs.aws.amazon.com/step-functions/latest/dg/connect-ddb.html>`_ for more details. | 
| @@ -77,6 +83,46 @@ def __init__(self, state_id, **kwargs): | 
| 77 | 83 |  super(DynamoDBGetItemStep, self).__init__(state_id, **kwargs) | 
| 78 | 84 | 
 | 
| 79 | 85 | 
 | 
|  | 86 | +class EventBridgePutEventsStep(Task): | 
|  | 87 | + | 
|  | 88 | + """ | 
|  | 89 | + Creates a Task to send custom events to Amazon EventBridge. See`Call EventBridge with Step Functions <https://docs.aws.amazon.com/step-functions/latest/dg/connect-eventbridge.html>`_ for more details. | 
|  | 90 | + """ | 
|  | 91 | + | 
|  | 92 | + def __init__(self, state_id, wait_for_callback=False, **kwargs): | 
|  | 93 | + """ | 
|  | 94 | + Args: | 
|  | 95 | + state_id (str): State name whose length **must be** less than or equal to 128 unicode characters. State names **must be** unique within the scope of the whole state machine. | 
|  | 96 | + comment (str, optional): Human-readable comment or description. (default: None) | 
|  | 97 | + timeout_seconds (int, optional): Positive integer specifying timeout for the state in seconds. If the state runs longer than the specified timeout, then the interpreter fails the state with a `States.Timeout` Error Name. (default: 60) | 
|  | 98 | + timeout_seconds_path (str, optional): Path specifying the state's timeout value in seconds from the state input. When resolved, the path must select a field whose value is a positive integer. | 
|  | 99 | + heartbeat_seconds (int, optional): Positive integer specifying heartbeat timeout for the state in seconds. This value should be lower than the one specified for `timeout_seconds`. If more time than the specified heartbeat elapses between heartbeats from the task, then the interpreter fails the state with a `States.Timeout` Error Name. | 
|  | 100 | + heartbeat_seconds_path (str, optional): Path specifying the state's heartbeat value in seconds from the state input. When resolved, the path must select a field whose value is a positive integer. | 
|  | 101 | + input_path (str, optional): Path applied to the state’s raw input to select some or all of it; that selection is used by the state. (default: '$') | 
|  | 102 | + parameters (dict, optional): The value of this field becomes the effective input for the state. | 
|  | 103 | + result_path (str, optional): Path specifying the raw input’s combination with or replacement by the state’s result. (default: '$') | 
|  | 104 | + output_path (str, optional): Path applied to the state’s output after the application of `result_path`, producing the effective output which serves as the raw input for the next state. (default: '$') | 
|  | 105 | + """ | 
|  | 106 | + | 
|  | 107 | + if wait_for_callback: | 
|  | 108 | + """ | 
|  | 109 | + Example resource arn: arn:aws:states:::events:putEvents.waitForTaskToken | 
|  | 110 | + """ | 
|  | 111 | + | 
|  | 112 | + kwargs[Field.Resource.value] = get_service_integration_arn(EVENTBRIDGE_SERVICE_NAME, | 
|  | 113 | + EventBridgeApi.PutEvents, | 
|  | 114 | + IntegrationPattern.WaitForTaskToken) | 
|  | 115 | + else: | 
|  | 116 | + """ | 
|  | 117 | + Example resource arn: arn:aws:states:::events:putEvents | 
|  | 118 | + """ | 
|  | 119 | + | 
|  | 120 | + kwargs[Field.Resource.value] = get_service_integration_arn(EVENTBRIDGE_SERVICE_NAME, | 
|  | 121 | + EventBridgeApi.PutEvents) | 
|  | 122 | + | 
|  | 123 | + super(EventBridgePutEventsStep, self).__init__(state_id, **kwargs) | 
|  | 124 | + | 
|  | 125 | + | 
| 80 | 126 | class DynamoDBPutItemStep(Task): | 
| 81 | 127 | 
 | 
| 82 | 128 |  """ | 
|  | 
0 commit comments