Class AwsCustomResource

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.customresources.AwsCustomResource
All Implemented Interfaces:
IGrantable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.97.0 (build 729de35)", date="2024-04-18T17:54:26.140Z") @Stability(Stable) public class AwsCustomResource extends software.constructs.Construct implements IGrantable
Defines a custom resource that is materialized using specific AWS API calls.

These calls are created using a singleton Lambda function.

Use this to bridge any gap that might exist in the CloudFormation Coverage. You can specify exactly which calls are invoked for the 'CREATE', 'UPDATE' and 'DELETE' life cycle events.

Example:

 AwsCustomResource getParameter = AwsCustomResource.Builder.create(this, "GetParameter")
         .onUpdate(AwsSdkCall.builder() // will also be called for a CREATE event
                 .service("SSM")
                 .action("GetParameter")
                 .parameters(Map.of(
                         "Name", "my-parameter",
                         "WithDecryption", true))
                 .physicalResourceId(PhysicalResourceId.of(Date.now().toString())).build())
         .policy(AwsCustomResourcePolicy.fromSdkCalls(SdkCallsPolicyOptions.builder()
                 .resources(AwsCustomResourcePolicy.ANY_RESOURCE)
                 .build()))
         .build();
 // Use the value in another construct with
 getParameter.getResponseField("Parameter.Value");
 
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    A fluent builder for AwsCustomResource.

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode

    Nested classes/interfaces inherited from interface software.constructs.IConstruct

    software.constructs.IConstruct.Jsii$Default, software.constructs.IConstruct.Jsii$Proxy

    Nested classes/interfaces inherited from interface software.amazon.awscdk.services.iam.IGrantable

    IGrantable.Jsii$Default, IGrantable.Jsii$Proxy
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The uuid of the custom resource provider singleton lambda function.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AwsCustomResource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    AwsCustomResource(software.amazon.jsii.JsiiObjectRef objRef)
     
     
    AwsCustomResource(software.constructs.Construct scope, String id, AwsCustomResourceProps props)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    The principal to grant permissions to.
    Returns response data for the AWS SDK call as string.
    Returns response data for the AWS SDK call.

    Methods inherited from class software.constructs.Construct

    getNode, isConstruct, toString

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Field Details

    • PROVIDER_FUNCTION_UUID

      @Stability(Stable) public static final String PROVIDER_FUNCTION_UUID
      The uuid of the custom resource provider singleton lambda function.
  • Constructor Details

    • AwsCustomResource

      protected AwsCustomResource(software.amazon.jsii.JsiiObjectRef objRef)
    • AwsCustomResource

      protected AwsCustomResource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • AwsCustomResource

      @Stability(Stable) public AwsCustomResource(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull AwsCustomResourceProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • getResponseField

      @Stability(Stable) @NotNull public String getResponseField(@NotNull String dataPath)
      Returns response data for the AWS SDK call as string.

      Example for S3 / listBucket : 'Buckets.0.Name'

      Note that you cannot use this method if ignoreErrorCodesMatching is configured for any of the SDK calls. This is because in such a case, the response data might not exist, and will cause a CloudFormation deploy time error.

      Parameters:
      dataPath - the path to the data. This parameter is required.
    • getResponseFieldReference

      @Stability(Stable) @NotNull public Reference getResponseFieldReference(@NotNull String dataPath)
      Returns response data for the AWS SDK call.

      Example for S3 / listBucket : 'Buckets.0.Name'

      Use Token.asXxx to encode the returned Reference as a specific type or use the convenience getDataString for string attributes.

      Note that you cannot use this method if ignoreErrorCodesMatching is configured for any of the SDK calls. This is because in such a case, the response data might not exist, and will cause a CloudFormation deploy time error.

      Parameters:
      dataPath - the path to the data. This parameter is required.
    • getGrantPrincipal

      @Stability(Stable) @NotNull public IPrincipal getGrantPrincipal()
      The principal to grant permissions to.
      Specified by:
      getGrantPrincipal in interface IGrantable