HttpServiceDiscoveryIntegration Class
The Service Discovery integration resource for HTTP API.
Example
ts
import * as servicediscovery from 'aws-cdk-lib/aws-servicediscovery';
import { HttpServiceDiscoveryIntegration } from 'aws-cdk-lib/aws-apigatewayv2-integrations';
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,
}),
});
python
import aws_cdk.aws_servicediscovery as servicediscovery
from aws_cdk.aws_apigatewayv2_integrations import HttpServiceDiscoveryIntegration
vpc = ec2.Vpc(self, "VPC")
vpc_link = apigwv2.VpcLink(self, "VpcLink", vpc=vpc)
namespace = servicediscovery.PrivateDnsNamespace(self, "Namespace",
name="boobar.com",
vpc=vpc
)
service = namespace.create_service("Service")
http_endpoint = apigwv2.HttpApi(self, "HttpProxyPrivateApi",
default_integration=HttpServiceDiscoveryIntegration("DefaultIntegration", service,
vpc_link=vpc_link
)
)
java
import software.amazon.awscdk.services.servicediscovery.*;
import software.amazon.awscdk.aws_apigatewayv2_integrations.HttpServiceDiscoveryIntegration;
Vpc vpc = new Vpc(this, "VPC");
VpcLink vpcLink = VpcLink.Builder.create(this, "VpcLink").vpc(vpc).build();
PrivateDnsNamespace namespace = PrivateDnsNamespace.Builder.create(this, "Namespace")
.name("boobar.com")
.vpc(vpc)
.build();
Service service = namespace.createService("Service");
HttpApi httpEndpoint = HttpApi.Builder.create(this, "HttpProxyPrivateApi")
.defaultIntegration(HttpServiceDiscoveryIntegration.Builder.create("DefaultIntegration", service)
.vpcLink(vpcLink)
.build())
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.ServiceDiscovery;
using Amazon.CDK.AwsApigatewayv2Integrations;
var vpc = new Vpc(this, "VPC");
var vpcLink = new VpcLink(this, "VpcLink", new VpcLinkProps { Vpc = vpc });
var namespace = new PrivateDnsNamespace(this, "Namespace", new PrivateDnsNamespaceProps {
Name = "boobar.com",
Vpc = vpc
});
var service = namespace.CreateService("Service");
var httpEndpoint = new HttpApi(this, "HttpProxyPrivateApi", new HttpApiProps {
DefaultIntegration = new HttpServiceDiscoveryIntegration("DefaultIntegration", service, new HttpServiceDiscoveryIntegrationProps {
VpcLink = vpcLink
})
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
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,
}),
})
Initializer
ts
new HttpServiceDiscoveryIntegration(id: string, service: IServiceRef, props?: HttpServiceDiscoveryIntegrationProps)
python
HttpServiceDiscoveryIntegration(id: str, service: IServiceRef, props: typing.Optional[HttpServiceDiscoveryIntegrationProps] = None)
java
new HttpServiceDiscoveryIntegration(String id, IServiceRef service, HttpServiceDiscoveryIntegrationProps props)
csharp
new HttpServiceDiscoveryIntegration(string id, IServiceRef service, HttpServiceDiscoveryIntegrationProps? props = null)
go
NewHttpServiceDiscoveryIntegration(Id *string, Service IServiceRef, Props HttpServiceDiscoveryIntegrationProps)
Methods
bind(options: HttpRouteIntegrationBindOptions): HttpRouteIntegrationConfigdef bind(self, options: HttpRouteIntegrationBindOptions) -> HttpRouteIntegrationConfigpublic HttpRouteIntegrationConfig bind(HttpRouteIntegrationBindOptions options)public HttpRouteIntegrationConfig Bind(HttpRouteIntegrationBindOptions options)func Bind(Options HttpRouteIntegrationBindOptions) HttpRouteIntegrationConfig#Bind this integration to the route.