Interface IAwsApiCall

All Superinterfaces:
IConstruct, software.constructs.IConstruct, IDependable, software.amazon.jsii.JsiiSerializable
All Known Subinterfaces:
IAwsApiCall.Jsii$Default
All Known Implementing Classes:
AwsApiCall, IAwsApiCall.Jsii$Proxy, LambdaInvokeFunction

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:36.699Z") @Stability(Experimental) public interface IAwsApiCall extends software.amazon.jsii.JsiiSerializable, IConstruct
(experimental) Interface for creating a custom resource that will perform an API call using the AWS SDK.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Internal default implementation for IAwsApiCall.
    static final class 
    A proxy class which represents a concrete javascript instance of this type.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    (experimental) Assert that the ExpectedResult is equal to the result of the AwsApiCall at the given path.
    void
    (experimental) Assert that the ExpectedResult is equal to the result of the AwsApiCall.
    getAtt(String attributeName)
    (experimental) Returns the value of an attribute of the custom resource of an arbitrary type.
    getAttString(String attributeName)
    (experimental) Returns the value of an attribute of the custom resource of type string.

    Methods inherited from interface software.amazon.awscdk.core.IConstruct

    getNode

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Method Details

    • assertAtPath

      @Stability(Experimental) void assertAtPath(@NotNull String path, @NotNull ExpectedResult expected)
      (experimental) 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:

       IntegTest integ;
       Map<String, Map<String, Object>[]> actual = Map.of(
               "Messages", List.of(Map.of(
                       "MessageId", "",
                       "ReceiptHandle", "",
                       "MD5OfBody", "",
                       "Body", "hello",
                       "Attributes", Map.of(),
                       "MD5OfMessageAttributes", Map.of(),
                       "MessageAttributes", Map.of())));
       IAwsApiCall message = integ.assertions.awsApiCall("SQS", "receiveMessage");
       message.assertAtPath("Messages.0.Body", ExpectedResult.stringLikeRegexp("hello"));
       

      Parameters:
      path - This parameter is required.
      expected - This parameter is required.
    • expect

      @Stability(Experimental) void expect(@NotNull ExpectedResult expected)
      (experimental) Assert that the ExpectedResult is equal to the result of the AwsApiCall.

      Example:

       IntegTest integ;
       IAwsApiCall invoke = integ.assertions.invokeFunction(LambdaInvokeFunctionProps.builder()
               .functionName("my-func")
               .build());
       invoke.expect(ExpectedResult.objectLike(Map.of("Payload", "OK")));
       

      Parameters:
      expected - This parameter is required.
    • getAtt

      @Stability(Experimental) @NotNull Reference getAtt(@NotNull String attributeName)
      (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:
      attributeName - the name of the attribute. This parameter is required.
      Returns:
      a token for Fn::GetAtt. Use Token.asXxx to encode the returned Reference as a specific type or use the convenience getAttString for string attributes.
    • getAttString

      @Stability(Experimental) @NotNull String getAttString(@NotNull String attributeName)
      (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:
      attributeName - the name of the attribute. This parameter is required.
      Returns:
      a token for Fn::GetAtt encoded as a string.