InvocationType

class aws_cdk.integ_tests_alpha.InvocationType(value)

Bases: Enum

(experimental) The type of invocation.

Default is REQUEST_RESPONSE

Stability:

experimental

ExampleMetadata:

infused

Example:

# app: App
# stack: Stack
# queue: sqs.Queue
# fn: lambda.IFunction


integ = IntegTest(app, "Integ",
    test_cases=[stack]
)

integ.assertions.invoke_function(
    function_name=fn.function_name,
    invocation_type=InvocationType.EVENT,
    payload=JSON.stringify({"status": "OK"})
)

message = integ.assertions.aws_api_call("SQS", "receiveMessage", {
    "QueueUrl": queue.queue_url,
    "WaitTimeSeconds": 20
})

message.assert_at_path("Messages.0.Body", ExpectedResult.object_like({
    "request_context": {
        "condition": "Success"
    },
    "request_payload": {
        "status": "OK"
    },
    "response_context": {
        "status_code": 200
    },
    "response_payload": "success"
}))

Attributes

DRY_RUN

(experimental) Validate parameter values and verify that the user or role has permission to invoke the function.

Stability:

experimental

EVENT

(experimental) Invoke the function asynchronously.

Send events that fail multiple times to the function’s dead-letter queue (if it’s configured). The API response only includes a status code.

Stability:

experimental

REQUEST_RESPONSE

(experimental) Invoke the function synchronously.

Keep the connection open until the function returns a response or times out. The API response includes the function response and additional data.

Stability:

experimental