Skip to content
v2.278.0

GatewayTargetApiGatewayProps Struct ​

Properties for creating an API Gateway-based Gateway Target.

Example ​

ts
const gateway = new agentcore.Gateway(this, "MyGateway", {
  gatewayName: "my-gateway",
});

const api = new apigateway.RestApi(this, 'MyApi', {
  restApiName: 'my-api',
});

// Create a gateway target using the static factory method
const apiGatewayTarget = agentcore.GatewayTarget.forApiGateway(this, "MyApiGatewayTarget", {
  gatewayTargetName: "my-api-gateway-target",
  description: "Target for API Gateway REST API integration",
  gateway: gateway,
  restApi: api,
  apiGatewayToolConfiguration: {
    toolFilters: [
      {
        filterPath: "/pets/*",
        methods: [agentcore.ApiGatewayHttpMethod.GET, agentcore.ApiGatewayHttpMethod.POST],
      },
    ],
  },
  metadataConfiguration: {
    allowedRequestHeaders: ["X-User-Id"],
    allowedQueryParameters: ["limit"],
  },
});
python
gateway = agentcore.Gateway(self, "MyGateway",
    gateway_name="my-gateway"
)

api = apigateway.RestApi(self, "MyApi",
    rest_api_name="my-api"
)

# Create a gateway target using the static factory method
api_gateway_target = agentcore.GatewayTarget.for_api_gateway(self, "MyApiGatewayTarget",
    gateway_target_name="my-api-gateway-target",
    description="Target for API Gateway REST API integration",
    gateway=gateway,
    rest_api=api,
    api_gateway_tool_configuration=agentcore.ApiGatewayToolConfiguration(
        tool_filters=[agentcore.ApiGatewayToolFilter(
            filter_path="/pets/*",
            methods=[agentcore.ApiGatewayHttpMethod.GET, agentcore.ApiGatewayHttpMethod.POST]
        )
        ]
    ),
    metadata_configuration=agentcore.MetadataConfiguration(
        allowed_request_headers=["X-User-Id"],
        allowed_query_parameters=["limit"]
    )
)
java
Gateway gateway = Gateway.Builder.create(this, "MyGateway")
        .gatewayName("my-gateway")
        .build();

RestApi api = RestApi.Builder.create(this, "MyApi")
        .restApiName("my-api")
        .build();

