-
Notifications
You must be signed in to change notification settings - Fork 598
/
api_op_GetUsage.go
137 lines (113 loc) · 4.34 KB
/
api_op_GetUsage.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
// 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"
)
// Gets the usage data of a usage plan in a specified time interval.
func (c *Client) GetUsage(ctx context.Context, params *GetUsageInput, optFns ...func(*Options)) (*GetUsageOutput, error) {
stack := middleware.NewStack("GetUsage", smithyhttp.NewStackRequest)
options := c.options.Copy()
for _, fn := range optFns {
fn(&options)
}
addawsRestjson1_serdeOpGetUsageMiddlewares(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)
addOpGetUsageValidationMiddleware(stack)
stack.Initialize.Add(newServiceMetadataMiddleware_opGetUsage(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: "GetUsage",
Err: err,
}
}
out := result.(*GetUsageOutput)
out.ResultMetadata = metadata
return out, nil
}
// The GET request to get the usage data of a usage plan in a specified time
// interval.
type GetUsageInput struct {
// The current pagination position in the paged result set.
Position *string
Template *bool
// [Required] The ending date (e.g., 2016-12-31) of the usage data.
//
// This member is required.
EndDate *string
// [Required] The starting date (e.g., 2016-01-01) of the usage data.
//
// This member is required.
StartDate *string
// [Required] The Id of the usage plan associated with the usage data.
//
// This member is required.
UsagePlanId *string
TemplateSkipList []*string
Title *string
// The Id of the API key associated with the resultant usage data.
KeyId *string
// The maximum number of returned results per page. The default value is 25 and the
// maximum value is 500.
Limit *int32
Name *string
}
// Represents the usage data of a usage plan. Create and Use Usage Plans
// (https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-api-usage-plans.html),
// Manage Usage in a Usage Plan
// (https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-create-usage-plans-with-console.html#api-gateway-usage-plan-manage-usage)
type GetUsageOutput struct {
// The ending date of the usage data.
EndDate *string
// The plan Id associated with this usage data.
UsagePlanId *string
// The starting date of the usage data.
StartDate *string
// The usage data, as daily logs of used and remaining quotas, over the specified
// time interval indexed over the API keys in a usage plan. For example, {...,
// "values" : { "{api_key}" : [ [0, 100], [10, 90], [100, 10]]}, where {api_key}
// stands for an API key value and the daily log entry is of the format [used
// quota, remaining quota].
Items map[string][][]*int64
// The current pagination position in the paged result set.
Position *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
}
func addawsRestjson1_serdeOpGetUsageMiddlewares(stack *middleware.Stack) {
stack.Serialize.Add(&awsRestjson1_serializeOpGetUsage{}, middleware.After)
stack.Deserialize.Add(&awsRestjson1_deserializeOpGetUsage{}, middleware.After)
}
func newServiceMetadataMiddleware_opGetUsage(region string) awsmiddleware.RegisterServiceMetadata {
return awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "apigateway",
OperationName: "GetUsage",
}
}