-
Notifications
You must be signed in to change notification settings - Fork 17
/
WebSocketLambdaAuthorizer.go
89 lines (75 loc) · 2.61 KB
/
WebSocketLambdaAuthorizer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package awsapigatewayv2authorizers
import (
_init_ "github.com/aws/aws-cdk-go/awscdk/v2/jsii"
_jsii_ "github.com/aws/jsii-runtime-go/runtime"
"github.com/aws/aws-cdk-go/awscdk/v2/awsapigatewayv2"
"github.com/aws/aws-cdk-go/awscdk/v2/awsapigatewayv2authorizers/internal"
"github.com/aws/aws-cdk-go/awscdk/v2/awslambda"
)
// Authorize WebSocket Api routes via a lambda function.
//
// 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
//
// // This function handles your WebSocket requests
// var handler function
//
//
// authorizer := awscdk.NewWebSocketLambdaAuthorizer(jsii.String("Authorizer"), authHandler)
//
// integration := awscdk.NewWebSocketLambdaIntegration(jsii.String("Integration"), handler)
//
// apigwv2.NewWebSocketApi(this, jsii.String("WebSocketApi"), &WebSocketApiProps{
// ConnectRouteOptions: &WebSocketRouteOptions{
// Integration: *Integration,
// Authorizer: *Authorizer,
// },
// })
//
type WebSocketLambdaAuthorizer interface {
awsapigatewayv2.IWebSocketRouteAuthorizer
// Bind this authorizer to a specified WebSocket route.
Bind(options *awsapigatewayv2.WebSocketRouteAuthorizerBindOptions) *awsapigatewayv2.WebSocketRouteAuthorizerConfig
}
// The jsii proxy struct for WebSocketLambdaAuthorizer
type jsiiProxy_WebSocketLambdaAuthorizer struct {
internal.Type__awsapigatewayv2IWebSocketRouteAuthorizer
}
func NewWebSocketLambdaAuthorizer(id *string, handler awslambda.IFunction, props *WebSocketLambdaAuthorizerProps) WebSocketLambdaAuthorizer {
_init_.Initialize()
if err := validateNewWebSocketLambdaAuthorizerParameters(id, handler, props); err != nil {
panic(err)
}
j := jsiiProxy_WebSocketLambdaAuthorizer{}
_jsii_.Create(
"aws-cdk-lib.aws_apigatewayv2_authorizers.WebSocketLambdaAuthorizer",
[]interface{}{id, handler, props},
&j,
)
return &j
}
func NewWebSocketLambdaAuthorizer_Override(w WebSocketLambdaAuthorizer, id *string, handler awslambda.IFunction, props *WebSocketLambdaAuthorizerProps) {
_init_.Initialize()
_jsii_.Create(
"aws-cdk-lib.aws_apigatewayv2_authorizers.WebSocketLambdaAuthorizer",
[]interface{}{id, handler, props},
w,
)
}
func (w *jsiiProxy_WebSocketLambdaAuthorizer) Bind(options *awsapigatewayv2.WebSocketRouteAuthorizerBindOptions) *awsapigatewayv2.WebSocketRouteAuthorizerConfig {
if err := w.validateBindParameters(options); err != nil {
panic(err)
}
var returns *awsapigatewayv2.WebSocketRouteAuthorizerConfig
_jsii_.Invoke(
w,
"bind",
[]interface{}{options},
&returns,
)
return returns
}