// Create a gateway target using the static factory method
GatewayTarget apiGatewayTarget = GatewayTarget.forApiGateway(this, "MyApiGatewayTarget", GatewayTargetApiGatewayProps.builder()
        .gatewayTargetName("my-api-gateway-target")
        .description("Target for API Gateway REST API integration")
        .gateway(gateway)
        .restApi(api)
        .apiGatewayToolConfiguration(ApiGatewayToolConfiguration.builder()
                .toolFilters(List.of(ApiGatewayToolFilter.builder()
                        .filterPath("/pets/*")
                        .methods(List.of(ApiGatewayHttpMethod.GET, ApiGatewayHttpMethod.POST))
                        .build()))
                .build())
        .metadataConfiguration(MetadataConfiguration.builder()
                .allowedRequestHeaders(List.of("X-User-Id"))
                .allowedQueryParameters(List.of("limit"))
                .build())
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
var gateway = new Gateway(this, "MyGateway", new GatewayProps {
    GatewayName = "my-gateway"
});

var api = new RestApi(this, "MyApi", new RestApiProps {
    RestApiName = "my-api"
});

// Create a gateway target using the static factory method
var apiGatewayTarget = GatewayTarget.ForApiGateway(this, "MyApiGatewayTarget", new GatewayTargetApiGatewayProps {
    GatewayTargetName = "my-api-gateway-target",
    Description = "Target for API Gateway REST API integration",
    Gateway = gateway,
    RestApi = api,
    ApiGatewayToolConfiguration = new ApiGatewayToolConfiguration {
        ToolFilters = new [] { new ApiGatewayToolFilter {
            FilterPath = "/pets/*",
            Methods = new [] { ApiGatewayHttpMethod.GET, ApiGatewayHttpMethod.POST }
        } }
    },
    MetadataConfiguration = new MetadataConfiguration {
        AllowedRequestHeaders = new [] { "X-User-Id" },
        AllowedQueryParameters = new [] { "limit" }
    }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
gateway := agentcore.NewGateway(this, jsii.String("MyGateway"), &GatewayProps{
	GatewayName: jsii.String("my-gateway"),
})

api := apigateway.NewRestApi(this, jsii.String("MyApi"), &RestApiProps{
	RestApiName: jsii.String("my-api"),
})

// Create a gateway target using the static factory method
apiGatewayTarget := agentcore.GatewayTarget_ForApiGateway(this, jsii.String("MyApiGatewayTarget"), &GatewayTargetApiGatewayProps{
	GatewayTargetName: jsii.String("my-api-gateway-target"),
	Description: jsii.String("Target for API Gateway REST API integration"),
	Gateway: gateway,
	RestApi: api,
	ApiGatewayToolConfiguration: &ApiGatewayToolConfiguration{
		ToolFilters: []ApiGatewayToolFilter{
			&ApiGatewayToolFilter{
				FilterPath: jsii.String("/pets/*"),
				Methods: []ApiGatewayHttpMethod{
					agentcore.ApiGatewayHttpMethod_GET(),
					agentcore.ApiGatewayHttpMethod_POST(),
				},
			},
		},
	},
	MetadataConfiguration: &MetadataConfiguration{
		AllowedRequestHeaders: []*string{
			jsii.String("X-User-Id"),
		},
		AllowedQueryParameters: []*string{
			jsii.String("limit"),
		},
	},
})

Properties ​

apiGatewayToolConfigurationApiGatewayToolConfigurationapi_gateway_tool_configurationApiGatewayToolConfigurationapiGatewayToolConfigurationApiGatewayToolConfigurationApiGatewayToolConfigurationApiGatewayToolConfigurationApiGatewayToolConfigurationApiGatewayToolConfiguration required #
Tool configuration defining which operations to expose.
credentialProviderConfigurationsoptionalICredentialProviderConfig[]credential_provider_configurationsoptionaltyping.List[ICredentialProviderConfig]credentialProviderConfigurationsoptionalList<ICredentialProviderConfig>CredentialProviderConfigurationsoptionalICredentialProviderConfig[]CredentialProviderConfigurationsoptional*[]ICredentialProviderConfig #
Credential providers for authentication API Gateway targets support IAM and API key authentication.

Default: Empty array (service handles IAM automatically)

descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string #
Optional description for the gateway target The description can have up to 200 characters.

Default: No description

gatewayIGatewaygatewayIGatewaygatewayIGatewayGatewayIGatewayGatewayIGateway required #
The gateway this target belongs to [disable-awslint:prefer-ref-interface].
gatewayTargetNameoptionalstringgateway_target_nameoptionalstrgatewayTargetNameoptionalStringGatewayTargetNameoptionalstringGatewayTargetNameoptional*string #
The name of the gateway target The name must be unique within the gateway Pattern: ^([0-9a-zA-Z][-]?){1,100}$.

Default: auto generate

metadataConfigurationoptionalMetadataConfigurationmetadata_configurationoptionalMetadataConfigurationmetadataConfigurationoptionalMetadataConfigurationMetadataConfigurationoptionalMetadataConfigurationMetadataConfigurationoptionalMetadataConfiguration #
Metadata configuration for passing headers and query parameters Allows you to pass additional context through headers and query parameters.

Default: No metadata configuration

restApiIRestApirest_apiIRestApirestApiIRestApiRestApiIRestApiRestApiIRestApi required #
The REST API to integrate with Must be in the same account and region as the gateway [disable-awslint:prefer-ref-interface].
stageoptionalstringstageoptionalstrstageoptionalStringStageoptionalstringStageoptional*string #
The stage name of the REST API.

Default: Uses the deployment stage from the RestApi (restApi.deploymentStage.stageName)