interface IAwsApiCall
Language | Type name |
---|---|
![]() | Amazon.CDK.IntegTests.IAwsApiCall |
![]() | software.amazon.awscdk.integtests.IAwsApiCall |
![]() | aws_cdk.integ_tests.IAwsApiCall |
![]() | @aws-cdk/integ-tests » IAwsApiCall |
Implemented by
Aws
, Lambda
Interface for creating a custom resource that will perform an API call using the AWS SDK.
Properties
Name | Type | Description |
---|---|---|
node | Construct | The construct tree node for this construct. |
node
Type:
Construct
The construct tree node for this construct.
Methods
Name | Description |
---|---|
assert | Assert that the ExpectedResult is equal to the result of the AwsApiCall at the given path. |
expect(expected) | Assert that the ExpectedResult is equal to the result of the AwsApiCall. |
get | Returns the value of an attribute of the custom resource of an arbitrary type. |
get | Returns the value of an attribute of the custom resource of type string. |
assertAtPath(path, expected)
public assertAtPath(path: string, expected: ExpectedResult): void
Parameters
- path
string
- expected
Expected
Result
Assert that the ExpectedResult is equal to the result of the AwsApiCall at the given path.
For example the SQS.receiveMessage api response would look like:
If you wanted to assert the value of Body
you could do
Example
const actual = {
Messages: [{
MessageId: '',
ReceiptHandle: '',
MD5OfBody: '',
Body: 'hello',
Attributes: {},
MD5OfMessageAttributes: {},
MessageAttributes: {}
}]
};
declare const integ: IntegTest;
const message = integ.assertions.awsApiCall('SQS', 'receiveMessage');
message.assertAtPath('Messages.0.Body', ExpectedResult.stringLikeRegexp('hello'));
expect(expected)
public expect(expected: ExpectedResult): void
Parameters
- expected
Expected
Result
Assert that the ExpectedResult is equal to the result of the AwsApiCall. Example
declare const integ: IntegTest;
const invoke = integ.assertions.invokeFunction({
functionName: 'my-func',
});
invoke.expect(ExpectedResult.objectLike({ Payload: 'OK' }));
getAtt(attributeName)
public getAtt(attributeName: string): Reference
Parameters
- attributeName
string
— the name of the attribute.
Returns
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.
getAttString(attributeName)
public getAttString(attributeName: string): string
Parameters
- attributeName
string
— the name of the attribute.
Returns
string
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.