class AwsApiCall (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.IntegTests.AwsApiCall |
Java | software.amazon.awscdk.integtests.AwsApiCall |
Python | aws_cdk.integ_tests.AwsApiCall |
TypeScript (source) | @aws-cdk/integ-tests » AwsApiCall |
Implements
IConstruct
, IConstruct
, IDependable
, IAws
Construct that creates a custom resource that will perform a query using the AWS SDK.
Example
declare const myAppStack: Stack;
new AwsApiCall(myAppStack, 'GetObject', {
service: 'S3',
api: 'getObject',
});
Initializer
new AwsApiCall(scope: Construct, id: string, props: AwsApiCallProps)
Parameters
- scope
Construct
- id
string
- props
Aws
Api Call Props
Construct Props
Name | Type | Description |
---|---|---|
api | string | The api call to make, i.e. getBucketLifecycle. |
service | string | The AWS service, i.e. S3. |
parameters? | any | Any parameters to pass to the api call. |
api
Type:
string
The api call to make, i.e. getBucketLifecycle.
service
Type:
string
The AWS service, i.e. S3.
parameters?
Type:
any
(optional, default: no parameters)
Any parameters to pass to the api call.
Properties
Name | Type | Description |
---|---|---|
node | Construct | The construct tree node associated with this construct. |
provider | Assertions |
node
Type:
Construct
The construct tree node associated with this construct.
provider
Type:
Assertions
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. |
to | Returns a string representation of this construct. |
AtPath(path, expected)
assertpublic 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
expect(expected)
public expect(expected: ExpectedResult): void
Parameters
- expected
Expected
Result
Assert that the ExpectedResult is equal to the result of the AwsApiCall.
Att(attributeName)
getpublic getAtt(attributeName: string): Reference
Parameters
- attributeName
string
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.
AttString(attributeName)
getpublic getAttString(attributeName: string): string
Parameters
- attributeName
string
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.
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.