LambdaInvokeFunction
- class aws_cdk.integ_tests_alpha.LambdaInvokeFunction(scope, id, *, function_name, invocation_type=None, log_retention=None, log_type=None, payload=None)
Bases:
AwsApiCall
(experimental) An AWS Lambda Invoke function API call.
Use this instead of the generic AwsApiCall in order to invoke a lambda function. This will automatically create the correct permissions to invoke the function
- Stability:
experimental
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.integ_tests_alpha as integ_tests_alpha from aws_cdk import aws_logs as logs lambda_invoke_function = integ_tests_alpha.LambdaInvokeFunction(self, "MyLambdaInvokeFunction", function_name="functionName", # the properties below are optional invocation_type=integ_tests_alpha.InvocationType.EVENT, log_retention=logs.RetentionDays.ONE_DAY, log_type=integ_tests_alpha.LogType.NONE, payload="payload" )
- Parameters:
scope (
Construct
) –id (
str
) –function_name (
str
) – (experimental) The name of the function to invoke.invocation_type (
Optional
[InvocationType
]) – (experimental) The type of invocation to use. Default: InvocationType.REQUEST_RESPONSElog_retention (
Optional
[RetentionDays
]) – (experimental) How long, in days, the log contents will be retained. Default: - no retention days specifiedlog_type (
Optional
[LogType
]) – (experimental) Whether to return the logs as part of the response. Default: LogType.NONEpayload (
Optional
[str
]) – (experimental) Payload to send as part of the invoke. Default: - no payload
- Stability:
experimental
Methods
- assert_at_path(path, expected)
(experimental) Assert that the ExpectedResult is equal to the result of the AwsApiCall at the given path.
Providing a path will filter the output of the initial API call.
For example the SQS.receiveMessage api response would look like:
If you wanted to assert the value of
Body
you could do- Parameters:
path (
str
) –expected (
ExpectedResult
) –
- Stability:
experimental
- Return type:
- expect(expected)
(experimental) Assert that the ExpectedResult is equal to the result of the AwsApiCall.
- Parameters:
expected (
ExpectedResult
) –- Stability:
experimental
- Return type:
- get_att(attribute_name)
(experimental) Returns the value of an attribute of the custom resource of an arbitrary type.
Attributes are returned from the custom resource provider through the
Data
map where the key is the attribute name.- Parameters:
attribute_name (
str
) –- Stability:
experimental
- Return type:
- get_att_string(attribute_name)
(experimental) Returns the value of an attribute of the custom resource of type string.
Attributes are returned from the custom resource provider through the
Data
map where the key is the attribute name.- Parameters:
attribute_name (
str
) –- Stability:
experimental
- Return type:
str
- next(next)
(experimental) Allows you to chain IApiCalls. This adds an explicit dependency betweent the two resources.
Returns the IApiCall provided as
next
- to_string()
Returns a string representation of this construct.
- Return type:
str
- wait_for_assertions(*, backoff_rate=None, interval=None, total_timeout=None)
(experimental) Wait for the IApiCall to return the expected response.
If no expected response is specified then it will wait for the IApiCall to return a success
- Parameters:
backoff_rate (
Union
[int
,float
,None
]) – (experimental) Backoff between attempts. This is the multiplier by which the retry interval increases after each retry attempt. By default there is no backoff. Each retry will wait the amount of time specified byinterval
. Default: 1 (no backoff)interval (
Optional
[Duration
]) – (experimental) The interval (number of seconds) to wait between attempts. Default: Duration.seconds(5)total_timeout (
Optional
[Duration
]) – (experimental) The total time that the state machine will wait for a successful response. Default: Duration.minutes(30)
- Stability:
experimental
- Return type:
Attributes
- node
The tree node.
- provider
(experimental) access the AssertionsProvider.
This can be used to add additional IAM policies the the provider role policy
- Stability:
experimental
- waiter_provider
(experimental) access the AssertionsProvider for the waiter state machine.
This can be used to add additional IAM policies the the provider role policy
- Stability:
experimental
Example:
# api_call: AwsApiCall api_call.waiter_provider.add_to_role_policy({ "Effect": "Allow", "Action": ["s3:GetObject"], "Resource": ["*"] })
Static Methods
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
instances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructs
library on disk are seen as independent, completely different libraries. As a consequence, the classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
the other class.npm install
will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, and using this type-testing method instead.- Parameters:
x (
Any
) – Any object.- Return type:
bool
- Returns:
true if
x
is an object created from a class which extendsConstruct
.