1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package apigatewayv2 4 5import ( 6 "context" 7 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 8 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 9 "github.com/aws/aws-sdk-go-v2/service/apigatewayv2/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// Updates an Authorizer. 15func (c *Client) UpdateAuthorizer(ctx context.Context, params *UpdateAuthorizerInput, optFns ...func(*Options)) (*UpdateAuthorizerOutput, error) { 16 if params == nil { 17 params = &UpdateAuthorizerInput{} 18 } 19 20 result, metadata, err := c.invokeOperation(ctx, "UpdateAuthorizer", params, optFns, addOperationUpdateAuthorizerMiddlewares) 21 if err != nil { 22 return nil, err 23 } 24 25 out := result.(*UpdateAuthorizerOutput) 26 out.ResultMetadata = metadata 27 return out, nil 28} 29 30// Updates an Authorizer. 31type UpdateAuthorizerInput struct { 32 33 // The API identifier. 34 // 35 // This member is required. 36 ApiId *string 37 38 // The authorizer identifier. 39 // 40 // This member is required. 41 AuthorizerId *string 42 43 // Specifies the required credentials as an IAM role for API Gateway to invoke the 44 // authorizer. To specify an IAM role for API Gateway to assume, use the role's 45 // Amazon Resource Name (ARN). To use resource-based permissions on the Lambda 46 // function, don't specify this parameter. 47 AuthorizerCredentialsArn *string 48 49 // Specifies the format of the payload sent to an HTTP API Lambda authorizer. 50 // Required for HTTP API Lambda authorizers. Supported values are 1.0 and 2.0. To 51 // learn more, see Working with AWS Lambda authorizers for HTTP APIs 52 // (https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html). 53 AuthorizerPayloadFormatVersion *string 54 55 // The time to live (TTL) for cached authorizer results, in seconds. If it equals 56 // 0, authorization caching is disabled. If it is greater than 0, API Gateway 57 // caches authorizer responses. The maximum value is 3600, or 1 hour. Supported 58 // only for HTTP API Lambda authorizers. 59 AuthorizerResultTtlInSeconds int32 60 61 // The authorizer type. Specify REQUEST for a Lambda function using incoming 62 // request parameters. Specify JWT to use JSON Web Tokens (supported only for HTTP 63 // APIs). 64 AuthorizerType types.AuthorizerType 65 66 // The authorizer's Uniform Resource Identifier (URI). For REQUEST authorizers, 67 // this must be a well-formed Lambda function URI, for example, 68 // arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:{account_id}:function:{lambda_function_name}/invocations. 69 // In general, the URI has this form: 70 // arn:aws:apigateway:{region}:lambda:path/{service_api} , where {region} is the 71 // same as the region hosting the Lambda function, path indicates that the 72 // remaining substring in the URI should be treated as the path to the resource, 73 // including the initial /. For Lambda functions, this is usually of the form 74 // /2015-03-31/functions/[FunctionARN]/invocations. Supported only for REQUEST 75 // authorizers. 76 AuthorizerUri *string 77 78 // Specifies whether a Lambda authorizer returns a response in a simple format. By 79 // default, a Lambda authorizer must return an IAM policy. If enabled, the Lambda 80 // authorizer can return a boolean value instead of an IAM policy. Supported only 81 // for HTTP APIs. To learn more, see Working with AWS Lambda authorizers for HTTP 82 // APIs 83 // (https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html) 84 EnableSimpleResponses bool 85 86 // The identity source for which authorization is requested. For a REQUEST 87 // authorizer, this is optional. The value is a set of one or more mapping 88 // expressions of the specified request parameters. The identity source can be 89 // headers, query string parameters, stage variables, and context parameters. For 90 // example, if an Auth header and a Name query string parameter are defined as 91 // identity sources, this value is route.request.header.Auth, 92 // route.request.querystring.Name for WebSocket APIs. For HTTP APIs, use selection 93 // expressions prefixed with $, for example, $request.header.Auth, 94 // $request.querystring.Name. These parameters are used to perform runtime 95 // validation for Lambda-based authorizers by verifying all of the identity-related 96 // request parameters are present in the request, not null, and non-empty. Only 97 // when this is true does the authorizer invoke the authorizer Lambda function. 98 // Otherwise, it returns a 401 Unauthorized response without calling the Lambda 99 // function. For HTTP APIs, identity sources are also used as the cache key when 100 // caching is enabled. To learn more, see Working with AWS Lambda authorizers for 101 // HTTP APIs 102 // (https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html). 103 // For JWT, a single entry that specifies where to extract the JSON Web Token (JWT) 104 // from inbound requests. Currently only header-based and query parameter-based 105 // selections are supported, for example $request.header.Authorization. 106 IdentitySource []string 107 108 // This parameter is not used. 109 IdentityValidationExpression *string 110 111 // Represents the configuration of a JWT authorizer. Required for the JWT 112 // authorizer type. Supported only for HTTP APIs. 113 JwtConfiguration *types.JWTConfiguration 114 115 // The name of the authorizer. 116 Name *string 117} 118 119type UpdateAuthorizerOutput struct { 120 121 // Specifies the required credentials as an IAM role for API Gateway to invoke the 122 // authorizer. To specify an IAM role for API Gateway to assume, use the role's 123 // Amazon Resource Name (ARN). To use resource-based permissions on the Lambda 124 // function, don't specify this parameter. Supported only for REQUEST authorizers. 125 AuthorizerCredentialsArn *string 126 127 // The authorizer identifier. 128 AuthorizerId *string 129 130 // Specifies the format of the payload sent to an HTTP API Lambda authorizer. 131 // Required for HTTP API Lambda authorizers. Supported values are 1.0 and 2.0. To 132 // learn more, see Working with AWS Lambda authorizers for HTTP APIs 133 // (https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html). 134 AuthorizerPayloadFormatVersion *string 135 136 // The time to live (TTL) for cached authorizer results, in seconds. If it equals 137 // 0, authorization caching is disabled. If it is greater than 0, API Gateway 138 // caches authorizer responses. The maximum value is 3600, or 1 hour. Supported 139 // only for HTTP API Lambda authorizers. 140 AuthorizerResultTtlInSeconds int32 141 142 // The authorizer type. Specify REQUEST for a Lambda function using incoming 143 // request parameters. Specify JWT to use JSON Web Tokens (supported only for HTTP 144 // APIs). 145 AuthorizerType types.AuthorizerType 146 147 // The authorizer's Uniform Resource Identifier (URI). For REQUEST authorizers, 148 // this must be a well-formed Lambda function URI, for example, 149 // arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:{account_id}:function:{lambda_function_name}/invocations. 150 // In general, the URI has this form: 151 // arn:aws:apigateway:{region}:lambda:path/{service_api} , where {region} is the 152 // same as the region hosting the Lambda function, path indicates that the 153 // remaining substring in the URI should be treated as the path to the resource, 154 // including the initial /. For Lambda functions, this is usually of the form 155 // /2015-03-31/functions/[FunctionARN]/invocations. Supported only for REQUEST 156 // authorizers. 157 AuthorizerUri *string 158 159 // Specifies whether a Lambda authorizer returns a response in a simple format. If 160 // enabled, the Lambda authorizer can return a boolean value instead of an IAM 161 // policy. Supported only for HTTP APIs. To learn more, see Working with AWS Lambda 162 // authorizers for HTTP APIs 163 // (https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html) 164 EnableSimpleResponses bool 165 166 // The identity source for which authorization is requested. For a REQUEST 167 // authorizer, this is optional. The value is a set of one or more mapping 168 // expressions of the specified request parameters. The identity source can be 169 // headers, query string parameters, stage variables, and context parameters. For 170 // example, if an Auth header and a Name query string parameter are defined as 171 // identity sources, this value is route.request.header.Auth, 172 // route.request.querystring.Name for WebSocket APIs. For HTTP APIs, use selection 173 // expressions prefixed with $, for example, $request.header.Auth, 174 // $request.querystring.Name. These parameters are used to perform runtime 175 // validation for Lambda-based authorizers by verifying all of the identity-related 176 // request parameters are present in the request, not null, and non-empty. Only 177 // when this is true does the authorizer invoke the authorizer Lambda function. 178 // Otherwise, it returns a 401 Unauthorized response without calling the Lambda 179 // function. For HTTP APIs, identity sources are also used as the cache key when 180 // caching is enabled. To learn more, see Working with AWS Lambda authorizers for 181 // HTTP APIs 182 // (https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html). 183 // For JWT, a single entry that specifies where to extract the JSON Web Token (JWT) 184 // from inbound requests. Currently only header-based and query parameter-based 185 // selections are supported, for example $request.header.Authorization. 186 IdentitySource []string 187 188 // The validation expression does not apply to the REQUEST authorizer. 189 IdentityValidationExpression *string 190 191 // Represents the configuration of a JWT authorizer. Required for the JWT 192 // authorizer type. Supported only for HTTP APIs. 193 JwtConfiguration *types.JWTConfiguration 194 195 // The name of the authorizer. 196 Name *string 197 198 // Metadata pertaining to the operation's result. 199 ResultMetadata middleware.Metadata 200} 201 202func addOperationUpdateAuthorizerMiddlewares(stack *middleware.Stack, options Options) (err error) { 203 err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateAuthorizer{}, middleware.After) 204 if err != nil { 205 return err 206 } 207 err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateAuthorizer{}, middleware.After) 208 if err != nil { 209 return err 210 } 211 if err = addSetLoggerMiddleware(stack, options); err != nil { 212 return err 213 } 214 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 215 return err 216 } 217 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 218 return err 219 } 220 if err = addResolveEndpointMiddleware(stack, options); err != nil { 221 return err 222 } 223 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 224 return err 225 } 226 if err = addRetryMiddlewares(stack, options); err != nil { 227 return err 228 } 229 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 230 return err 231 } 232 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 233 return err 234 } 235 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 236 return err 237 } 238 if err = addClientUserAgent(stack); err != nil { 239 return err 240 } 241 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 242 return err 243 } 244 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 245 return err 246 } 247 if err = addOpUpdateAuthorizerValidationMiddleware(stack); err != nil { 248 return err 249 } 250 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateAuthorizer(options.Region), middleware.Before); err != nil { 251 return err 252 } 253 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 254 return err 255 } 256 if err = addResponseErrorMiddleware(stack); err != nil { 257 return err 258 } 259 if err = addRequestResponseLogging(stack, options); err != nil { 260 return err 261 } 262 return nil 263} 264 265func newServiceMetadataMiddleware_opUpdateAuthorizer(region string) *awsmiddleware.RegisterServiceMetadata { 266 return &awsmiddleware.RegisterServiceMetadata{ 267 Region: region, 268 ServiceID: ServiceID, 269 SigningName: "apigateway", 270 OperationName: "UpdateAuthorizer", 271 } 272} 273