class HttpApiCall (construct)
Language | Type name |
---|---|
![]() | Amazon.CDK.IntegTests.Alpha.HttpApiCall |
![]() | github.com/aws/aws-cdk-go/awscdkintegtestsalpha/v2#HttpApiCall |
![]() | software.amazon.awscdk.integtests.alpha.HttpApiCall |
![]() | aws_cdk.integ_tests_alpha.HttpApiCall |
![]() | @aws-cdk/integ-tests-alpha ยป HttpApiCall |
Implements
IConstruct
, IDependable
, IApi
Construct that creates a custom resource that will perform an HTTP API Call.
Example
declare const stack: Stack;
new HttpApiCall(stack, 'MyAsssertion', {
url: 'https://example-api.com/abc',
});
Initializer
new HttpApiCall(scope: Construct, id: string, props: HttpCallProps)
Parameters
- scope
Construct
- id
string
- props
Http
Call Props
Construct Props
Name | Type | Description |
---|---|---|
url | string | The url to fetch. |
fetch | Fetch | Options for fetch. |
url
Type:
string
The url to fetch.
fetchOptions?
Type:
Fetch
(optional)
Options for fetch.
Properties
Name | Type | Description |
---|---|---|
api | Custom | |
node | Node | The tree node. |
provider | Assertions | access the AssertionsProvider. |
apiCallResource
Type:
Custom
node
Type:
Node
The tree node.
provider
Type:
Assertions
access the AssertionsProvider.
This can be used to add additional IAM policies the the provider role policy
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. |
next(next) | Allows you to chain IApiCalls. This adds an explicit dependency betweent the two resources. |
to | Returns a string representation of this construct. |
wait | Wait for the IApiCall to return the expected response. |
assertAtPath(_path, _expected)
public assertAtPath(_path: string, _expected: ExpectedResult): IApiCall
Parameters
- _path
string
- _expected
Expected
Result
Returns
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
expect(expected)
public expect(expected: ExpectedResult): IApiCall
Parameters
- expected
Expected
Result
Returns
Assert that the ExpectedResult is equal to the result of the AwsApiCall.
getAtt(attributeName)
public 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.
getAttString(attributeName)
public 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.
next(next)
public next(next: IApiCall): IApiCall
Parameters
- next
IApi
Call
Returns
Allows you to chain IApiCalls. This adds an explicit dependency betweent the two resources.
Returns the IApiCall provided as next
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
waitForAssertions(options?)
public waitForAssertions(options?: WaiterStateMachineOptions): IApiCall
Parameters
- options
Waiter
State Machine Options
Returns
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