1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package apigateway 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/apigateway/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// Grants a temporary extension to the remaining quota of a usage plan associated 15// with a specified API key. 16func (c *Client) UpdateUsage(ctx context.Context, params *UpdateUsageInput, optFns ...func(*Options)) (*UpdateUsageOutput, error) { 17 if params == nil { 18 params = &UpdateUsageInput{} 19 } 20 21 result, metadata, err := c.invokeOperation(ctx, "UpdateUsage", params, optFns, addOperationUpdateUsageMiddlewares) 22 if err != nil { 23 return nil, err 24 } 25 26 out := result.(*UpdateUsageOutput) 27 out.ResultMetadata = metadata 28 return out, nil 29} 30 31// The PATCH request to grant a temporary extension to the remaining quota of a 32// usage plan associated with a specified API key. 33type UpdateUsageInput struct { 34 35 // [Required] The identifier of the API key associated with the usage plan in which 36 // a temporary extension is granted to the remaining quota. 37 // 38 // This member is required. 39 KeyId *string 40 41 // [Required] The Id of the usage plan associated with the usage data. 42 // 43 // This member is required. 44 UsagePlanId *string 45 46 // A list of update operations to be applied to the specified resource and in the 47 // order specified in this list. 48 PatchOperations []types.PatchOperation 49} 50 51// Represents the usage data of a usage plan. Create and Use Usage Plans 52// (https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-api-usage-plans.html), 53// Manage Usage in a Usage Plan 54// (https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-create-usage-plans-with-console.html#api-gateway-usage-plan-manage-usage) 55type UpdateUsageOutput struct { 56 57 // The ending date of the usage data. 58 EndDate *string 59 60 // The usage data, as daily logs of used and remaining quotas, over the specified 61 // time interval indexed over the API keys in a usage plan. For example, {..., 62 // "values" : { "{api_key}" : [ [0, 100], [10, 90], [100, 10]]}, where {api_key} 63 // stands for an API key value and the daily log entry is of the format [used 64 // quota, remaining quota]. 65 Items map[string][][]int64 66 67 // The current pagination position in the paged result set. 68 Position *string 69 70 // The starting date of the usage data. 71 StartDate *string 72 73 // The plan Id associated with this usage data. 74 UsagePlanId *string 75 76 // Metadata pertaining to the operation's result. 77 ResultMetadata middleware.Metadata 78} 79 80func addOperationUpdateUsageMiddlewares(stack *middleware.Stack, options Options) (err error) { 81 err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateUsage{}, middleware.After) 82 if err != nil { 83 return err 84 } 85 err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateUsage{}, middleware.After) 86 if err != nil { 87 return err 88 } 89 if err = addSetLoggerMiddleware(stack, options); err != nil { 90 return err 91 } 92 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 93 return err 94 } 95 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 96 return err 97 } 98 if err = addResolveEndpointMiddleware(stack, options); err != nil { 99 return err 100 } 101 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 102 return err 103 } 104 if err = addRetryMiddlewares(stack, options); err != nil { 105 return err 106 } 107 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 108 return err 109 } 110 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 111 return err 112 } 113 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 114 return err 115 } 116 if err = addClientUserAgent(stack); err != nil { 117 return err 118 } 119 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 120 return err 121 } 122 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 123 return err 124 } 125 if err = addOpUpdateUsageValidationMiddleware(stack); err != nil { 126 return err 127 } 128 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateUsage(options.Region), middleware.Before); err != nil { 129 return err 130 } 131 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 132 return err 133 } 134 if err = addResponseErrorMiddleware(stack); err != nil { 135 return err 136 } 137 if err = addAcceptHeader(stack); err != nil { 138 return err 139 } 140 if err = addRequestResponseLogging(stack, options); err != nil { 141 return err 142 } 143 return nil 144} 145 146func newServiceMetadataMiddleware_opUpdateUsage(region string) *awsmiddleware.RegisterServiceMetadata { 147 return &awsmiddleware.RegisterServiceMetadata{ 148 Region: region, 149 ServiceID: ServiceID, 150 SigningName: "apigateway", 151 OperationName: "UpdateUsage", 152 } 153} 154