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 a Route. 15func (c *Client) UpdateRoute(ctx context.Context, params *UpdateRouteInput, optFns ...func(*Options)) (*UpdateRouteOutput, error) { 16 if params == nil { 17 params = &UpdateRouteInput{} 18 } 19 20 result, metadata, err := c.invokeOperation(ctx, "UpdateRoute", params, optFns, addOperationUpdateRouteMiddlewares) 21 if err != nil { 22 return nil, err 23 } 24 25 out := result.(*UpdateRouteOutput) 26 out.ResultMetadata = metadata 27 return out, nil 28} 29 30// Updates a Route. 31type UpdateRouteInput struct { 32 33 // The API identifier. 34 // 35 // This member is required. 36 ApiId *string 37 38 // The route ID. 39 // 40 // This member is required. 41 RouteId *string 42 43 // Specifies whether an API key is required for the route. Supported only for 44 // WebSocket APIs. 45 ApiKeyRequired bool 46 47 // The authorization scopes supported by this route. 48 AuthorizationScopes []string 49 50 // The authorization type for the route. For WebSocket APIs, valid values are NONE 51 // for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a 52 // Lambda authorizer For HTTP APIs, valid values are NONE for open access, JWT for 53 // using JSON Web Tokens, AWS_IAM for using AWS IAM permissions, and CUSTOM for 54 // using a Lambda authorizer. 55 AuthorizationType types.AuthorizationType 56 57 // The identifier of the Authorizer resource to be associated with this route. The 58 // authorizer identifier is generated by API Gateway when you created the 59 // authorizer. 60 AuthorizerId *string 61 62 // The model selection expression for the route. Supported only for WebSocket APIs. 63 ModelSelectionExpression *string 64 65 // The operation name for the route. 66 OperationName *string 67 68 // The request models for the route. Supported only for WebSocket APIs. 69 RequestModels map[string]string 70 71 // The request parameters for the route. Supported only for WebSocket APIs. 72 RequestParameters map[string]types.ParameterConstraints 73 74 // The route key for the route. 75 RouteKey *string 76 77 // The route response selection expression for the route. Supported only for 78 // WebSocket APIs. 79 RouteResponseSelectionExpression *string 80 81 // The target for the route. 82 Target *string 83} 84 85type UpdateRouteOutput struct { 86 87 // Specifies whether a route is managed by API Gateway. If you created an API using 88 // quick create, the $default route is managed by API Gateway. You can't modify the 89 // $default route key. 90 ApiGatewayManaged bool 91 92 // Specifies whether an API key is required for this route. Supported only for 93 // WebSocket APIs. 94 ApiKeyRequired bool 95 96 // A list of authorization scopes configured on a route. The scopes are used with a 97 // JWT authorizer to authorize the method invocation. The authorization works by 98 // matching the route scopes against the scopes parsed from the access token in the 99 // incoming request. The method invocation is authorized if any route scope matches 100 // a claimed scope in the access token. Otherwise, the invocation is not 101 // authorized. When the route scope is configured, the client must provide an 102 // access token instead of an identity token for authorization purposes. 103 AuthorizationScopes []string 104 105 // The authorization type for the route. For WebSocket APIs, valid values are NONE 106 // for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a 107 // Lambda authorizer For HTTP APIs, valid values are NONE for open access, JWT for 108 // using JSON Web Tokens, AWS_IAM for using AWS IAM permissions, and CUSTOM for 109 // using a Lambda authorizer. 110 AuthorizationType types.AuthorizationType 111 112 // The identifier of the Authorizer resource to be associated with this route. The 113 // authorizer identifier is generated by API Gateway when you created the 114 // authorizer. 115 AuthorizerId *string 116 117 // The model selection expression for the route. Supported only for WebSocket APIs. 118 ModelSelectionExpression *string 119 120 // The operation name for the route. 121 OperationName *string 122 123 // The request models for the route. Supported only for WebSocket APIs. 124 RequestModels map[string]string 125 126 // The request parameters for the route. Supported only for WebSocket APIs. 127 RequestParameters map[string]types.ParameterConstraints 128 129 // The route ID. 130 RouteId *string 131 132 // The route key for the route. 133 RouteKey *string 134 135 // The route response selection expression for the route. Supported only for 136 // WebSocket APIs. 137 RouteResponseSelectionExpression *string 138 139 // The target for the route. 140 Target *string 141 142 // Metadata pertaining to the operation's result. 143 ResultMetadata middleware.Metadata 144} 145 146func addOperationUpdateRouteMiddlewares(stack *middleware.Stack, options Options) (err error) { 147 err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateRoute{}, middleware.After) 148 if err != nil { 149 return err 150 } 151 err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateRoute{}, middleware.After) 152 if err != nil { 153 return err 154 } 155 if err = addSetLoggerMiddleware(stack, options); err != nil { 156 return err 157 } 158 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 159 return err 160 } 161 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 162 return err 163 } 164 if err = addResolveEndpointMiddleware(stack, options); err != nil { 165 return err 166 } 167 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 168 return err 169 } 170 if err = addRetryMiddlewares(stack, options); err != nil { 171 return err 172 } 173 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 174 return err 175 } 176 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 177 return err 178 } 179 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 180 return err 181 } 182 if err = addClientUserAgent(stack); err != nil { 183 return err 184 } 185 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 186 return err 187 } 188 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 189 return err 190 } 191 if err = addOpUpdateRouteValidationMiddleware(stack); err != nil { 192 return err 193 } 194 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateRoute(options.Region), middleware.Before); err != nil { 195 return err 196 } 197 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 198 return err 199 } 200 if err = addResponseErrorMiddleware(stack); err != nil { 201 return err 202 } 203 if err = addRequestResponseLogging(stack, options); err != nil { 204 return err 205 } 206 return nil 207} 208 209func newServiceMetadataMiddleware_opUpdateRoute(region string) *awsmiddleware.RegisterServiceMetadata { 210 return &awsmiddleware.RegisterServiceMetadata{ 211 Region: region, 212 ServiceID: ServiceID, 213 SigningName: "apigateway", 214 OperationName: "UpdateRoute", 215 } 216} 217