-
Notifications
You must be signed in to change notification settings - Fork 598
/
api_op_TestInvokeAuthorizer.go
143 lines (119 loc) · 5.1 KB
/
api_op_TestInvokeAuthorizer.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
// Code generated by smithy-go-codegen DO NOT EDIT.
package apigateway
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/retry"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
smithy "github.com/awslabs/smithy-go"
"github.com/awslabs/smithy-go/middleware"
smithyhttp "github.com/awslabs/smithy-go/transport/http"
)
// Simulate the execution of an Authorizer () in your RestApi () with headers,
// parameters, and an incoming request body. Use Lambda Function as Authorizer
// (https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-use-lambda-authorizer.html)Use
// Cognito User Pool as Authorizer
// (https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-integrate-with-cognito.html)
func (c *Client) TestInvokeAuthorizer(ctx context.Context, params *TestInvokeAuthorizerInput, optFns ...func(*Options)) (*TestInvokeAuthorizerOutput, error) {
stack := middleware.NewStack("TestInvokeAuthorizer", smithyhttp.NewStackRequest)
options := c.options.Copy()
for _, fn := range optFns {
fn(&options)
}
addawsRestjson1_serdeOpTestInvokeAuthorizerMiddlewares(stack)
awsmiddleware.AddRequestInvocationIDMiddleware(stack)
smithyhttp.AddContentLengthMiddleware(stack)
AddResolveEndpointMiddleware(stack, options)
v4.AddComputePayloadSHA256Middleware(stack)
retry.AddRetryMiddlewares(stack, options)
addHTTPSignerV4Middleware(stack, options)
awsmiddleware.AddAttemptClockSkewMiddleware(stack)
addClientUserAgent(stack)
smithyhttp.AddErrorCloseResponseBodyMiddleware(stack)
smithyhttp.AddCloseResponseBodyMiddleware(stack)
addOpTestInvokeAuthorizerValidationMiddleware(stack)
stack.Initialize.Add(newServiceMetadataMiddleware_opTestInvokeAuthorizer(options.Region), middleware.Before)
addRequestIDRetrieverMiddleware(stack)
addResponseErrorMiddleware(stack)
addAcceptHeader(stack)
for _, fn := range options.APIOptions {
if err := fn(stack); err != nil {
return nil, err
}
}
handler := middleware.DecorateHandler(smithyhttp.NewClientHandler(options.HTTPClient), stack)
result, metadata, err := handler.Handle(ctx, params)
if err != nil {
return nil, &smithy.OperationError{
ServiceID: ServiceID,
OperationName: "TestInvokeAuthorizer",
Err: err,
}
}
out := result.(*TestInvokeAuthorizerOutput)
out.ResultMetadata = metadata
return out, nil
}
// Make a request to simulate the execution of an Authorizer ().
type TestInvokeAuthorizerInput struct {
// [Optional] A key-value map of additional context variables.
AdditionalContext map[string]*string
// [Optional] The URI path, including query string, of the simulated invocation
// request. Use this to specify path parameters and query string parameters.
PathWithQueryString *string
// [Required] A key-value map of headers to simulate an incoming invocation
// request. This is where the incoming authorization token, or identity source,
// should be specified.
Headers map[string]*string
// [Optional] The simulated request body of an incoming invocation request.
Body *string
// A key-value map of stage variables to simulate an invocation on a deployed Stage
// ().
StageVariables map[string]*string
// [Required] The string identifier of the associated RestApi ().
//
// This member is required.
RestApiId *string
// [Required] Specifies a test invoke authorizer request's Authorizer () ID.
//
// This member is required.
AuthorizerId *string
// [Optional] The headers as a map from string to list of values to simulate an
// incoming invocation request. This is where the incoming authorization token, or
// identity source, may be specified.
MultiValueHeaders map[string][]*string
}
// Represents the response of the test invoke request for a custom Authorizer ()
type TestInvokeAuthorizerOutput struct {
// The API Gateway execution log for the test authorizer request.
Log *string
Authorization map[string][]*string
// The principal identity returned by the Authorizer ()
PrincipalId *string
// The JSON policy document returned by the Authorizer ()
Policy *string
// The HTTP status code that the client would have received. Value is 0 if the
// authorizer succeeded.
ClientStatus *int32
// The open identity claims
// (https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims), with any
// supported custom attributes, returned from the Cognito Your User Pool configured
// for the API.
Claims map[string]*string
// The execution latency of the test authorizer request.
Latency *int64
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
}
func addawsRestjson1_serdeOpTestInvokeAuthorizerMiddlewares(stack *middleware.Stack) {
stack.Serialize.Add(&awsRestjson1_serializeOpTestInvokeAuthorizer{}, middleware.After)
stack.Deserialize.Add(&awsRestjson1_deserializeOpTestInvokeAuthorizer{}, middleware.After)
}
func newServiceMetadataMiddleware_opTestInvokeAuthorizer(region string) awsmiddleware.RegisterServiceMetadata {
return awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "apigateway",
OperationName: "TestInvokeAuthorizer",
}
}