HttpApiCall
- class aws_cdk.integ_tests_alpha.HttpApiCall(scope, id, *, url, fetch_options=None)
Bases:
ApiCallBase
(experimental) Construct that creates a custom resource that will perform an HTTP API Call.
- Stability:
experimental
- ExampleMetadata:
infused
Example:
# stack: Stack HttpApiCall(stack, "MyAsssertion", url="https://example-api.com/abc" )
- Parameters:
scope (
Construct
) –id (
str
) –url (
str
) – (experimental) The url to fetch.fetch_options (
Union
[FetchOptions
,Dict
[str
,Any
],None
]) – (experimental) Options for fetch.
- 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
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
.