-
Notifications
You must be signed in to change notification settings - Fork 626
/
api_op_GetRestApi.go
278 lines (225 loc) · 8.39 KB
/
api_op_GetRestApi.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package apigateway
import (
"context"
"time"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
"github.com/aws/aws-sdk-go-v2/private/protocol"
)
// The GET request to list an existing RestApi defined for your collection.
type GetRestApiInput struct {
_ struct{} `type:"structure"`
// [Required] The string identifier of the associated RestApi.
//
// RestApiId is a required field
RestApiId *string `location:"uri" locationName:"restapi_id" type:"string" required:"true"`
}
// String returns the string representation
func (s GetRestApiInput) String() string {
return awsutil.Prettify(s)
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *GetRestApiInput) Validate() error {
invalidParams := aws.ErrInvalidParams{Context: "GetRestApiInput"}
if s.RestApiId == nil {
invalidParams.Add(aws.NewErrParamRequired("RestApiId"))
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// MarshalFields encodes the AWS API shape using the passed in protocol encoder.
func (s GetRestApiInput) MarshalFields(e protocol.FieldEncoder) error {
e.SetValue(protocol.HeaderTarget, "Content-Type", protocol.StringValue("application/json"), protocol.Metadata{})
if s.RestApiId != nil {
v := *s.RestApiId
metadata := protocol.Metadata{}
e.SetValue(protocol.PathTarget, "restapi_id", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
return nil
}
// Represents a REST API.
//
// Create an API (https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-create-api.html)
type GetRestApiOutput struct {
_ struct{} `type:"structure"`
// The source of the API key for metering requests according to a usage plan.
// Valid values are:
// * HEADER to read the API key from the X-API-Key header of a request.
//
// * AUTHORIZER to read the API key from the UsageIdentifierKey from a custom
// authorizer.
ApiKeySource ApiKeySourceType `locationName:"apiKeySource" type:"string" enum:"true"`
// The list of binary media types supported by the RestApi. By default, the
// RestApi supports only UTF-8-encoded text payloads.
BinaryMediaTypes []string `locationName:"binaryMediaTypes" type:"list"`
// The timestamp when the API was created.
CreatedDate *time.Time `locationName:"createdDate" type:"timestamp"`
// The API's description.
Description *string `locationName:"description" type:"string"`
// The endpoint configuration of this RestApi showing the endpoint types of
// the API.
EndpointConfiguration *EndpointConfiguration `locationName:"endpointConfiguration" type:"structure"`
// The API's identifier. This identifier is unique across all of your APIs in
// API Gateway.
Id *string `locationName:"id" type:"string"`
// A nullable integer that is used to enable compression (with non-negative
// between 0 and 10485760 (10M) bytes, inclusive) or disable compression (with
// a null value) on an API. When compression is enabled, compression or decompression
// is not applied on the payload if the payload size is smaller than this value.
// Setting it to zero allows compression for any payload size.
MinimumCompressionSize *int64 `locationName:"minimumCompressionSize" type:"integer"`
// The API's name.
Name *string `locationName:"name" type:"string"`
// A stringified JSON policy document that applies to this RestApi regardless
// of the caller and Method configuration.
Policy *string `locationName:"policy" type:"string"`
// The collection of tags. Each tag element is associated with a given resource.
Tags map[string]string `locationName:"tags" type:"map"`
// A version identifier for the API.
Version *string `locationName:"version" type:"string"`
// The warning messages reported when failonwarnings is turned on during API
// import.
Warnings []string `locationName:"warnings" type:"list"`
}
// String returns the string representation
func (s GetRestApiOutput) String() string {
return awsutil.Prettify(s)
}
// MarshalFields encodes the AWS API shape using the passed in protocol encoder.
func (s GetRestApiOutput) MarshalFields(e protocol.FieldEncoder) error {
if len(s.ApiKeySource) > 0 {
v := s.ApiKeySource
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "apiKeySource", protocol.QuotedValue{ValueMarshaler: v}, metadata)
}
if s.BinaryMediaTypes != nil {
v := s.BinaryMediaTypes
metadata := protocol.Metadata{}
ls0 := e.List(protocol.BodyTarget, "binaryMediaTypes", metadata)
ls0.Start()
for _, v1 := range v {
ls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})
}
ls0.End()
}
if s.CreatedDate != nil {
v := *s.CreatedDate
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "createdDate",
protocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)
}
if s.Description != nil {
v := *s.Description
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "description", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.EndpointConfiguration != nil {
v := s.EndpointConfiguration
metadata := protocol.Metadata{}
e.SetFields(protocol.BodyTarget, "endpointConfiguration", v, metadata)
}
if s.Id != nil {
v := *s.Id
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "id", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.MinimumCompressionSize != nil {
v := *s.MinimumCompressionSize
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "minimumCompressionSize", protocol.Int64Value(v), metadata)
}
if s.Name != nil {
v := *s.Name
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "name", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.Policy != nil {
v := *s.Policy
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "policy", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.Tags != nil {
v := s.Tags
metadata := protocol.Metadata{}
ms0 := e.Map(protocol.BodyTarget, "tags", metadata)
ms0.Start()
for k1, v1 := range v {
ms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})
}
ms0.End()
}
if s.Version != nil {
v := *s.Version
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "version", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.Warnings != nil {
v := s.Warnings
metadata := protocol.Metadata{}
ls0 := e.List(protocol.BodyTarget, "warnings", metadata)
ls0.Start()
for _, v1 := range v {
ls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})
}
ls0.End()
}
return nil
}
const opGetRestApi = "GetRestApi"
// GetRestApiRequest returns a request value for making API operation for
// Amazon API Gateway.
//
// Lists the RestApi resource in the collection.
//
// // Example sending a request using GetRestApiRequest.
// req := client.GetRestApiRequest(params)
// resp, err := req.Send(context.TODO())
// if err == nil {
// fmt.Println(resp)
// }
func (c *Client) GetRestApiRequest(input *GetRestApiInput) GetRestApiRequest {
op := &aws.Operation{
Name: opGetRestApi,
HTTPMethod: "GET",
HTTPPath: "/restapis/{restapi_id}",
}
if input == nil {
input = &GetRestApiInput{}
}
req := c.newRequest(op, input, &GetRestApiOutput{})
return GetRestApiRequest{Request: req, Input: input, Copy: c.GetRestApiRequest}
}
// GetRestApiRequest is the request type for the
// GetRestApi API operation.
type GetRestApiRequest struct {
*aws.Request
Input *GetRestApiInput
Copy func(*GetRestApiInput) GetRestApiRequest
}
// Send marshals and sends the GetRestApi API request.
func (r GetRestApiRequest) Send(ctx context.Context) (*GetRestApiResponse, error) {
r.Request.SetContext(ctx)
err := r.Request.Send()
if err != nil {
return nil, err
}
resp := &GetRestApiResponse{
GetRestApiOutput: r.Request.Data.(*GetRestApiOutput),
response: &aws.Response{Request: r.Request},
}
return resp, nil
}
// GetRestApiResponse is the response type for the
// GetRestApi API operation.
type GetRestApiResponse struct {
*GetRestApiOutput
response *aws.Response
}
// SDKResponseMetdata returns the response metadata for the
// GetRestApi request.
func (r *GetRestApiResponse) SDKResponseMetdata() *aws.Response {
return r.response
}