-
Notifications
You must be signed in to change notification settings - Fork 17
/
HttpUserPoolAuthorizer.go
87 lines (73 loc) · 2.67 KB
/
HttpUserPoolAuthorizer.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
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/awscognito"
)
// Authorize Http Api routes on whether the requester is registered as part of an AWS Cognito user pool.
//
// Example:
// import cognito "github.com/aws/aws-cdk-go/awscdk"
// import "github.com/aws/aws-cdk-go/awscdk"
// import "github.com/aws/aws-cdk-go/awscdk"
//
//
// userPool := cognito.NewUserPool(this, jsii.String("UserPool"))
//
// authorizer := awscdk.NewHttpUserPoolAuthorizer(jsii.String("BooksAuthorizer"), userPool)
//
// 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,
// })
//
type HttpUserPoolAuthorizer interface {
awsapigatewayv2.IHttpRouteAuthorizer
// Bind this authorizer to a specified Http route.
Bind(options *awsapigatewayv2.HttpRouteAuthorizerBindOptions) *awsapigatewayv2.HttpRouteAuthorizerConfig
}
// The jsii proxy struct for HttpUserPoolAuthorizer
type jsiiProxy_HttpUserPoolAuthorizer struct {
internal.Type__awsapigatewayv2IHttpRouteAuthorizer
}
// Initialize a Cognito user pool authorizer to be bound with HTTP route.
func NewHttpUserPoolAuthorizer(id *string, pool awscognito.IUserPool, props *HttpUserPoolAuthorizerProps) HttpUserPoolAuthorizer {
_init_.Initialize()
if err := validateNewHttpUserPoolAuthorizerParameters(id, pool, props); err != nil {
panic(err)
}
j := jsiiProxy_HttpUserPoolAuthorizer{}
_jsii_.Create(
"aws-cdk-lib.aws_apigatewayv2_authorizers.HttpUserPoolAuthorizer",
[]interface{}{id, pool, props},
&j,
)
return &j
}
// Initialize a Cognito user pool authorizer to be bound with HTTP route.
func NewHttpUserPoolAuthorizer_Override(h HttpUserPoolAuthorizer, id *string, pool awscognito.IUserPool, props *HttpUserPoolAuthorizerProps) {
_init_.Initialize()
_jsii_.Create(
"aws-cdk-lib.aws_apigatewayv2_authorizers.HttpUserPoolAuthorizer",
[]interface{}{id, pool, props},
h,
)
}
func (h *jsiiProxy_HttpUserPoolAuthorizer) Bind(options *awsapigatewayv2.HttpRouteAuthorizerBindOptions) *awsapigatewayv2.HttpRouteAuthorizerConfig {
if err := h.validateBindParameters(options); err != nil {
panic(err)
}
var returns *awsapigatewayv2.HttpRouteAuthorizerConfig
_jsii_.Invoke(
h,
"bind",
[]interface{}{options},
&returns,
)
return returns
}