awscdkapigatewayv2integrationsalpha

package module
v2.20.0-alpha.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 8 Imported by: 6

README

AWS APIGatewayv2 Integrations


The APIs of higher level constructs in this module are experimental and under active development. They are subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model and breaking changes will be announced in the release notes. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.


Table of Contents

HTTP APIs

Integrations connect a route to backend resources. HTTP APIs support Lambda proxy, AWS service, and HTTP proxy integrations. HTTP proxy integrations are also known as private integrations.

Lambda

Lambda integrations enable integrating an HTTP API route with a Lambda function. When a client invokes the route, the API Gateway service forwards the request to the Lambda function and returns the function's response to the client.

The API Gateway service will invoke the lambda function with an event payload of a specific format. The service expects the function to respond in a specific format. The details on this format is available at Working with AWS Lambda proxy integrations.

The following code configures a route GET /books with a Lambda proxy integration.

import { HttpLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha';

declare const booksDefaultFn: lambda.Function;
const booksIntegration = new HttpLambdaIntegration('BooksIntegration', booksDefaultFn);

const httpApi = new apigwv2.HttpApi(this, 'HttpApi');

httpApi.addRoutes({
  path: '/books',
  methods: [ apigwv2.HttpMethod.GET ],
  integration: booksIntegration,
});
HTTP Proxy

HTTP Proxy integrations enables connecting an HTTP API route to a publicly routable HTTP endpoint. When a client invokes the route, the API Gateway service forwards the entire request and response between the API Gateway endpoint and the integrating HTTP endpoint. More information can be found at Working with HTTP proxy integrations.

The following code configures a route GET /books with an HTTP proxy integration to an HTTP endpoint get-books-proxy.myproxy.internal.

import { HttpUrlIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha';

const booksIntegration = new HttpUrlIntegration('BooksIntegration', 'https://get-books-proxy.myproxy.internal');

const httpApi = new apigwv2.HttpApi(this, 'HttpApi');

httpApi.addRoutes({
  path: '/books',
  methods: [ apigwv2.HttpMethod.GET ],
  integration: booksIntegration,
});
Private Integration

Private integrations enable integrating an HTTP API route with private resources in a VPC, such as Application Load Balancers or Amazon ECS container-based applications. Using private integrations, resources in a VPC can be exposed for access by clients outside of the VPC.

The following integrations are supported for private resources in a VPC.

Application Load Balancer

The following code is a basic application load balancer private integration of HTTP API:

import { HttpAlbIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha';

const vpc = new ec2.Vpc(this, 'VPC');
const lb = new elbv2.ApplicationLoadBalancer(this, 'lb', { vpc });
const listener = lb.addListener('listener', { port: 80 });
listener.addTargets('target', {
  port: 80,
});

const httpEndpoint = new apigwv2.HttpApi(this, 'HttpProxyPrivateApi', {
  defaultIntegration: new HttpAlbIntegration('DefaultIntegration', listener),
});

When an imported load balancer is used, the vpc option must be specified for HttpAlbIntegration.

Network Load Balancer

The following code is a basic network load balancer private integration of HTTP API:

import { HttpNlbIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha';

const vpc = new ec2.Vpc(this, 'VPC');
const lb = new elbv2.NetworkLoadBalancer(this, 'lb', { vpc });
const listener = lb.addListener('listener', { port: 80 });
listener.addTargets('target', {
  port: 80,
});

const httpEndpoint = new apigwv2.HttpApi(this, 'HttpProxyPrivateApi', {
  defaultIntegration: new HttpNlbIntegration('DefaultIntegration', listener),
});

When an imported load balancer is used, the vpc option must be specified for HttpNlbIntegration.

Cloud Map Service Discovery

The following code is a basic discovery service private integration of HTTP API:

import * as servicediscovery from 'aws-cdk-lib/aws-servicediscovery';
import { HttpServiceDiscoveryIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha';

const vpc = new ec2.Vpc(this, 'VPC');
const vpcLink = new apigwv2.VpcLink(this, 'VpcLink', { vpc });
const namespace = new servicediscovery.PrivateDnsNamespace(this, 'Namespace', {
  name: 'boobar.com',
  vpc,
});
const service = namespace.createService('Service');

const httpEndpoint = new apigwv2.HttpApi(this, 'HttpProxyPrivateApi', {
  defaultIntegration: new HttpServiceDiscoveryIntegration('DefaultIntegration', service, {
    vpcLink,
  }),
});
Request Parameters

Request parameter mapping allows API requests from clients to be modified before they reach backend integrations. Parameter mapping can be used to specify modifications to request parameters. See Transforming API requests and responses.

The following example creates a new header - header2 - as a copy of header1 and removes header1.

import { HttpAlbIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha';

declare const lb: elbv2.ApplicationLoadBalancer;
const listener = lb.addListener('listener', { port: 80 });
listener.addTargets('target', {
  port: 80,
});

const httpEndpoint = new apigwv2.HttpApi(this, 'HttpProxyPrivateApi', {
  defaultIntegration: new HttpAlbIntegration('DefaultIntegration', listener, {
    parameterMapping: new apigwv2.ParameterMapping()
      .appendHeader('header2', apigwv2.MappingValue.requestHeader('header1'))
      .removeHeader('header1'),
  }),
});

To add mapping keys and values not yet supported by the CDK, use the custom() method:

import { HttpAlbIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha';

declare const lb: elbv2.ApplicationLoadBalancer;
const listener = lb.addListener('listener', { port: 80 });
listener.addTargets('target', {
  port: 80,
});

const httpEndpoint = new apigwv2.HttpApi(this, 'HttpProxyPrivateApi', {
  defaultIntegration: new HttpAlbIntegration('DefaultIntegration', listener, {
    parameterMapping: new apigwv2.ParameterMapping().custom('myKey', 'myValue'),
  }),
});

WebSocket APIs

WebSocket integrations connect a route to backend resources. The following integrations are supported in the CDK.

Lambda WebSocket Integration

Lambda integrations enable integrating a WebSocket API route with a Lambda function. When a client connects/disconnects or sends message specific to a route, the API Gateway service forwards the request to the Lambda function

The API Gateway service will invoke the lambda function with an event payload of a specific format.

The following code configures a sendmessage route with a Lambda integration

import { WebSocketLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha';

const webSocketApi = new apigwv2.WebSocketApi(this, 'mywsapi');
new apigwv2.WebSocketStage(this, 'mystage', {
  webSocketApi,
  stageName: 'dev',
  autoDeploy: true,
});

declare const messageHandler: lambda.Function;
webSocketApi.addRoute('sendmessage', {
  integration: new WebSocketLambdaIntegration('SendMessageIntegration', messageHandler),
});

Documentation

Overview

Integrations for AWS APIGateway V2

Index

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)

Experimental.

func NewHttpLambdaIntegration_Override

func NewHttpLambdaIntegration_Override(h HttpLambdaIntegration, id *string, handler awslambda.IFunction, props *HttpLambdaIntegrationProps)

Experimental.

func NewHttpNlbIntegration_Override

func NewHttpNlbIntegration_Override(h HttpNlbIntegration, id *string, listener awselasticloadbalancingv2.INetworkListener, props *HttpNlbIntegrationProps)

Experimental.

func NewHttpServiceDiscoveryIntegration_Override

func NewHttpServiceDiscoveryIntegration_Override(h HttpServiceDiscoveryIntegration, id *string, service awsservicediscovery.IService, props *HttpServiceDiscoveryIntegrationProps)

Experimental.

func NewHttpUrlIntegration_Override

func NewHttpUrlIntegration_Override(h HttpUrlIntegration, id *string, url *string, props *HttpUrlIntegrationProps)

Experimental.

func NewWebSocketLambdaIntegration_Override

func NewWebSocketLambdaIntegration_Override(w WebSocketLambdaIntegration, id *string, handler awslambda.IFunction)

Experimental.

func NewWebSocketMockIntegration_Override

func NewWebSocketMockIntegration_Override(w WebSocketMockIntegration, id *string)

Experimental.

Types

type HttpAlbIntegration

type HttpAlbIntegration interface {
	awscdkapigatewayv2alpha.HttpRouteIntegration
	// Experimental.
	ConnectionType() awscdkapigatewayv2alpha.HttpConnectionType
	// Experimental.
	SetConnectionType(val awscdkapigatewayv2alpha.HttpConnectionType)
	// Experimental.
	HttpMethod() awscdkapigatewayv2alpha.HttpMethod
	// Experimental.
	SetHttpMethod(val awscdkapigatewayv2alpha.HttpMethod)
	// Experimental.
	IntegrationType() awscdkapigatewayv2alpha.HttpIntegrationType
	// Experimental.
	SetIntegrationType(val awscdkapigatewayv2alpha.HttpIntegrationType)
	// Experimental.
	PayloadFormatVersion() awscdkapigatewayv2alpha.PayloadFormatVersion
	// Experimental.
	SetPayloadFormatVersion(val awscdkapigatewayv2alpha.PayloadFormatVersion)
	// Bind this integration to the route.
	// Experimental.
	Bind(options *awscdkapigatewayv2alpha.HttpRouteIntegrationBindOptions) *awscdkapigatewayv2alpha.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.
	// Experimental.
	CompleteBind(_options *awscdkapigatewayv2alpha.HttpRouteIntegrationBindOptions)
}

The Application Load Balancer integration resource for HTTP API.

Example:

import awscdkapigatewayv2integrationsalpha "github.com/aws/aws-cdk-go/awscdkapigatewayv2integrationsalpha"type HttpAlbIntegration awscdkapigatewayv2integrationsalpha.HttpAlbIntegration

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: NewHttpAlbIntegration(jsii.String("DefaultIntegration"), listener, &httpAlbIntegrationProps{
		parameterMapping: apigwv2.NewParameterMapping().custom(jsii.String("myKey"), jsii.String("myValue")),
	}),
})

Experimental.

func NewHttpAlbIntegration

Experimental.

type HttpAlbIntegrationProps

type HttpAlbIntegrationProps struct {
	// The HTTP method that must be used to invoke the underlying HTTP proxy.
	// Experimental.
	Method awscdkapigatewayv2alpha.HttpMethod `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
	//
	// Experimental.
	ParameterMapping awscdkapigatewayv2alpha.ParameterMapping `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
	//
	// Experimental.
	SecureServerName *string `json:"secureServerName" yaml:"secureServerName"`
	// The vpc link to be used for the private integration.
	// Experimental.
	VpcLink awscdkapigatewayv2alpha.IVpcLink `json:"vpcLink" yaml:"vpcLink"`
}

Properties to initialize `HttpAlbIntegration`.

Example:

import awscdkapigatewayv2integrationsalpha "github.com/aws/aws-cdk-go/awscdkapigatewayv2integrationsalpha"type HttpAlbIntegration awscdkapigatewayv2integrationsalpha.HttpAlbIntegration

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: NewHttpAlbIntegration(jsii.String("DefaultIntegration"), listener, &httpAlbIntegrationProps{
		parameterMapping: apigwv2.NewParameterMapping().appendHeader(jsii.String("header2"), apigwv2.mappingValue.requestHeader(jsii.String("header1"))).removeHeader(jsii.String("header1")),
	}),
})

Experimental.

type HttpLambdaIntegration

type HttpLambdaIntegration interface {
	awscdkapigatewayv2alpha.HttpRouteIntegration
	// Bind this integration to the route.
	// Experimental.
	Bind(_arg *awscdkapigatewayv2alpha.HttpRouteIntegrationBindOptions) *awscdkapigatewayv2alpha.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.
	// Experimental.
	CompleteBind(options *awscdkapigatewayv2alpha.HttpRouteIntegrationBindOptions)
}

The Lambda Proxy integration resource for HTTP API.

Example:

import awscdkapigatewayv2integrationsalpha "github.com/aws/aws-cdk-go/awscdkapigatewayv2integrationsalpha"type HttpLambdaIntegration awscdkapigatewayv2integrationsalpha.HttpLambdaIntegration

var booksDefaultFn function
booksIntegration := NewHttpLambdaIntegration(jsii.String("BooksIntegration"), booksDefaultFn)

httpApi := apigwv2.NewHttpApi(this, jsii.String("HttpApi"))

httpApi.addRoutes(&addRoutesOptions{
	path: jsii.String("/books"),
	methods: []httpMethod{
		apigwv2.*httpMethod_GET,
	},
	integration: booksIntegration,
})

Experimental.

func NewHttpLambdaIntegration

func NewHttpLambdaIntegration(id *string, handler awslambda.IFunction, props *HttpLambdaIntegrationProps) HttpLambdaIntegration

Experimental.

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
	//
	// Experimental.
	ParameterMapping awscdkapigatewayv2alpha.ParameterMapping `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
	//
	// Experimental.
	PayloadFormatVersion awscdkapigatewayv2alpha.PayloadFormatVersion `json:"payloadFormatVersion" yaml:"payloadFormatVersion"`
}

Lambda Proxy integration properties.

Example:

import apigatewayv2_alpha "github.com/aws/aws-cdk-go/awscdkapigatewayv2alpha"import apigatewayv2_integrations_alpha "github.com/aws/aws-cdk-go/awscdkapigatewayv2integrationsalpha"

var parameterMapping parameterMapping
var payloadFormatVersion payloadFormatVersion
httpLambdaIntegrationProps := &httpLambdaIntegrationProps{
	parameterMapping: parameterMapping,
	payloadFormatVersion: payloadFormatVersion,
}

Experimental.

type HttpNlbIntegration

type HttpNlbIntegration interface {
	awscdkapigatewayv2alpha.HttpRouteIntegration
	// Experimental.
	ConnectionType() awscdkapigatewayv2alpha.HttpConnectionType
	// Experimental.
	SetConnectionType(val awscdkapigatewayv2alpha.HttpConnectionType)
	// Experimental.
	HttpMethod() awscdkapigatewayv2alpha.HttpMethod
	// Experimental.
	SetHttpMethod(val awscdkapigatewayv2alpha.HttpMethod)
	// Experimental.
	IntegrationType() awscdkapigatewayv2alpha.HttpIntegrationType
	// Experimental.
	SetIntegrationType(val awscdkapigatewayv2alpha.HttpIntegrationType)
	// Experimental.
	PayloadFormatVersion() awscdkapigatewayv2alpha.PayloadFormatVersion
	// Experimental.
	SetPayloadFormatVersion(val awscdkapigatewayv2alpha.PayloadFormatVersion)
	// Bind this integration to the route.
	// Experimental.
	Bind(options *awscdkapigatewayv2alpha.HttpRouteIntegrationBindOptions) *awscdkapigatewayv2alpha.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.
	// Experimental.
	CompleteBind(_options *awscdkapigatewayv2alpha.HttpRouteIntegrationBindOptions)
}

The Network Load Balancer integration resource for HTTP API.

Example:

import awscdkapigatewayv2integrationsalpha "github.com/aws/aws-cdk-go/awscdkapigatewayv2integrationsalpha"type HttpNlbIntegration awscdkapigatewayv2integrationsalpha.HttpNlbIntegration

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: NewHttpNlbIntegration(jsii.String("DefaultIntegration"), listener),
})

Experimental.

func NewHttpNlbIntegration

Experimental.

type HttpNlbIntegrationProps

type HttpNlbIntegrationProps struct {
	// The HTTP method that must be used to invoke the underlying HTTP proxy.
	// Experimental.
	Method awscdkapigatewayv2alpha.HttpMethod `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
	//
	// Experimental.
	ParameterMapping awscdkapigatewayv2alpha.ParameterMapping `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
	//
	// Experimental.
	SecureServerName *string `json:"secureServerName" yaml:"secureServerName"`
	// The vpc link to be used for the private integration.
	// Experimental.
	VpcLink awscdkapigatewayv2alpha.IVpcLink `json:"vpcLink" yaml:"vpcLink"`
}

Properties to initialize `HttpNlbIntegration`.

Example:

import apigatewayv2_alpha "github.com/aws/aws-cdk-go/awscdkapigatewayv2alpha"import apigatewayv2_integrations_alpha "github.com/aws/aws-cdk-go/awscdkapigatewayv2integrationsalpha"

var parameterMapping parameterMapping
var vpcLink vpcLink
httpNlbIntegrationProps := &httpNlbIntegrationProps{
	method: apigatewayv2_alpha.httpMethod_ANY,
	parameterMapping: parameterMapping,
	secureServerName: jsii.String("secureServerName"),
	vpcLink: vpcLink,
}

Experimental.

type HttpPrivateIntegrationOptions

type HttpPrivateIntegrationOptions struct {
	// The HTTP method that must be used to invoke the underlying HTTP proxy.
	// Experimental.
	Method awscdkapigatewayv2alpha.HttpMethod `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
	//
	// Experimental.
	ParameterMapping awscdkapigatewayv2alpha.ParameterMapping `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
	//
	// Experimental.
	SecureServerName *string `json:"secureServerName" yaml:"secureServerName"`
	// The vpc link to be used for the private integration.
	// Experimental.
	VpcLink awscdkapigatewayv2alpha.IVpcLink `json:"vpcLink" yaml:"vpcLink"`
}

Base options for private integration.

Example:

import apigatewayv2_alpha "github.com/aws/aws-cdk-go/awscdkapigatewayv2alpha"import apigatewayv2_integrations_alpha "github.com/aws/aws-cdk-go/awscdkapigatewayv2integrationsalpha"

var parameterMapping parameterMapping
var vpcLink vpcLink
httpPrivateIntegrationOptions := &httpPrivateIntegrationOptions{
	method: apigatewayv2_alpha.httpMethod_ANY,
	parameterMapping: parameterMapping,
	secureServerName: jsii.String("secureServerName"),
	vpcLink: vpcLink,
}

Experimental.

type HttpServiceDiscoveryIntegration

type HttpServiceDiscoveryIntegration interface {
	awscdkapigatewayv2alpha.HttpRouteIntegration
	// Experimental.
	ConnectionType() awscdkapigatewayv2alpha.HttpConnectionType
	// Experimental.
	SetConnectionType(val awscdkapigatewayv2alpha.HttpConnectionType)
	// Experimental.
	HttpMethod() awscdkapigatewayv2alpha.HttpMethod
	// Experimental.
	SetHttpMethod(val awscdkapigatewayv2alpha.HttpMethod)
	// Experimental.
	IntegrationType() awscdkapigatewayv2alpha.HttpIntegrationType
	// Experimental.
	SetIntegrationType(val awscdkapigatewayv2alpha.HttpIntegrationType)
	// Experimental.
	PayloadFormatVersion() awscdkapigatewayv2alpha.PayloadFormatVersion
	// Experimental.
	SetPayloadFormatVersion(val awscdkapigatewayv2alpha.PayloadFormatVersion)
	// Bind this integration to the route.
	// Experimental.
	Bind(_arg *awscdkapigatewayv2alpha.HttpRouteIntegrationBindOptions) *awscdkapigatewayv2alpha.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.
	// Experimental.
	CompleteBind(_options *awscdkapigatewayv2alpha.HttpRouteIntegrationBindOptions)
}

The Service Discovery integration resource for HTTP API.

Example:

import servicediscovery "github.com/aws/aws-cdk-go/awscdk"import awscdkapigatewayv2integrationsalpha "github.com/aws/aws-cdk-go/awscdkapigatewayv2integrationsalpha"type HttpServiceDiscoveryIntegration awscdkapigatewayv2integrationsalpha.HttpServiceDiscoveryIntegration

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: NewHttpServiceDiscoveryIntegration(jsii.String("DefaultIntegration"), service, &httpServiceDiscoveryIntegrationProps{
		vpcLink: vpcLink,
	}),
})

Experimental.

type HttpServiceDiscoveryIntegrationProps

type HttpServiceDiscoveryIntegrationProps struct {
	// The HTTP method that must be used to invoke the underlying HTTP proxy.
	// Experimental.
	Method awscdkapigatewayv2alpha.HttpMethod `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
	//
	// Experimental.
	ParameterMapping awscdkapigatewayv2alpha.ParameterMapping `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
	//
	// Experimental.
	SecureServerName *string `json:"secureServerName" yaml:"secureServerName"`
	// The vpc link to be used for the private integration.
	// Experimental.
	VpcLink awscdkapigatewayv2alpha.IVpcLink `json:"vpcLink" yaml:"vpcLink"`
}

Properties to initialize `HttpServiceDiscoveryIntegration`.

Example:

import servicediscovery "github.com/aws/aws-cdk-go/awscdk"import awscdkapigatewayv2integrationsalpha "github.com/aws/aws-cdk-go/awscdkapigatewayv2integrationsalpha"type HttpServiceDiscoveryIntegration awscdkapigatewayv2integrationsalpha.HttpServiceDiscoveryIntegration

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: NewHttpServiceDiscoveryIntegration(jsii.String("DefaultIntegration"), service, &httpServiceDiscoveryIntegrationProps{
		vpcLink: vpcLink,
	}),
})

Experimental.

type HttpUrlIntegration

type HttpUrlIntegration interface {
	awscdkapigatewayv2alpha.HttpRouteIntegration
	// Bind this integration to the route.
	// Experimental.
	Bind(_arg *awscdkapigatewayv2alpha.HttpRouteIntegrationBindOptions) *awscdkapigatewayv2alpha.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.
	// Experimental.
	CompleteBind(_options *awscdkapigatewayv2alpha.HttpRouteIntegrationBindOptions)
}

The HTTP Proxy integration resource for HTTP API.

Example:

import awscdkapigatewayv2authorizersalpha "github.com/aws/aws-cdk-go/awscdkapigatewayv2authorizersalpha"type HttpLambdaAuthorizer awscdkapigatewayv2authorizersalpha.HttpLambdaAuthorizer
type HttpLambdaResponseType awscdkapigatewayv2authorizersalpha.HttpLambdaResponseTypeimport awscdkapigatewayv2integrationsalpha "github.com/aws/aws-cdk-go/awscdkapigatewayv2integrationsalpha"type HttpUrlIntegration awscdkapigatewayv2integrationsalpha.HttpUrlIntegration

// This function handles your auth logic
var authHandler function

authorizer := NewHttpLambdaAuthorizer(jsii.String("BooksAuthorizer"), authHandler, &httpLambdaAuthorizerProps{
	responseTypes: []httpLambdaResponseType{
		httpLambdaResponseType_SIMPLE,
	},
})

api := apigwv2.NewHttpApi(this, jsii.String("HttpApi"))

api.addRoutes(&addRoutesOptions{
	integration: NewHttpUrlIntegration(jsii.String("BooksIntegration"), jsii.String("https://get-books-proxy.myproxy.internal")),
	path: jsii.String("/books"),
	authorizer: authorizer,
})

Experimental.

func NewHttpUrlIntegration

func NewHttpUrlIntegration(id *string, url *string, props *HttpUrlIntegrationProps) HttpUrlIntegration

Experimental.

type HttpUrlIntegrationProps

type HttpUrlIntegrationProps struct {
	// The HTTP method that must be used to invoke the underlying HTTP proxy.
	// Experimental.
	Method awscdkapigatewayv2alpha.HttpMethod `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
	//
	// Experimental.
	ParameterMapping awscdkapigatewayv2alpha.ParameterMapping `json:"parameterMapping" yaml:"parameterMapping"`
}

Properties to initialize a new `HttpProxyIntegration`.

Example:

import apigatewayv2_alpha "github.com/aws/aws-cdk-go/awscdkapigatewayv2alpha"import apigatewayv2_integrations_alpha "github.com/aws/aws-cdk-go/awscdkapigatewayv2integrationsalpha"

var parameterMapping parameterMapping
httpUrlIntegrationProps := &httpUrlIntegrationProps{
	method: apigatewayv2_alpha.httpMethod_ANY,
	parameterMapping: parameterMapping,
}

Experimental.

type WebSocketLambdaIntegration

type WebSocketLambdaIntegration interface {
	awscdkapigatewayv2alpha.WebSocketRouteIntegration
	// Bind this integration to the route.
	// Experimental.
	Bind(options *awscdkapigatewayv2alpha.WebSocketRouteIntegrationBindOptions) *awscdkapigatewayv2alpha.WebSocketRouteIntegrationConfig
}

Lambda WebSocket Integration.

Example:

import awscdkapigatewayv2integrationsalpha "github.com/aws/aws-cdk-go/awscdkapigatewayv2integrationsalpha"type WebSocketLambdaIntegration awscdkapigatewayv2integrationsalpha.WebSocketLambdaIntegration

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: NewWebSocketLambdaIntegration(jsii.String("SendMessageIntegration"), messageHandler),
})

Experimental.

func NewWebSocketLambdaIntegration

func NewWebSocketLambdaIntegration(id *string, handler awslambda.IFunction) WebSocketLambdaIntegration

Experimental.

type WebSocketMockIntegration

type WebSocketMockIntegration interface {
	awscdkapigatewayv2alpha.WebSocketRouteIntegration
	// Bind this integration to the route.
	// Experimental.
	Bind(options *awscdkapigatewayv2alpha.WebSocketRouteIntegrationBindOptions) *awscdkapigatewayv2alpha.WebSocketRouteIntegrationConfig
}

Mock WebSocket Integration.

Example:

import apigatewayv2_integrations_alpha "github.com/aws/aws-cdk-go/awscdkapigatewayv2integrationsalpha"
webSocketMockIntegration := apigatewayv2_integrations_alpha.NewWebSocketMockIntegration(jsii.String("id"))

Experimental.

func NewWebSocketMockIntegration

func NewWebSocketMockIntegration(id *string) WebSocketMockIntegration

Experimental.

Directories

Path Synopsis
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL