Interface AddOpenApiTargetOptions

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
AddOpenApiTargetOptions.Jsii$Proxy

@Generated(value="jsii-pacmak/1.129.0 (build eaca441)", date="2026-05-19T08:18:44.197Z") @Stability(Stable) public interface AddOpenApiTargetOptions extends software.amazon.jsii.JsiiSerializable
Options for adding an OpenAPI target to a gateway.

Example:

 Gateway gateway = Gateway.Builder.create(this, "MyGateway")
         .gatewayName("my-gateway")
         .build();
 // Create an API key credential provider in Token Vault
 ApiKeyCredentialProvider apiKeyProvider = ApiKeyCredentialProvider.Builder.create(this, "MyApiKeyProvider")
         .apiKeyCredentialProviderName("my-apikey")
         .build();
 IBucket bucket = Bucket.fromBucketName(this, "ExistingBucket", "my-schema-bucket");
 S3ApiSchema s3mySchema = ApiSchema.fromS3File(bucket, "schemas/myschema.yaml");
 // Add an OpenAPI target using the L2 construct directly
 GatewayTarget target = gateway.addOpenApiTarget("MyTarget", AddOpenApiTargetOptions.builder()
         .gatewayTargetName("my-api-target")
         .description("Target for external API integration")
         .apiSchema(s3mySchema)
         .credentialProviderConfigurations(List.of(GatewayCredentialProvider.fromApiKeyIdentity(apiKeyProvider, FromApiKeyIdentityOptions.builder()
                 .credentialLocation(ApiKeyCredentialLocation.header(ApiKeyAdditionalConfiguration.builder()
                         .credentialParameterName("X-API-Key")
                         .build()))
                 .build())))
         .build());
 // This makes sure your s3 bucket is available before target
 target.node.addDependency(bucket);
 
  • Method Details

    • getApiSchema

      @Stability(Stable) @NotNull ApiSchema getApiSchema()
      The OpenAPI schema defining the API.
    • getCredentialProviderConfigurations

      @Stability(Stable) @Nullable default List<ICredentialProviderConfig> getCredentialProviderConfigurations()
      Credential providers for outbound authentication (OpenAPI targets use API Key or OAuth, not IAM).

      Default: - none (no credential configuration on the target; supply providers for secured backends)

    • getDescription

      @Stability(Stable) @Nullable default String getDescription()
      Optional description for the gateway target.

      Default: - No description

    • getGatewayTargetName

      @Stability(Stable) @Nullable default String getGatewayTargetName()
      The name of the gateway target Valid characters are a-z, A-Z, 0-9, _ (underscore) and - (hyphen).

      Default: - auto generate

    • getValidateOpenApiSchema

      @Stability(Stable) @Nullable default Boolean getValidateOpenApiSchema()
      Whether to validate the OpenAPI schema or not Note: Validation is only performed for inline and asset-based schema and during CDK synthesis.

      S3 schemas cannot be validated at synthesis time.

      Default: true

    • builder

      @Stability(Stable) static AddOpenApiTargetOptions.Builder builder()
      Returns:
      a AddOpenApiTargetOptions.Builder of AddOpenApiTargetOptions