Documentation
¶
Index ¶
- func NewHttpAlbIntegration_Override(h HttpAlbIntegration, id *string, ...)
- func NewHttpLambdaIntegration_Override(h HttpLambdaIntegration, id *string, handler awslambda.IFunction, ...)
- func NewHttpNlbIntegration_Override(h HttpNlbIntegration, id *string, ...)
- func NewHttpServiceDiscoveryIntegration_Override(h HttpServiceDiscoveryIntegration, id *string, ...)
- func NewHttpSqsIntegration_Override(h HttpSqsIntegration, id *string, props *HttpSqsIntegrationProps)
- func NewHttpStepFunctionsIntegration_Override(h HttpStepFunctionsIntegration, id *string, ...)
- func NewHttpUrlIntegration_Override(h HttpUrlIntegration, id *string, url *string, props *HttpUrlIntegrationProps)
- func NewWebSocketAwsIntegration_Override(w WebSocketAwsIntegration, id *string, props *WebSocketAwsIntegrationProps)
- func NewWebSocketLambdaIntegration_Override(w WebSocketLambdaIntegration, id *string, handler awslambda.IFunction, ...)
- func NewWebSocketMockIntegration_Override(w WebSocketMockIntegration, id *string, props *WebSocketMockIntegrationProps)
- type HttpAlbIntegration
- type HttpAlbIntegrationProps
- type HttpLambdaIntegration
- type HttpLambdaIntegrationProps
- type HttpNlbIntegration
- type HttpNlbIntegrationProps
- type HttpPrivateIntegrationOptions
- type HttpServiceDiscoveryIntegration
- type HttpServiceDiscoveryIntegrationProps
- type HttpSqsIntegration
- type HttpSqsIntegrationProps
- type HttpStepFunctionsIntegration
- type HttpStepFunctionsIntegrationProps
- type HttpUrlIntegration
- type HttpUrlIntegrationProps
- type WebSocketAwsIntegration
- type WebSocketAwsIntegrationProps
- type WebSocketLambdaIntegration
- type WebSocketLambdaIntegrationProps
- type WebSocketMockIntegration
- type WebSocketMockIntegrationProps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHttpAlbIntegration_Override ¶
func NewHttpAlbIntegration_Override(h HttpAlbIntegration, id *string, listener awselasticloadbalancingv2.IApplicationListener, props *HttpAlbIntegrationProps)
func NewHttpLambdaIntegration_Override ¶
func NewHttpLambdaIntegration_Override(h HttpLambdaIntegration, id *string, handler awslambda.IFunction, props *HttpLambdaIntegrationProps)
func NewHttpNlbIntegration_Override ¶
func NewHttpNlbIntegration_Override(h HttpNlbIntegration, id *string, listener awselasticloadbalancingv2.INetworkListener, props *HttpNlbIntegrationProps)
func NewHttpServiceDiscoveryIntegration_Override ¶
func NewHttpServiceDiscoveryIntegration_Override(h HttpServiceDiscoveryIntegration, id *string, service awsservicediscovery.IService, props *HttpServiceDiscoveryIntegrationProps)
func NewHttpSqsIntegration_Override ¶ added in v2.179.0
func NewHttpSqsIntegration_Override(h HttpSqsIntegration, id *string, props *HttpSqsIntegrationProps)
func NewHttpStepFunctionsIntegration_Override ¶ added in v2.131.0
func NewHttpStepFunctionsIntegration_Override(h HttpStepFunctionsIntegration, id *string, props *HttpStepFunctionsIntegrationProps)
func NewHttpUrlIntegration_Override ¶
func NewHttpUrlIntegration_Override(h HttpUrlIntegration, id *string, url *string, props *HttpUrlIntegrationProps)
func NewWebSocketAwsIntegration_Override ¶ added in v2.123.0
func NewWebSocketAwsIntegration_Override(w WebSocketAwsIntegration, id *string, props *WebSocketAwsIntegrationProps)
func NewWebSocketLambdaIntegration_Override ¶
func NewWebSocketLambdaIntegration_Override(w WebSocketLambdaIntegration, id *string, handler awslambda.IFunction, props *WebSocketLambdaIntegrationProps)
func NewWebSocketMockIntegration_Override ¶
func NewWebSocketMockIntegration_Override(w WebSocketMockIntegration, id *string, props *WebSocketMockIntegrationProps)
Types ¶
type HttpAlbIntegration ¶
type HttpAlbIntegration interface {
awsapigatewayv2.HttpRouteIntegration
ConnectionType() awsapigatewayv2.HttpConnectionType
SetConnectionType(val awsapigatewayv2.HttpConnectionType)
HttpMethod() awsapigatewayv2.HttpMethod
SetHttpMethod(val awsapigatewayv2.HttpMethod)
IntegrationType() awsapigatewayv2.HttpIntegrationType
SetIntegrationType(val awsapigatewayv2.HttpIntegrationType)
PayloadFormatVersion() awsapigatewayv2.PayloadFormatVersion
SetPayloadFormatVersion(val awsapigatewayv2.PayloadFormatVersion)
// Bind this integration to the route.
Bind(options *awsapigatewayv2.HttpRouteIntegrationBindOptions) *awsapigatewayv2.HttpRouteIntegrationConfig
// Complete the binding of the integration to the route.
//
// In some cases, there is
// some additional work to do, such as adding permissions for the API to access
// the target. This work is necessary whether the integration has just been
// created for this route or it is an existing one, previously created for other
// routes. In most cases, however, concrete implementations do not need to
// override this method.
CompleteBind(_options *awsapigatewayv2.HttpRouteIntegrationBindOptions)
}
The Application Load Balancer integration resource for HTTP API.
Example:
import "github.com/aws/aws-cdk-go/awscdk"
vpc := ec2.NewVpc(this, jsii.String("VPC"))
lb := elbv2.NewApplicationLoadBalancer(this, jsii.String("lb"), &ApplicationLoadBalancerProps{
Vpc: Vpc,
})
listener := lb.AddListener(jsii.String("listener"), &BaseApplicationListenerProps{
Port: jsii.Number(80),
})
listener.AddTargets(jsii.String("target"), &AddApplicationTargetsProps{
Port: jsii.Number(80),
})
httpEndpoint := apigwv2.NewHttpApi(this, jsii.String("HttpProxyPrivateApi"), &HttpApiProps{
DefaultIntegration: awscdk.NewHttpAlbIntegration(jsii.String("DefaultIntegration"), listener),
})
func NewHttpAlbIntegration ¶
func NewHttpAlbIntegration(id *string, listener awselasticloadbalancingv2.IApplicationListener, props *HttpAlbIntegrationProps) HttpAlbIntegration
type HttpAlbIntegrationProps ¶
type HttpAlbIntegrationProps struct {
// The HTTP method that must be used to invoke the underlying HTTP proxy.
// Default: HttpMethod.ANY
//
Method awsapigatewayv2.HttpMethod `field:"optional" json:"method" yaml:"method"`
// Specifies how to transform HTTP requests before sending them to the backend.
// See: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html
//
// Default: undefined requests are sent to the backend unmodified.
//
ParameterMapping awsapigatewayv2.ParameterMapping `field:"optional" json:"parameterMapping" yaml:"parameterMapping"`
// Specifies the server name to verified by HTTPS when calling the backend integration.
// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-integration-tlsconfig.html
//
// Default: undefined private integration traffic will use HTTP protocol.
//
SecureServerName *string `field:"optional" json:"secureServerName" yaml:"secureServerName"`
// The maximum amount of time an integration will run before it returns without a response.
//
// Must be between 50 milliseconds and 29 seconds.
// Default: Duration.seconds(29)
//
Timeout awscdk.Duration `field:"optional" json:"timeout" yaml:"timeout"`
// The vpc link to be used for the private integration.
// Default: - a new VpcLink is created.
//
VpcLink awsapigatewayv2.IVpcLink `field:"optional" json:"vpcLink" yaml:"vpcLink"`
}
Properties to initialize `HttpAlbIntegration`.
Example:
import "github.com/aws/aws-cdk-go/awscdk"
var lb ApplicationLoadBalancer
listener := lb.AddListener(jsii.String("listener"), &BaseApplicationListenerProps{
Port: jsii.Number(80),
})
listener.AddTargets(jsii.String("target"), &AddApplicationTargetsProps{
Port: jsii.Number(80),
})
httpEndpoint := apigwv2.NewHttpApi(this, jsii.String("HttpProxyPrivateApi"), &HttpApiProps{
DefaultIntegration: awscdk.NewHttpAlbIntegration(jsii.String("DefaultIntegration"), listener, &HttpAlbIntegrationProps{
ParameterMapping: apigwv2.NewParameterMapping().Custom(jsii.String("myKey"), jsii.String("myValue")),
}),
})
type HttpLambdaIntegration ¶
type HttpLambdaIntegration interface {
awsapigatewayv2.HttpRouteIntegration
// Bind this integration to the route.
Bind(options *awsapigatewayv2.HttpRouteIntegrationBindOptions) *awsapigatewayv2.HttpRouteIntegrationConfig
// Complete the binding of the integration to the route.
//
// In some cases, there is
// some additional work to do, such as adding permissions for the API to access
// the target. This work is necessary whether the integration has just been
// created for this route or it is an existing one, previously created for other
// routes. In most cases, however, concrete implementations do not need to
// override this method.
CompleteBind(_options *awsapigatewayv2.HttpRouteIntegrationBindOptions)
}
The Lambda Proxy integration resource for HTTP API.
Example:
import "github.com/aws/aws-cdk-go/awscdk"
var bookStoreDefaultFn Function
getBooksIntegration := awscdk.NewHttpUrlIntegration(jsii.String("GetBooksIntegration"), jsii.String("https://get-books-proxy.example.com"))
bookStoreDefaultIntegration := awscdk.NewHttpLambdaIntegration(jsii.String("BooksIntegration"), bookStoreDefaultFn)
httpApi := apigwv2.NewHttpApi(this, jsii.String("HttpApi"))
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/books"),
Methods: []HttpMethod{
apigwv2.HttpMethod_GET,
},
Integration: getBooksIntegration,
})
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/books"),
Methods: []HttpMethod{
apigwv2.HttpMethod_ANY,
},
Integration: bookStoreDefaultIntegration,
})
func NewHttpLambdaIntegration ¶
func NewHttpLambdaIntegration(id *string, handler awslambda.IFunction, props *HttpLambdaIntegrationProps) HttpLambdaIntegration
type HttpLambdaIntegrationProps ¶
type HttpLambdaIntegrationProps struct {
// Specifies how to transform HTTP requests before sending them to the backend.
// See: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html
//
// Default: undefined requests are sent to the backend unmodified.
//
ParameterMapping awsapigatewayv2.ParameterMapping `field:"optional" json:"parameterMapping" yaml:"parameterMapping"`
// Version of the payload sent to the lambda handler.
// See: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
//
// Default: PayloadFormatVersion.VERSION_2_0
//
PayloadFormatVersion awsapigatewayv2.PayloadFormatVersion `field:"optional" json:"payloadFormatVersion" yaml:"payloadFormatVersion"`
// Scope the permission for invoking the AWS Lambda down to the specific route associated with this integration.
//
// If this is set to `false`, the permission will allow invoking the AWS Lambda
// from any route. This is useful for reducing the AWS Lambda policy size
// for cases where the same AWS Lambda function is reused for many integrations.
// Default: true.
//
ScopePermissionToRoute *bool `field:"optional" json:"scopePermissionToRoute" yaml:"scopePermissionToRoute"`
// The maximum amount of time an integration will run before it returns without a response.
//
// Must be between 50 milliseconds and 29 seconds.
// Default: Duration.seconds(29)
//
Timeout awscdk.Duration `field:"optional" json:"timeout" yaml:"timeout"`
}
Lambda Proxy integration properties.
Example:
import "github.com/aws/aws-cdk-go/awscdk"
var booksDefaultFn Function
httpApi := apigwv2.NewHttpApi(this, jsii.String("HttpApi"))
getBooksIntegration := awscdk.NewHttpLambdaIntegration(jsii.String("GetBooksIntegration"), booksDefaultFn, &HttpLambdaIntegrationProps{
ScopePermissionToRoute: jsii.Boolean(false),
})
createBookIntegration := awscdk.NewHttpLambdaIntegration(jsii.String("CreateBookIntegration"), booksDefaultFn, &HttpLambdaIntegrationProps{
ScopePermissionToRoute: jsii.Boolean(false),
})
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/books"),
Methods: []HttpMethod{
apigwv2.HttpMethod_GET,
},
Integration: getBooksIntegration,
})
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/books"),
Methods: []HttpMethod{
apigwv2.HttpMethod_POST,
},
Integration: createBookIntegration,
})
type HttpNlbIntegration ¶
type HttpNlbIntegration interface {
awsapigatewayv2.HttpRouteIntegration
ConnectionType() awsapigatewayv2.HttpConnectionType
SetConnectionType(val awsapigatewayv2.HttpConnectionType)
HttpMethod() awsapigatewayv2.HttpMethod
SetHttpMethod(val awsapigatewayv2.HttpMethod)
IntegrationType() awsapigatewayv2.HttpIntegrationType
SetIntegrationType(val awsapigatewayv2.HttpIntegrationType)
PayloadFormatVersion() awsapigatewayv2.PayloadFormatVersion
SetPayloadFormatVersion(val awsapigatewayv2.PayloadFormatVersion)
// Bind this integration to the route.
Bind(options *awsapigatewayv2.HttpRouteIntegrationBindOptions) *awsapigatewayv2.HttpRouteIntegrationConfig
// Complete the binding of the integration to the route.
//
// In some cases, there is
// some additional work to do, such as adding permissions for the API to access
// the target. This work is necessary whether the integration has just been
// created for this route or it is an existing one, previously created for other
// routes. In most cases, however, concrete implementations do not need to
// override this method.
CompleteBind(_options *awsapigatewayv2.HttpRouteIntegrationBindOptions)
}
The Network Load Balancer integration resource for HTTP API.
Example:
import "github.com/aws/aws-cdk-go/awscdk"
vpc := ec2.NewVpc(this, jsii.String("VPC"))
lb := elbv2.NewNetworkLoadBalancer(this, jsii.String("lb"), &NetworkLoadBalancerProps{
Vpc: Vpc,
})
listener := lb.AddListener(jsii.String("listener"), &BaseNetworkListenerProps{
Port: jsii.Number(80),
})
listener.AddTargets(jsii.String("target"), &AddNetworkTargetsProps{
Port: jsii.Number(80),
})
httpEndpoint := apigwv2.NewHttpApi(this, jsii.String("HttpProxyPrivateApi"), &HttpApiProps{
DefaultIntegration: awscdk.NewHttpNlbIntegration(jsii.String("DefaultIntegration"), listener),
})
func NewHttpNlbIntegration ¶
func NewHttpNlbIntegration(id *string, listener awselasticloadbalancingv2.INetworkListener, props *HttpNlbIntegrationProps) HttpNlbIntegration
type HttpNlbIntegrationProps ¶
type HttpNlbIntegrationProps struct {
// The HTTP method that must be used to invoke the underlying HTTP proxy.
// Default: HttpMethod.ANY
//
Method awsapigatewayv2.HttpMethod `field:"optional" json:"method" yaml:"method"`
// Specifies how to transform HTTP requests before sending them to the backend.
// See: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html
//
// Default: undefined requests are sent to the backend unmodified.
//
ParameterMapping awsapigatewayv2.ParameterMapping `field:"optional" json:"parameterMapping" yaml:"parameterMapping"`
// Specifies the server name to verified by HTTPS when calling the backend integration.
// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-integration-tlsconfig.html
//
// Default: undefined private integration traffic will use HTTP protocol.
//
SecureServerName *string `field:"optional" json:"secureServerName" yaml:"secureServerName"`
// The maximum amount of time an integration will run before it returns without a response.
//
// Must be between 50 milliseconds and 29 seconds.
// Default: Duration.seconds(29)
//
Timeout awscdk.Duration `field:"optional" json:"timeout" yaml:"timeout"`
// The vpc link to be used for the private integration.
// Default: - a new VpcLink is created.
//
VpcLink awsapigatewayv2.IVpcLink `field:"optional" json:"vpcLink" yaml:"vpcLink"`
}
Properties to initialize `HttpNlbIntegration`.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var parameterMapping ParameterMapping
var vpcLink VpcLink
httpNlbIntegrationProps := &HttpNlbIntegrationProps{
Method: awscdk.Aws_apigatewayv2.HttpMethod_ANY,
ParameterMapping: parameterMapping,
SecureServerName: jsii.String("secureServerName"),
Timeout: cdk.Duration_Minutes(jsii.Number(30)),
VpcLink: vpcLink,
}
type HttpPrivateIntegrationOptions ¶
type HttpPrivateIntegrationOptions struct {
// The HTTP method that must be used to invoke the underlying HTTP proxy.
// Default: HttpMethod.ANY
//
Method awsapigatewayv2.HttpMethod `field:"optional" json:"method" yaml:"method"`
// Specifies how to transform HTTP requests before sending them to the backend.
// See: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html
//
// Default: undefined requests are sent to the backend unmodified.
//
ParameterMapping awsapigatewayv2.ParameterMapping `field:"optional" json:"parameterMapping" yaml:"parameterMapping"`
// Specifies the server name to verified by HTTPS when calling the backend integration.
// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-integration-tlsconfig.html
//
// Default: undefined private integration traffic will use HTTP protocol.
//
SecureServerName *string `field:"optional" json:"secureServerName" yaml:"secureServerName"`
// The maximum amount of time an integration will run before it returns without a response.
//
// Must be between 50 milliseconds and 29 seconds.
// Default: Duration.seconds(29)
//
Timeout awscdk.Duration `field:"optional" json:"timeout" yaml:"timeout"`
// The vpc link to be used for the private integration.
// Default: - a new VpcLink is created.
//
VpcLink awsapigatewayv2.IVpcLink `field:"optional" json:"vpcLink" yaml:"vpcLink"`
}
Base options for private integration.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var parameterMapping ParameterMapping
var vpcLink VpcLink
httpPrivateIntegrationOptions := &HttpPrivateIntegrationOptions{
Method: awscdk.Aws_apigatewayv2.HttpMethod_ANY,
ParameterMapping: parameterMapping,
SecureServerName: jsii.String("secureServerName"),
Timeout: cdk.Duration_Minutes(jsii.Number(30)),
VpcLink: vpcLink,
}
type HttpServiceDiscoveryIntegration ¶
type HttpServiceDiscoveryIntegration interface {
awsapigatewayv2.HttpRouteIntegration
ConnectionType() awsapigatewayv2.HttpConnectionType
SetConnectionType(val awsapigatewayv2.HttpConnectionType)
HttpMethod() awsapigatewayv2.HttpMethod
SetHttpMethod(val awsapigatewayv2.HttpMethod)
IntegrationType() awsapigatewayv2.HttpIntegrationType
SetIntegrationType(val awsapigatewayv2.HttpIntegrationType)
PayloadFormatVersion() awsapigatewayv2.PayloadFormatVersion
SetPayloadFormatVersion(val awsapigatewayv2.PayloadFormatVersion)
// Bind this integration to the route.
Bind(options *awsapigatewayv2.HttpRouteIntegrationBindOptions) *awsapigatewayv2.HttpRouteIntegrationConfig
// Complete the binding of the integration to the route.
//
// In some cases, there is
// some additional work to do, such as adding permissions for the API to access
// the target. This work is necessary whether the integration has just been
// created for this route or it is an existing one, previously created for other
// routes. In most cases, however, concrete implementations do not need to
// override this method.
CompleteBind(_options *awsapigatewayv2.HttpRouteIntegrationBindOptions)
}
The Service Discovery integration resource for HTTP API.
Example:
import servicediscovery "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
vpc := ec2.NewVpc(this, jsii.String("VPC"))
vpcLink := apigwv2.NewVpcLink(this, jsii.String("VpcLink"), &VpcLinkProps{
Vpc: Vpc,
})
namespace := servicediscovery.NewPrivateDnsNamespace(this, jsii.String("Namespace"), &PrivateDnsNamespaceProps{
Name: jsii.String("boobar.com"),
Vpc: Vpc,
})
service := namespace.CreateService(jsii.String("Service"))
httpEndpoint := apigwv2.NewHttpApi(this, jsii.String("HttpProxyPrivateApi"), &HttpApiProps{
DefaultIntegration: awscdk.NewHttpServiceDiscoveryIntegration(jsii.String("DefaultIntegration"), service, &HttpServiceDiscoveryIntegrationProps{
VpcLink: *VpcLink,
}),
})
func NewHttpServiceDiscoveryIntegration ¶
func NewHttpServiceDiscoveryIntegration(id *string, service awsservicediscovery.IService, props *HttpServiceDiscoveryIntegrationProps) HttpServiceDiscoveryIntegration
type HttpServiceDiscoveryIntegrationProps ¶
type HttpServiceDiscoveryIntegrationProps struct {
// The HTTP method that must be used to invoke the underlying HTTP proxy.
// Default: HttpMethod.ANY
//
Method awsapigatewayv2.HttpMethod `field:"optional" json:"method" yaml:"method"`
// Specifies how to transform HTTP requests before sending them to the backend.
// See: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html
//
// Default: undefined requests are sent to the backend unmodified.
//
ParameterMapping awsapigatewayv2.ParameterMapping `field:"optional" json:"parameterMapping" yaml:"parameterMapping"`
// Specifies the server name to verified by HTTPS when calling the backend integration.
// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-integration-tlsconfig.html
//
// Default: undefined private integration traffic will use HTTP protocol.
//
SecureServerName *string `field:"optional" json:"secureServerName" yaml:"secureServerName"`
// The maximum amount of time an integration will run before it returns without a response.
//
// Must be between 50 milliseconds and 29 seconds.
// Default: Duration.seconds(29)
//
Timeout awscdk.Duration `field:"optional" json:"timeout" yaml:"timeout"`
// The vpc link to be used for the private integration.
// Default: - a new VpcLink is created.
//
VpcLink awsapigatewayv2.IVpcLink `field:"optional" json:"vpcLink" yaml:"vpcLink"`
}
Properties to initialize `HttpServiceDiscoveryIntegration`.
Example:
import servicediscovery "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
vpc := ec2.NewVpc(this, jsii.String("VPC"))
vpcLink := apigwv2.NewVpcLink(this, jsii.String("VpcLink"), &VpcLinkProps{
Vpc: Vpc,
})
namespace := servicediscovery.NewPrivateDnsNamespace(this, jsii.String("Namespace"), &PrivateDnsNamespaceProps{
Name: jsii.String("boobar.com"),
Vpc: Vpc,
})
service := namespace.CreateService(jsii.String("Service"))
httpEndpoint := apigwv2.NewHttpApi(this, jsii.String("HttpProxyPrivateApi"), &HttpApiProps{
DefaultIntegration: awscdk.NewHttpServiceDiscoveryIntegration(jsii.String("DefaultIntegration"), service, &HttpServiceDiscoveryIntegrationProps{
VpcLink: *VpcLink,
}),
})
type HttpSqsIntegration ¶ added in v2.179.0
type HttpSqsIntegration interface {
awsapigatewayv2.HttpRouteIntegration
// Bind this integration to the route.
Bind(options *awsapigatewayv2.HttpRouteIntegrationBindOptions) *awsapigatewayv2.HttpRouteIntegrationConfig
// Complete the binding of the integration to the route.
//
// In some cases, there is
// some additional work to do, such as adding permissions for the API to access
// the target. This work is necessary whether the integration has just been
// created for this route or it is an existing one, previously created for other
// routes. In most cases, however, concrete implementations do not need to
// override this method.
CompleteBind(_options *awsapigatewayv2.HttpRouteIntegrationBindOptions)
}
The Sqs integration resource for HTTP API.
Example:
import sqs "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var queue IQueue
var httpApi HttpApi
// default integration (send message)
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/default"),
Methods: []HttpMethod{
apigwv2.HttpMethod_POST,
},
Integration: awscdk.NewHttpSqsIntegration(jsii.String("defaultIntegration"), &HttpSqsIntegrationProps{
Queue: *Queue,
}),
})
// send message integration
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/send-message"),
Methods: []HttpMethod{
apigwv2.HttpMethod_POST,
},
Integration: awscdk.NewHttpSqsIntegration(jsii.String("sendMessageIntegration"), &HttpSqsIntegrationProps{
Queue: *Queue,
Subtype: apigwv2.HttpIntegrationSubtype_SQS_SEND_MESSAGE,
}),
})
// receive message integration
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/receive-message"),
Methods: []HttpMethod{
apigwv2.HttpMethod_POST,
},
Integration: awscdk.NewHttpSqsIntegration(jsii.String("receiveMessageIntegration"), &HttpSqsIntegrationProps{
Queue: *Queue,
Subtype: apigwv2.HttpIntegrationSubtype_SQS_RECEIVE_MESSAGE,
}),
})
// delete message integration
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/delete-message"),
Methods: []HttpMethod{
apigwv2.HttpMethod_POST,
},
Integration: awscdk.NewHttpSqsIntegration(jsii.String("deleteMessageIntegration"), &HttpSqsIntegrationProps{
Queue: *Queue,
Subtype: apigwv2.HttpIntegrationSubtype_SQS_DELETE_MESSAGE,
}),
})
// purge queue integration
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/purge-queue"),
Methods: []HttpMethod{
apigwv2.HttpMethod_POST,
},
Integration: awscdk.NewHttpSqsIntegration(jsii.String("purgeQueueIntegration"), &HttpSqsIntegrationProps{
Queue: *Queue,
Subtype: apigwv2.HttpIntegrationSubtype_SQS_PURGE_QUEUE,
}),
})
func NewHttpSqsIntegration ¶ added in v2.179.0
func NewHttpSqsIntegration(id *string, props *HttpSqsIntegrationProps) HttpSqsIntegration
type HttpSqsIntegrationProps ¶ added in v2.179.0
type HttpSqsIntegrationProps struct {
// SQS queue that Integrates with API Gateway.
Queue awssqs.IQueue `field:"required" json:"queue" yaml:"queue"`
// Specifies how to transform HTTP requests before sending them to the backend.
// See: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-aws-services-reference.html
//
// Default: - specify `QueueUrl`. Additionally, set `MessageBody` to `$request.body.MessageBody` for `SQS_SEND_MESSAGE` subtype
// and set `ReceiptHandle` to `$request.body.ReceiptHandle` for `SQS_DELETE_MESSAGE` subtype.
//
ParameterMapping awsapigatewayv2.ParameterMapping `field:"optional" json:"parameterMapping" yaml:"parameterMapping"`
// The subtype of the HTTP integration.
//
// Only subtypes starting with SQS_ can be specified.
// Default: HttpIntegrationSubtype.SQS_SEND_MESSAGE
//
Subtype awsapigatewayv2.HttpIntegrationSubtype `field:"optional" json:"subtype" yaml:"subtype"`
}
Properties to initialize `HttpSqsIntegration`.
Example:
import sqs "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var queue IQueue
var httpApi HttpApi
// default integration (send message)
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/default"),
Methods: []HttpMethod{
apigwv2.HttpMethod_POST,
},
Integration: awscdk.NewHttpSqsIntegration(jsii.String("defaultIntegration"), &HttpSqsIntegrationProps{
Queue: *Queue,
}),
})
// send message integration
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/send-message"),
Methods: []HttpMethod{
apigwv2.HttpMethod_POST,
},
Integration: awscdk.NewHttpSqsIntegration(jsii.String("sendMessageIntegration"), &HttpSqsIntegrationProps{
Queue: *Queue,
Subtype: apigwv2.HttpIntegrationSubtype_SQS_SEND_MESSAGE,
}),
})
// receive message integration
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/receive-message"),
Methods: []HttpMethod{
apigwv2.HttpMethod_POST,
},
Integration: awscdk.NewHttpSqsIntegration(jsii.String("receiveMessageIntegration"), &HttpSqsIntegrationProps{
Queue: *Queue,
Subtype: apigwv2.HttpIntegrationSubtype_SQS_RECEIVE_MESSAGE,
}),
})
// delete message integration
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/delete-message"),
Methods: []HttpMethod{
apigwv2.HttpMethod_POST,
},
Integration: awscdk.NewHttpSqsIntegration(jsii.String("deleteMessageIntegration"), &HttpSqsIntegrationProps{
Queue: *Queue,
Subtype: apigwv2.HttpIntegrationSubtype_SQS_DELETE_MESSAGE,
}),
})
// purge queue integration
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/purge-queue"),
Methods: []HttpMethod{
apigwv2.HttpMethod_POST,
},
Integration: awscdk.NewHttpSqsIntegration(jsii.String("purgeQueueIntegration"), &HttpSqsIntegrationProps{
Queue: *Queue,
Subtype: apigwv2.HttpIntegrationSubtype_SQS_PURGE_QUEUE,
}),
})
type HttpStepFunctionsIntegration ¶ added in v2.131.0
type HttpStepFunctionsIntegration interface {
awsapigatewayv2.HttpRouteIntegration
// Bind this integration to the route.
Bind(options *awsapigatewayv2.HttpRouteIntegrationBindOptions) *awsapigatewayv2.HttpRouteIntegrationConfig
// Complete the binding of the integration to the route.
//
// In some cases, there is
// some additional work to do, such as adding permissions for the API to access
// the target. This work is necessary whether the integration has just been
// created for this route or it is an existing one, previously created for other
// routes. In most cases, however, concrete implementations do not need to
// override this method.
CompleteBind(_options *awsapigatewayv2.HttpRouteIntegrationBindOptions)
}
The StepFunctions integration resource for HTTP API.
Example:
import "github.com/aws/aws-cdk-go/awscdk"
import sfn "github.com/aws/aws-cdk-go/awscdk"
var stateMachine StateMachine
var httpApi HttpApi
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/start"),
Methods: []HttpMethod{
apigwv2.HttpMethod_POST,
},
Integration: awscdk.NewHttpStepFunctionsIntegration(jsii.String("StartExecutionIntegration"), &HttpStepFunctionsIntegrationProps{
StateMachine: *StateMachine,
Subtype: apigwv2.HttpIntegrationSubtype_STEPFUNCTIONS_START_EXECUTION,
}),
})
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/start-sync"),
Methods: []HttpMethod{
apigwv2.HttpMethod_POST,
},
Integration: awscdk.NewHttpStepFunctionsIntegration(jsii.String("StartSyncExecutionIntegration"), &HttpStepFunctionsIntegrationProps{
StateMachine: *StateMachine,
Subtype: apigwv2.HttpIntegrationSubtype_STEPFUNCTIONS_START_SYNC_EXECUTION,
}),
})
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/stop"),
Methods: []HttpMethod{
apigwv2.HttpMethod_POST,
},
Integration: awscdk.NewHttpStepFunctionsIntegration(jsii.String("StopExecutionIntegration"), &HttpStepFunctionsIntegrationProps{
StateMachine: *StateMachine,
Subtype: apigwv2.HttpIntegrationSubtype_STEPFUNCTIONS_STOP_EXECUTION,
// For the `STOP_EXECUTION` subtype, it is necessary to specify the `executionArn`.
ParameterMapping: apigwv2.NewParameterMapping().Custom(jsii.String("ExecutionArn"), jsii.String("$request.querystring.executionArn")),
}),
})
func NewHttpStepFunctionsIntegration ¶ added in v2.131.0
func NewHttpStepFunctionsIntegration(id *string, props *HttpStepFunctionsIntegrationProps) HttpStepFunctionsIntegration
type HttpStepFunctionsIntegrationProps ¶ added in v2.131.0
type HttpStepFunctionsIntegrationProps struct {
// Statemachine that Integrates with API Gateway.
StateMachine awsstepfunctions.StateMachine `field:"required" json:"stateMachine" yaml:"stateMachine"`
// Specifies how to transform HTTP requests before sending them to the backend.
//
// When the subtype is either `START_EXECUTION` or `START_SYNC_EXECUTION`,
// it is necessary to specify the `StateMachineArn`.
// Conversely, when the subtype is `STOP_EXECUTION`, the `ExecutionArn` must be specified.
// See: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html
//
// Default: - specify only `StateMachineArn`.
//
ParameterMapping awsapigatewayv2.ParameterMapping `field:"optional" json:"parameterMapping" yaml:"parameterMapping"`
// The subtype of the HTTP integration.
//
// Only subtypes starting with STEPFUNCTIONS_ can be specified.
// Default: HttpIntegrationSubtype.STEPFUNCTIONS_START_EXECUTION
//
Subtype awsapigatewayv2.HttpIntegrationSubtype `field:"optional" json:"subtype" yaml:"subtype"`
}
Properties to initialize `HttpStepFunctionsIntegration`.
Example:
import "github.com/aws/aws-cdk-go/awscdk"
import sfn "github.com/aws/aws-cdk-go/awscdk"
var stateMachine StateMachine
var httpApi HttpApi
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/start"),
Methods: []HttpMethod{
apigwv2.HttpMethod_POST,
},
Integration: awscdk.NewHttpStepFunctionsIntegration(jsii.String("StartExecutionIntegration"), &HttpStepFunctionsIntegrationProps{
StateMachine: *StateMachine,
Subtype: apigwv2.HttpIntegrationSubtype_STEPFUNCTIONS_START_EXECUTION,
}),
})
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/start-sync"),
Methods: []HttpMethod{
apigwv2.HttpMethod_POST,
},
Integration: awscdk.NewHttpStepFunctionsIntegration(jsii.String("StartSyncExecutionIntegration"), &HttpStepFunctionsIntegrationProps{
StateMachine: *StateMachine,
Subtype: apigwv2.HttpIntegrationSubtype_STEPFUNCTIONS_START_SYNC_EXECUTION,
}),
})
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/stop"),
Methods: []HttpMethod{
apigwv2.HttpMethod_POST,
},
Integration: awscdk.NewHttpStepFunctionsIntegration(jsii.String("StopExecutionIntegration"), &HttpStepFunctionsIntegrationProps{
StateMachine: *StateMachine,
Subtype: apigwv2.HttpIntegrationSubtype_STEPFUNCTIONS_STOP_EXECUTION,
// For the `STOP_EXECUTION` subtype, it is necessary to specify the `executionArn`.
ParameterMapping: apigwv2.NewParameterMapping().Custom(jsii.String("ExecutionArn"), jsii.String("$request.querystring.executionArn")),
}),
})
type HttpUrlIntegration ¶
type HttpUrlIntegration interface {
awsapigatewayv2.HttpRouteIntegration
// Bind this integration to the route.
Bind(options *awsapigatewayv2.HttpRouteIntegrationBindOptions) *awsapigatewayv2.HttpRouteIntegrationConfig
// Complete the binding of the integration to the route.
//
// In some cases, there is
// some additional work to do, such as adding permissions for the API to access
// the target. This work is necessary whether the integration has just been
// created for this route or it is an existing one, previously created for other
// routes. In most cases, however, concrete implementations do not need to
// override this method.
CompleteBind(_options *awsapigatewayv2.HttpRouteIntegrationBindOptions)
}
The HTTP Proxy integration resource for HTTP API.
Example:
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
// This function handles your auth logic
var authHandler Function
authorizer := awscdk.NewHttpLambdaAuthorizer(jsii.String("BooksAuthorizer"), authHandler, &HttpLambdaAuthorizerProps{
ResponseTypes: []HttpLambdaResponseType{
awscdk.HttpLambdaResponseType_SIMPLE,
},
})
api := apigwv2.NewHttpApi(this, jsii.String("HttpApi"))
api.AddRoutes(&AddRoutesOptions{
Integration: awscdk.NewHttpUrlIntegration(jsii.String("BooksIntegration"), jsii.String("https://get-books-proxy.example.com")),
Path: jsii.String("/books"),
Authorizer: Authorizer,
})
func NewHttpUrlIntegration ¶
func NewHttpUrlIntegration(id *string, url *string, props *HttpUrlIntegrationProps) HttpUrlIntegration
type HttpUrlIntegrationProps ¶
type HttpUrlIntegrationProps struct {
// The HTTP method that must be used to invoke the underlying HTTP proxy.
// Default: HttpMethod.ANY
//
Method awsapigatewayv2.HttpMethod `field:"optional" json:"method" yaml:"method"`
// Specifies how to transform HTTP requests before sending them to the backend.
// See: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html
//
// Default: undefined requests are sent to the backend unmodified.
//
ParameterMapping awsapigatewayv2.ParameterMapping `field:"optional" json:"parameterMapping" yaml:"parameterMapping"`
// The maximum amount of time an integration will run before it returns without a response.
//
// Must be between 50 milliseconds and 29 seconds.
// Default: Duration.seconds(29)
//
Timeout awscdk.Duration `field:"optional" json:"timeout" yaml:"timeout"`
}
Properties to initialize a new `HttpProxyIntegration`.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var parameterMapping ParameterMapping
httpUrlIntegrationProps := &HttpUrlIntegrationProps{
Method: awscdk.Aws_apigatewayv2.HttpMethod_ANY,
ParameterMapping: parameterMapping,
Timeout: cdk.Duration_Minutes(jsii.Number(30)),
}
type WebSocketAwsIntegration ¶ added in v2.123.0
type WebSocketAwsIntegration interface {
awsapigatewayv2.WebSocketRouteIntegration
// Bind this integration to the route.
Bind(options *awsapigatewayv2.WebSocketRouteIntegrationBindOptions) *awsapigatewayv2.WebSocketRouteIntegrationConfig
}
AWS WebSocket AWS Type Integration.
Example:
import "github.com/aws/aws-cdk-go/awscdk"
import dynamodb "github.com/aws/aws-cdk-go/awscdk"
import iam "github.com/aws/aws-cdk-go/awscdk"
var apiRole Role
var table Table
webSocketApi := apigwv2.NewWebSocketApi(this, jsii.String("mywsapi"))
apigwv2.NewWebSocketStage(this, jsii.String("mystage"), &WebSocketStageProps{
WebSocketApi: WebSocketApi,
StageName: jsii.String("dev"),
AutoDeploy: jsii.Boolean(true),
})
webSocketApi.AddRoute(jsii.String("$connect"), &WebSocketRouteOptions{
Integration: awscdk.NewWebSocketAwsIntegration(jsii.String("DynamodbPutItem"), &WebSocketAwsIntegrationProps{
IntegrationUri: fmt.Sprintf("arn:aws:apigateway:%v:dynamodb:action/PutItem", this.Region),
IntegrationMethod: apigwv2.HttpMethod_POST,
CredentialsRole: apiRole,
RequestTemplates: map[string]*string{
"application/json": JSON.stringify(map[string]interface{}{
"TableName": table.tableName,
"Item": map[string]map[string]*string{
"id": map[string]*string{
"S": jsii.String("$context.requestId"),
},
},
}),
},
}),
})
func NewWebSocketAwsIntegration ¶ added in v2.123.0
func NewWebSocketAwsIntegration(id *string, props *WebSocketAwsIntegrationProps) WebSocketAwsIntegration
type WebSocketAwsIntegrationProps ¶ added in v2.123.0
type WebSocketAwsIntegrationProps struct {
// Specifies the integration's HTTP method type.
IntegrationMethod *string `field:"required" json:"integrationMethod" yaml:"integrationMethod"`
// Integration URI.
IntegrationUri *string `field:"required" json:"integrationUri" yaml:"integrationUri"`
// Specifies how to handle response payload content type conversions.
// Default: - The response payload will be passed through from the integration response to
// the route response or method response without modification.
//
ContentHandling awsapigatewayv2.ContentHandling `field:"optional" json:"contentHandling" yaml:"contentHandling"`
// Specifies the credentials role required for the integration.
// Default: - No credential role provided.
//
CredentialsRole awsiam.IRole `field:"optional" json:"credentialsRole" yaml:"credentialsRole"`
// Specifies the pass-through behavior for incoming requests based on the Content-Type header in the request, and the available mapping templates specified as the requestTemplates property on the Integration resource.
//
// There are three valid values: WHEN_NO_MATCH, WHEN_NO_TEMPLATES, and
// NEVER.
// Default: - No passthrough behavior required.
//
PassthroughBehavior awsapigatewayv2.PassthroughBehavior `field:"optional" json:"passthroughBehavior" yaml:"passthroughBehavior"`
// The request parameters that API Gateway sends with the backend request.
//
// Specify request parameters as key-value pairs (string-to-string
// mappings), with a destination as the key and a source as the value.
// Default: - No request parameter provided to the integration.
//
RequestParameters *map[string]*string `field:"optional" json:"requestParameters" yaml:"requestParameters"`
// A map of Apache Velocity templates that are applied on the request payload.
//
// “`
// { "application/json": "{ \"statusCode\": 200 }" }
// “`.
// Default: - No request template provided to the integration.
//
RequestTemplates *map[string]*string `field:"optional" json:"requestTemplates" yaml:"requestTemplates"`
// The template selection expression for the integration.
// Default: - No template selection expression provided.
//
TemplateSelectionExpression *string `field:"optional" json:"templateSelectionExpression" yaml:"templateSelectionExpression"`
// The maximum amount of time an integration will run before it returns without a response.
//
// Must be between 50 milliseconds and 29 seconds.
// Default: Duration.seconds(29)
//
Timeout awscdk.Duration `field:"optional" json:"timeout" yaml:"timeout"`
}
Props for AWS type integration for a WebSocket Api.
Example:
import "github.com/aws/aws-cdk-go/awscdk"
import dynamodb "github.com/aws/aws-cdk-go/awscdk"
import iam "github.com/aws/aws-cdk-go/awscdk"
var apiRole Role
var table Table
webSocketApi := apigwv2.NewWebSocketApi(this, jsii.String("mywsapi"))
apigwv2.NewWebSocketStage(this, jsii.String("mystage"), &WebSocketStageProps{
WebSocketApi: WebSocketApi,
StageName: jsii.String("dev"),
AutoDeploy: jsii.Boolean(true),
})
webSocketApi.AddRoute(jsii.String("$connect"), &WebSocketRouteOptions{
Integration: awscdk.NewWebSocketAwsIntegration(jsii.String("DynamodbPutItem"), &WebSocketAwsIntegrationProps{
IntegrationUri: fmt.Sprintf("arn:aws:apigateway:%v:dynamodb:action/PutItem", this.Region),
IntegrationMethod: apigwv2.HttpMethod_POST,
CredentialsRole: apiRole,
RequestTemplates: map[string]*string{
"application/json": JSON.stringify(map[string]interface{}{
"TableName": table.tableName,
"Item": map[string]map[string]*string{
"id": map[string]*string{
"S": jsii.String("$context.requestId"),
},
},
}),
},
}),
})
type WebSocketLambdaIntegration ¶
type WebSocketLambdaIntegration interface {
awsapigatewayv2.WebSocketRouteIntegration
// Bind this integration to the route.
Bind(options *awsapigatewayv2.WebSocketRouteIntegrationBindOptions) *awsapigatewayv2.WebSocketRouteIntegrationConfig
}
Lambda WebSocket Integration.
Example:
import "github.com/aws/aws-cdk-go/awscdk"
var messageHandler Function
webSocketApi := apigwv2.NewWebSocketApi(this, jsii.String("mywsapi"))
apigwv2.NewWebSocketStage(this, jsii.String("mystage"), &WebSocketStageProps{
WebSocketApi: WebSocketApi,
StageName: jsii.String("dev"),
AutoDeploy: jsii.Boolean(true),
})
webSocketApi.AddRoute(jsii.String("sendMessage"), &WebSocketRouteOptions{
Integration: awscdk.NewWebSocketLambdaIntegration(jsii.String("SendMessageIntegration"), messageHandler),
})
func NewWebSocketLambdaIntegration ¶
func NewWebSocketLambdaIntegration(id *string, handler awslambda.IFunction, props *WebSocketLambdaIntegrationProps) WebSocketLambdaIntegration
type WebSocketLambdaIntegrationProps ¶ added in v2.134.0
type WebSocketLambdaIntegrationProps struct {
// Specifies how to handle response payload content type conversions.
// Default: - The response payload will be passed through from the integration response to
// the route response or method response without modification.
//
ContentHandling awsapigatewayv2.ContentHandling `field:"optional" json:"contentHandling" yaml:"contentHandling"`
// The maximum amount of time an integration will run before it returns without a response.
//
// Must be between 50 milliseconds and 29 seconds.
// Default: Duration.seconds(29)
//
Timeout awscdk.Duration `field:"optional" json:"timeout" yaml:"timeout"`
}
Props for Lambda type integration for a WebSocket Api.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
webSocketLambdaIntegrationProps := &WebSocketLambdaIntegrationProps{
ContentHandling: awscdk.Aws_apigatewayv2.ContentHandling_CONVERT_TO_BINARY,
Timeout: cdk.Duration_Minutes(jsii.Number(30)),
}
type WebSocketMockIntegration ¶
type WebSocketMockIntegration interface {
awsapigatewayv2.WebSocketRouteIntegration
// Bind this integration to the route.
Bind(options *awsapigatewayv2.WebSocketRouteIntegrationBindOptions) *awsapigatewayv2.WebSocketRouteIntegrationConfig
}
Mock WebSocket Integration.
Example:
import "github.com/aws/aws-cdk-go/awscdk"
webSocketApi := apigwv2.NewWebSocketApi(this, jsii.String("mywsapi"))
apigwv2.NewWebSocketStage(this, jsii.String("mystage"), &WebSocketStageProps{
WebSocketApi: WebSocketApi,
StageName: jsii.String("dev"),
AutoDeploy: jsii.Boolean(true),
})
webSocketApi.AddRoute(jsii.String("sendMessage"), &WebSocketRouteOptions{
Integration: awscdk.NewWebSocketMockIntegration(jsii.String("DefaultIntegration"), &WebSocketMockIntegrationProps{
RequestTemplates: map[string]*string{
"application/json": JSON.stringify(map[string]*f64{
"statusCode": jsii.Number(200),
}),
},
TemplateSelectionExpression: jsii.String("\\$default"),
}),
ReturnResponse: jsii.Boolean(true),
})
func NewWebSocketMockIntegration ¶
func NewWebSocketMockIntegration(id *string, props *WebSocketMockIntegrationProps) WebSocketMockIntegration
type WebSocketMockIntegrationProps ¶ added in v2.176.0
type WebSocketMockIntegrationProps struct {
// A map of Apache Velocity templates that are applied on the request payload.
//
// “`
// { "application/json": "{ \"statusCode\": 200 }" }
// “`.
// See: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-mapping-template-reference.html
//
// Default: - No request template provided to the integration.
//
RequestTemplates *map[string]*string `field:"optional" json:"requestTemplates" yaml:"requestTemplates"`
// The template selection expression for the integration.
// Default: - No template selection expression provided.
//
TemplateSelectionExpression *string `field:"optional" json:"templateSelectionExpression" yaml:"templateSelectionExpression"`
}
Props for Mock type integration for a WebSocket Api.
Example:
import "github.com/aws/aws-cdk-go/awscdk"
webSocketApi := apigwv2.NewWebSocketApi(this, jsii.String("mywsapi"))
apigwv2.NewWebSocketStage(this, jsii.String("mystage"), &WebSocketStageProps{
WebSocketApi: WebSocketApi,
StageName: jsii.String("dev"),
AutoDeploy: jsii.Boolean(true),
})
webSocketApi.AddRoute(jsii.String("sendMessage"), &WebSocketRouteOptions{
Integration: awscdk.NewWebSocketMockIntegration(jsii.String("DefaultIntegration"), &WebSocketMockIntegrationProps{
RequestTemplates: map[string]*string{
"application/json": JSON.stringify(map[string]*f64{
"statusCode": jsii.Number(200),
}),
},
TemplateSelectionExpression: jsii.String("\\$default"),
}),
ReturnResponse: jsii.Boolean(true),
})
Source Files
¶
- HttpAlbIntegration.go
- HttpAlbIntegrationProps.go
- HttpAlbIntegration__checks.go
- HttpLambdaIntegration.go
- HttpLambdaIntegrationProps.go
- HttpLambdaIntegration__checks.go
- HttpNlbIntegration.go
- HttpNlbIntegrationProps.go
- HttpNlbIntegration__checks.go
- HttpPrivateIntegrationOptions.go
- HttpServiceDiscoveryIntegration.go
- HttpServiceDiscoveryIntegrationProps.go
- HttpServiceDiscoveryIntegration__checks.go
- HttpSqsIntegration.go
- HttpSqsIntegrationProps.go
- HttpSqsIntegration__checks.go
- HttpStepFunctionsIntegration.go
- HttpStepFunctionsIntegrationProps.go
- HttpStepFunctionsIntegration__checks.go
- HttpUrlIntegration.go
- HttpUrlIntegrationProps.go
- HttpUrlIntegration__checks.go
- WebSocketAwsIntegration.go
- WebSocketAwsIntegrationProps.go
- WebSocketAwsIntegration__checks.go
- WebSocketLambdaIntegration.go
- WebSocketLambdaIntegrationProps.go
- WebSocketLambdaIntegration__checks.go
- WebSocketMockIntegration.go
- WebSocketMockIntegrationProps.go
- WebSocketMockIntegration__checks.go
- main.go