class HttpIntegration (construct)
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Apigatewayv2.HttpIntegration |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsapigatewayv2#HttpIntegration |
![]() | software.amazon.awscdk.services.apigatewayv2.HttpIntegration |
![]() | aws_cdk.aws_apigatewayv2.HttpIntegration |
![]() | aws-cdk-lib » aws_apigatewayv2 » HttpIntegration |
Implements
IConstruct
, IDependable
, IResource
, IHttp
, IIntegration
The integration for an API route.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_apigatewayv2 as apigatewayv2 } from 'aws-cdk-lib';
declare const httpApi: apigatewayv2.HttpApi;
declare const integrationCredentials: apigatewayv2.IntegrationCredentials;
declare const parameterMapping: apigatewayv2.ParameterMapping;
declare const payloadFormatVersion: apigatewayv2.PayloadFormatVersion;
const httpIntegration = new apigatewayv2.HttpIntegration(this, 'MyHttpIntegration', {
httpApi: httpApi,
integrationType: apigatewayv2.HttpIntegrationType.HTTP_PROXY,
// the properties below are optional
connectionId: 'connectionId',
connectionType: apigatewayv2.HttpConnectionType.VPC_LINK,
credentials: integrationCredentials,
integrationSubtype: apigatewayv2.HttpIntegrationSubtype.EVENTBRIDGE_PUT_EVENTS,
integrationUri: 'integrationUri',
method: apigatewayv2.HttpMethod.ANY,
parameterMapping: parameterMapping,
payloadFormatVersion: payloadFormatVersion,
secureServerName: 'secureServerName',
timeout: cdk.Duration.minutes(30),
});
Initializer
new HttpIntegration(scope: Construct, id: string, props: HttpIntegrationProps)
Parameters
- scope
Construct
- id
string
- props
Http
Integration Props
Construct Props
Name | Type | Description |
---|---|---|
http | IHttp | The HTTP API to which this integration should be bound. |
integration | Http | Integration type. |
connection | string | The ID of the VPC link for a private integration. |
connection | Http | The type of the network connection to the integration endpoint. |
credentials? | Integration | The credentials with which to invoke the integration. |
integration | Http | Integration subtype. |
integration | string | Integration URI. |
method? | Http | The HTTP method to use when calling the underlying HTTP proxy. |
parameter | Parameter | Specifies how to transform HTTP requests before sending them to the backend. |
payload | Payload | The version of the payload format. |
secure | string | Specifies the TLS configuration for a private integration. |
timeout? | Duration | The maximum amount of time an integration will run before it returns without a response. |
httpApi
Type:
IHttp
The HTTP API to which this integration should be bound.
integrationType
Type:
Http
Integration type.
connectionId?
Type:
string
(optional, default: undefined)
The ID of the VPC link for a private integration.
Supported only for HTTP APIs.
connectionType?
Type:
Http
(optional, default: HttpConnectionType.INTERNET)
The type of the network connection to the integration endpoint.
credentials?
Type:
Integration
(optional, default: no credentials, use resource-based permissions on supported AWS services)
The credentials with which to invoke the integration.
integrationSubtype?
Type:
Http
(optional, default: none, required if no integrationUri
is defined.)
Integration subtype.
Used for AWS Service integrations, specifies the target of the integration.
integrationUri?
Type:
string
(optional, default: none, required if no integrationSubtype
is defined.)
Integration URI.
This will be the function ARN in the case of HttpIntegrationType.AWS_PROXY
,
or HTTP URL in the case of HttpIntegrationType.HTTP_PROXY
.
method?
Type:
Http
(optional, default: none. required if the integration type is HttpIntegrationType.HTTP_PROXY
.)
The HTTP method to use when calling the underlying HTTP proxy.
parameterMapping?
Type:
Parameter
(optional, default: undefined requests are sent to the backend unmodified)
Specifies how to transform HTTP requests before sending them to the backend.
See also: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html
payloadFormatVersion?
Type:
Payload
(optional, default: defaults to latest in the case of HttpIntegrationType.AWS_PROXY`, irrelevant otherwise.)
The version of the payload format.
secureServerName?
Type:
string
(optional, default: undefined private integration traffic will use HTTP protocol)
Specifies the TLS configuration for a private integration.
timeout?
Type:
Duration
(optional, default: Duration.seconds(29))
The maximum amount of time an integration will run before it returns without a response.
Must be between 50 milliseconds and 29 seconds.
Properties
Name | Type | Description |
---|---|---|
env | Resource | The environment this resource belongs to. |
http | IHttp | The HTTP API associated with this integration. |
integration | string | Id of the integration. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
httpApi
Type:
IHttp
The HTTP API associated with this integration.
integrationId
Type:
string
Id of the integration.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.