package awscdkapigatewayv2authorizersalpha import ( _init_ "github.com/aws/aws-cdk-go/awscdkapigatewayv2authorizersalpha/v2/jsii" _jsii_ "github.com/aws/jsii-runtime-go/runtime" "github.com/aws/aws-cdk-go/awscdk/v2/awslambda" "github.com/aws/aws-cdk-go/awscdkapigatewayv2alpha/v2" "github.com/aws/aws-cdk-go/awscdkapigatewayv2authorizersalpha/v2/internal" ) // Authorize Http Api routes via a lambda function. // // Example: // import "github.com/aws/aws-cdk-go/awscdkapigatewayv2authorizersalpha" // import "github.com/aws/aws-cdk-go/awscdkapigatewayv2integrationsalpha" // // // This function handles your auth logic // var authHandler function // // // authorizer := awscdkapigatewayv2authorizersalpha.NewHttpLambdaAuthorizer(jsii.String("BooksAuthorizer"), authHandler, &HttpLambdaAuthorizerProps{ // ResponseTypes: []httpLambdaResponseType{ // awscdkapigatewayv2authorizersalpha.HttpLambdaResponseType_SIMPLE, // }, // }) // // api := apigwv2.NewHttpApi(this, jsii.String("HttpApi")) // // api.AddRoutes(&AddRoutesOptions{ // Integration: awscdkapigatewayv2integrationsalpha.NewHttpUrlIntegration(jsii.String("BooksIntegration"), jsii.String("https://get-books-proxy.example.com")), // Path: jsii.String("/books"), // Authorizer: Authorizer, // }) // // Experimental. type HttpLambdaAuthorizer interface { awscdkapigatewayv2alpha.IHttpRouteAuthorizer // Bind this authorizer to a specified Http route. // Experimental. Bind(options *awscdkapigatewayv2alpha.HttpRouteAuthorizerBindOptions) *awscdkapigatewayv2alpha.HttpRouteAuthorizerConfig } // The jsii proxy struct for HttpLambdaAuthorizer type jsiiProxy_HttpLambdaAuthorizer struct { internal.Type__awscdkapigatewayv2alphaIHttpRouteAuthorizer } // Initialize a lambda authorizer to be bound with HTTP route. // Experimental. func NewHttpLambdaAuthorizer(id *string, handler awslambda.IFunction, props *HttpLambdaAuthorizerProps) HttpLambdaAuthorizer { _init_.Initialize() if err := validateNewHttpLambdaAuthorizerParameters(id, handler, props); err != nil { panic(err) } j := jsiiProxy_HttpLambdaAuthorizer{} _jsii_.Create( "@aws-cdk/aws-apigatewayv2-authorizers-alpha.HttpLambdaAuthorizer", []interface{}{id, handler, props}, &j, ) return &j } // Initialize a lambda authorizer to be bound with HTTP route. // Experimental. func NewHttpLambdaAuthorizer_Override(h HttpLambdaAuthorizer, id *string, handler awslambda.IFunction, props *HttpLambdaAuthorizerProps) { _init_.Initialize() _jsii_.Create( "@aws-cdk/aws-apigatewayv2-authorizers-alpha.HttpLambdaAuthorizer", []interface{}{id, handler, props}, h, ) } func (h *jsiiProxy_HttpLambdaAuthorizer) Bind(options *awscdkapigatewayv2alpha.HttpRouteAuthorizerBindOptions) *awscdkapigatewayv2alpha.HttpRouteAuthorizerConfig { if err := h.validateBindParameters(options); err != nil { panic(err) } var returns *awscdkapigatewayv2alpha.HttpRouteAuthorizerConfig _jsii_.Invoke( h, "bind", []interface{}{options}, &returns, ) return returns }