serializers.go raw
1 // Code generated by smithy-go-codegen DO NOT EDIT.
2
3 package ssooidc
4
5 import (
6 "bytes"
7 "context"
8 "fmt"
9 smithy "github.com/aws/smithy-go"
10 "github.com/aws/smithy-go/encoding/httpbinding"
11 smithyjson "github.com/aws/smithy-go/encoding/json"
12 "github.com/aws/smithy-go/middleware"
13 "github.com/aws/smithy-go/tracing"
14 smithyhttp "github.com/aws/smithy-go/transport/http"
15 )
16
17 type awsRestjson1_serializeOpCreateToken struct {
18 }
19
20 func (*awsRestjson1_serializeOpCreateToken) ID() string {
21 return "OperationSerializer"
22 }
23
24 func (m *awsRestjson1_serializeOpCreateToken) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
25 out middleware.SerializeOutput, metadata middleware.Metadata, err error,
26 ) {
27 _, span := tracing.StartSpan(ctx, "OperationSerializer")
28 endTimer := startMetricTimer(ctx, "client.call.serialization_duration")
29 defer endTimer()
30 defer span.End()
31 request, ok := in.Request.(*smithyhttp.Request)
32 if !ok {
33 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
34 }
35
36 input, ok := in.Parameters.(*CreateTokenInput)
37 _ = input
38 if !ok {
39 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
40 }
41
42 opPath, opQuery := httpbinding.SplitURI("/token")
43 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
44 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
45 request.Method = "POST"
46 var restEncoder *httpbinding.Encoder
47 if request.URL.RawPath == "" {
48 restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
49 } else {
50 request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath)
51 restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header)
52 }
53
54 if err != nil {
55 return out, metadata, &smithy.SerializationError{Err: err}
56 }
57
58 restEncoder.SetHeader("Content-Type").String("application/json")
59
60 jsonEncoder := smithyjson.NewEncoder()
61 if err := awsRestjson1_serializeOpDocumentCreateTokenInput(input, jsonEncoder.Value); err != nil {
62 return out, metadata, &smithy.SerializationError{Err: err}
63 }
64
65 if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil {
66 return out, metadata, &smithy.SerializationError{Err: err}
67 }
68
69 if request.Request, err = restEncoder.Encode(request.Request); err != nil {
70 return out, metadata, &smithy.SerializationError{Err: err}
71 }
72 in.Request = request
73
74 endTimer()
75 span.End()
76 return next.HandleSerialize(ctx, in)
77 }
78 func awsRestjson1_serializeOpHttpBindingsCreateTokenInput(v *CreateTokenInput, encoder *httpbinding.Encoder) error {
79 if v == nil {
80 return fmt.Errorf("unsupported serialization of nil %T", v)
81 }
82
83 return nil
84 }
85
86 func awsRestjson1_serializeOpDocumentCreateTokenInput(v *CreateTokenInput, value smithyjson.Value) error {
87 object := value.Object()
88 defer object.Close()
89
90 if v.ClientId != nil {
91 ok := object.Key("clientId")
92 ok.String(*v.ClientId)
93 }
94
95 if v.ClientSecret != nil {
96 ok := object.Key("clientSecret")
97 ok.String(*v.ClientSecret)
98 }
99
100 if v.Code != nil {
101 ok := object.Key("code")
102 ok.String(*v.Code)
103 }
104
105 if v.CodeVerifier != nil {
106 ok := object.Key("codeVerifier")
107 ok.String(*v.CodeVerifier)
108 }
109
110 if v.DeviceCode != nil {
111 ok := object.Key("deviceCode")
112 ok.String(*v.DeviceCode)
113 }
114
115 if v.GrantType != nil {
116 ok := object.Key("grantType")
117 ok.String(*v.GrantType)
118 }
119
120 if v.RedirectUri != nil {
121 ok := object.Key("redirectUri")
122 ok.String(*v.RedirectUri)
123 }
124
125 if v.RefreshToken != nil {
126 ok := object.Key("refreshToken")
127 ok.String(*v.RefreshToken)
128 }
129
130 if v.Scope != nil {
131 ok := object.Key("scope")
132 if err := awsRestjson1_serializeDocumentScopes(v.Scope, ok); err != nil {
133 return err
134 }
135 }
136
137 return nil
138 }
139
140 type awsRestjson1_serializeOpCreateTokenWithIAM struct {
141 }
142
143 func (*awsRestjson1_serializeOpCreateTokenWithIAM) ID() string {
144 return "OperationSerializer"
145 }
146
147 func (m *awsRestjson1_serializeOpCreateTokenWithIAM) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
148 out middleware.SerializeOutput, metadata middleware.Metadata, err error,
149 ) {
150 _, span := tracing.StartSpan(ctx, "OperationSerializer")
151 endTimer := startMetricTimer(ctx, "client.call.serialization_duration")
152 defer endTimer()
153 defer span.End()
154 request, ok := in.Request.(*smithyhttp.Request)
155 if !ok {
156 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
157 }
158
159 input, ok := in.Parameters.(*CreateTokenWithIAMInput)
160 _ = input
161 if !ok {
162 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
163 }
164
165 opPath, opQuery := httpbinding.SplitURI("/token?aws_iam=t")
166 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
167 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
168 request.Method = "POST"
169 var restEncoder *httpbinding.Encoder
170 if request.URL.RawPath == "" {
171 restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
172 } else {
173 request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath)
174 restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header)
175 }
176
177 if err != nil {
178 return out, metadata, &smithy.SerializationError{Err: err}
179 }
180
181 restEncoder.SetHeader("Content-Type").String("application/json")
182
183 jsonEncoder := smithyjson.NewEncoder()
184 if err := awsRestjson1_serializeOpDocumentCreateTokenWithIAMInput(input, jsonEncoder.Value); err != nil {
185 return out, metadata, &smithy.SerializationError{Err: err}
186 }
187
188 if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil {
189 return out, metadata, &smithy.SerializationError{Err: err}
190 }
191
192 if request.Request, err = restEncoder.Encode(request.Request); err != nil {
193 return out, metadata, &smithy.SerializationError{Err: err}
194 }
195 in.Request = request
196
197 endTimer()
198 span.End()
199 return next.HandleSerialize(ctx, in)
200 }
201 func awsRestjson1_serializeOpHttpBindingsCreateTokenWithIAMInput(v *CreateTokenWithIAMInput, encoder *httpbinding.Encoder) error {
202 if v == nil {
203 return fmt.Errorf("unsupported serialization of nil %T", v)
204 }
205
206 return nil
207 }
208
209 func awsRestjson1_serializeOpDocumentCreateTokenWithIAMInput(v *CreateTokenWithIAMInput, value smithyjson.Value) error {
210 object := value.Object()
211 defer object.Close()
212
213 if v.Assertion != nil {
214 ok := object.Key("assertion")
215 ok.String(*v.Assertion)
216 }
217
218 if v.ClientId != nil {
219 ok := object.Key("clientId")
220 ok.String(*v.ClientId)
221 }
222
223 if v.Code != nil {
224 ok := object.Key("code")
225 ok.String(*v.Code)
226 }
227
228 if v.CodeVerifier != nil {
229 ok := object.Key("codeVerifier")
230 ok.String(*v.CodeVerifier)
231 }
232
233 if v.GrantType != nil {
234 ok := object.Key("grantType")
235 ok.String(*v.GrantType)
236 }
237
238 if v.RedirectUri != nil {
239 ok := object.Key("redirectUri")
240 ok.String(*v.RedirectUri)
241 }
242
243 if v.RefreshToken != nil {
244 ok := object.Key("refreshToken")
245 ok.String(*v.RefreshToken)
246 }
247
248 if v.RequestedTokenType != nil {
249 ok := object.Key("requestedTokenType")
250 ok.String(*v.RequestedTokenType)
251 }
252
253 if v.Scope != nil {
254 ok := object.Key("scope")
255 if err := awsRestjson1_serializeDocumentScopes(v.Scope, ok); err != nil {
256 return err
257 }
258 }
259
260 if v.SubjectToken != nil {
261 ok := object.Key("subjectToken")
262 ok.String(*v.SubjectToken)
263 }
264
265 if v.SubjectTokenType != nil {
266 ok := object.Key("subjectTokenType")
267 ok.String(*v.SubjectTokenType)
268 }
269
270 return nil
271 }
272
273 type awsRestjson1_serializeOpRegisterClient struct {
274 }
275
276 func (*awsRestjson1_serializeOpRegisterClient) ID() string {
277 return "OperationSerializer"
278 }
279
280 func (m *awsRestjson1_serializeOpRegisterClient) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
281 out middleware.SerializeOutput, metadata middleware.Metadata, err error,
282 ) {
283 _, span := tracing.StartSpan(ctx, "OperationSerializer")
284 endTimer := startMetricTimer(ctx, "client.call.serialization_duration")
285 defer endTimer()
286 defer span.End()
287 request, ok := in.Request.(*smithyhttp.Request)
288 if !ok {
289 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
290 }
291
292 input, ok := in.Parameters.(*RegisterClientInput)
293 _ = input
294 if !ok {
295 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
296 }
297
298 opPath, opQuery := httpbinding.SplitURI("/client/register")
299 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
300 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
301 request.Method = "POST"
302 var restEncoder *httpbinding.Encoder
303 if request.URL.RawPath == "" {
304 restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
305 } else {
306 request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath)
307 restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header)
308 }
309
310 if err != nil {
311 return out, metadata, &smithy.SerializationError{Err: err}
312 }
313
314 restEncoder.SetHeader("Content-Type").String("application/json")
315
316 jsonEncoder := smithyjson.NewEncoder()
317 if err := awsRestjson1_serializeOpDocumentRegisterClientInput(input, jsonEncoder.Value); err != nil {
318 return out, metadata, &smithy.SerializationError{Err: err}
319 }
320
321 if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil {
322 return out, metadata, &smithy.SerializationError{Err: err}
323 }
324
325 if request.Request, err = restEncoder.Encode(request.Request); err != nil {
326 return out, metadata, &smithy.SerializationError{Err: err}
327 }
328 in.Request = request
329
330 endTimer()
331 span.End()
332 return next.HandleSerialize(ctx, in)
333 }
334 func awsRestjson1_serializeOpHttpBindingsRegisterClientInput(v *RegisterClientInput, encoder *httpbinding.Encoder) error {
335 if v == nil {
336 return fmt.Errorf("unsupported serialization of nil %T", v)
337 }
338
339 return nil
340 }
341
342 func awsRestjson1_serializeOpDocumentRegisterClientInput(v *RegisterClientInput, value smithyjson.Value) error {
343 object := value.Object()
344 defer object.Close()
345
346 if v.ClientName != nil {
347 ok := object.Key("clientName")
348 ok.String(*v.ClientName)
349 }
350
351 if v.ClientType != nil {
352 ok := object.Key("clientType")
353 ok.String(*v.ClientType)
354 }
355
356 if v.EntitledApplicationArn != nil {
357 ok := object.Key("entitledApplicationArn")
358 ok.String(*v.EntitledApplicationArn)
359 }
360
361 if v.GrantTypes != nil {
362 ok := object.Key("grantTypes")
363 if err := awsRestjson1_serializeDocumentGrantTypes(v.GrantTypes, ok); err != nil {
364 return err
365 }
366 }
367
368 if v.IssuerUrl != nil {
369 ok := object.Key("issuerUrl")
370 ok.String(*v.IssuerUrl)
371 }
372
373 if v.RedirectUris != nil {
374 ok := object.Key("redirectUris")
375 if err := awsRestjson1_serializeDocumentRedirectUris(v.RedirectUris, ok); err != nil {
376 return err
377 }
378 }
379
380 if v.Scopes != nil {
381 ok := object.Key("scopes")
382 if err := awsRestjson1_serializeDocumentScopes(v.Scopes, ok); err != nil {
383 return err
384 }
385 }
386
387 return nil
388 }
389
390 type awsRestjson1_serializeOpStartDeviceAuthorization struct {
391 }
392
393 func (*awsRestjson1_serializeOpStartDeviceAuthorization) ID() string {
394 return "OperationSerializer"
395 }
396
397 func (m *awsRestjson1_serializeOpStartDeviceAuthorization) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
398 out middleware.SerializeOutput, metadata middleware.Metadata, err error,
399 ) {
400 _, span := tracing.StartSpan(ctx, "OperationSerializer")
401 endTimer := startMetricTimer(ctx, "client.call.serialization_duration")
402 defer endTimer()
403 defer span.End()
404 request, ok := in.Request.(*smithyhttp.Request)
405 if !ok {
406 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
407 }
408
409 input, ok := in.Parameters.(*StartDeviceAuthorizationInput)
410 _ = input
411 if !ok {
412 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
413 }
414
415 opPath, opQuery := httpbinding.SplitURI("/device_authorization")
416 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
417 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
418 request.Method = "POST"
419 var restEncoder *httpbinding.Encoder
420 if request.URL.RawPath == "" {
421 restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
422 } else {
423 request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath)
424 restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header)
425 }
426
427 if err != nil {
428 return out, metadata, &smithy.SerializationError{Err: err}
429 }
430
431 restEncoder.SetHeader("Content-Type").String("application/json")
432
433 jsonEncoder := smithyjson.NewEncoder()
434 if err := awsRestjson1_serializeOpDocumentStartDeviceAuthorizationInput(input, jsonEncoder.Value); err != nil {
435 return out, metadata, &smithy.SerializationError{Err: err}
436 }
437
438 if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil {
439 return out, metadata, &smithy.SerializationError{Err: err}
440 }
441
442 if request.Request, err = restEncoder.Encode(request.Request); err != nil {
443 return out, metadata, &smithy.SerializationError{Err: err}
444 }
445 in.Request = request
446
447 endTimer()
448 span.End()
449 return next.HandleSerialize(ctx, in)
450 }
451 func awsRestjson1_serializeOpHttpBindingsStartDeviceAuthorizationInput(v *StartDeviceAuthorizationInput, encoder *httpbinding.Encoder) error {
452 if v == nil {
453 return fmt.Errorf("unsupported serialization of nil %T", v)
454 }
455
456 return nil
457 }
458
459 func awsRestjson1_serializeOpDocumentStartDeviceAuthorizationInput(v *StartDeviceAuthorizationInput, value smithyjson.Value) error {
460 object := value.Object()
461 defer object.Close()
462
463 if v.ClientId != nil {
464 ok := object.Key("clientId")
465 ok.String(*v.ClientId)
466 }
467
468 if v.ClientSecret != nil {
469 ok := object.Key("clientSecret")
470 ok.String(*v.ClientSecret)
471 }
472
473 if v.StartUrl != nil {
474 ok := object.Key("startUrl")
475 ok.String(*v.StartUrl)
476 }
477
478 return nil
479 }
480
481 func awsRestjson1_serializeDocumentGrantTypes(v []string, value smithyjson.Value) error {
482 array := value.Array()
483 defer array.Close()
484
485 for i := range v {
486 av := array.Value()
487 av.String(v[i])
488 }
489 return nil
490 }
491
492 func awsRestjson1_serializeDocumentRedirectUris(v []string, value smithyjson.Value) error {
493 array := value.Array()
494 defer array.Close()
495
496 for i := range v {
497 av := array.Value()
498 av.String(v[i])
499 }
500 return nil
501 }
502
503 func awsRestjson1_serializeDocumentScopes(v []string, value smithyjson.Value) error {
504 array := value.Array()
505 defer array.Close()
506
507 for i := range v {
508 av := array.Value()
509 av.String(v[i])
510 }
511 return nil
512 }
513