code.dwrz.net

Go monorepo.
Log | Files | Refs

serializers.go (8532B)


      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 	smithyhttp "github.com/aws/smithy-go/transport/http"
     14 )
     15 
     16 type awsRestjson1_serializeOpCreateToken struct {
     17 }
     18 
     19 func (*awsRestjson1_serializeOpCreateToken) ID() string {
     20 	return "OperationSerializer"
     21 }
     22 
     23 func (m *awsRestjson1_serializeOpCreateToken) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
     24 	out middleware.SerializeOutput, metadata middleware.Metadata, err error,
     25 ) {
     26 	request, ok := in.Request.(*smithyhttp.Request)
     27 	if !ok {
     28 		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
     29 	}
     30 
     31 	input, ok := in.Parameters.(*CreateTokenInput)
     32 	_ = input
     33 	if !ok {
     34 		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
     35 	}
     36 
     37 	opPath, opQuery := httpbinding.SplitURI("/token")
     38 	request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
     39 	request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
     40 	request.Method = "POST"
     41 	restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
     42 	if err != nil {
     43 		return out, metadata, &smithy.SerializationError{Err: err}
     44 	}
     45 
     46 	restEncoder.SetHeader("Content-Type").String("application/json")
     47 
     48 	jsonEncoder := smithyjson.NewEncoder()
     49 	if err := awsRestjson1_serializeOpDocumentCreateTokenInput(input, jsonEncoder.Value); err != nil {
     50 		return out, metadata, &smithy.SerializationError{Err: err}
     51 	}
     52 
     53 	if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil {
     54 		return out, metadata, &smithy.SerializationError{Err: err}
     55 	}
     56 
     57 	if request.Request, err = restEncoder.Encode(request.Request); err != nil {
     58 		return out, metadata, &smithy.SerializationError{Err: err}
     59 	}
     60 	in.Request = request
     61 
     62 	return next.HandleSerialize(ctx, in)
     63 }
     64 func awsRestjson1_serializeOpHttpBindingsCreateTokenInput(v *CreateTokenInput, encoder *httpbinding.Encoder) error {
     65 	if v == nil {
     66 		return fmt.Errorf("unsupported serialization of nil %T", v)
     67 	}
     68 
     69 	return nil
     70 }
     71 
     72 func awsRestjson1_serializeOpDocumentCreateTokenInput(v *CreateTokenInput, value smithyjson.Value) error {
     73 	object := value.Object()
     74 	defer object.Close()
     75 
     76 	if v.ClientId != nil {
     77 		ok := object.Key("clientId")
     78 		ok.String(*v.ClientId)
     79 	}
     80 
     81 	if v.ClientSecret != nil {
     82 		ok := object.Key("clientSecret")
     83 		ok.String(*v.ClientSecret)
     84 	}
     85 
     86 	if v.Code != nil {
     87 		ok := object.Key("code")
     88 		ok.String(*v.Code)
     89 	}
     90 
     91 	if v.DeviceCode != nil {
     92 		ok := object.Key("deviceCode")
     93 		ok.String(*v.DeviceCode)
     94 	}
     95 
     96 	if v.GrantType != nil {
     97 		ok := object.Key("grantType")
     98 		ok.String(*v.GrantType)
     99 	}
    100 
    101 	if v.RedirectUri != nil {
    102 		ok := object.Key("redirectUri")
    103 		ok.String(*v.RedirectUri)
    104 	}
    105 
    106 	if v.RefreshToken != nil {
    107 		ok := object.Key("refreshToken")
    108 		ok.String(*v.RefreshToken)
    109 	}
    110 
    111 	if v.Scope != nil {
    112 		ok := object.Key("scope")
    113 		if err := awsRestjson1_serializeDocumentScopes(v.Scope, ok); err != nil {
    114 			return err
    115 		}
    116 	}
    117 
    118 	return nil
    119 }
    120 
    121 type awsRestjson1_serializeOpRegisterClient struct {
    122 }
    123 
    124 func (*awsRestjson1_serializeOpRegisterClient) ID() string {
    125 	return "OperationSerializer"
    126 }
    127 
    128 func (m *awsRestjson1_serializeOpRegisterClient) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
    129 	out middleware.SerializeOutput, metadata middleware.Metadata, err error,
    130 ) {
    131 	request, ok := in.Request.(*smithyhttp.Request)
    132 	if !ok {
    133 		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
    134 	}
    135 
    136 	input, ok := in.Parameters.(*RegisterClientInput)
    137 	_ = input
    138 	if !ok {
    139 		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
    140 	}
    141 
    142 	opPath, opQuery := httpbinding.SplitURI("/client/register")
    143 	request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
    144 	request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
    145 	request.Method = "POST"
    146 	restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
    147 	if err != nil {
    148 		return out, metadata, &smithy.SerializationError{Err: err}
    149 	}
    150 
    151 	restEncoder.SetHeader("Content-Type").String("application/json")
    152 
    153 	jsonEncoder := smithyjson.NewEncoder()
    154 	if err := awsRestjson1_serializeOpDocumentRegisterClientInput(input, jsonEncoder.Value); err != nil {
    155 		return out, metadata, &smithy.SerializationError{Err: err}
    156 	}
    157 
    158 	if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil {
    159 		return out, metadata, &smithy.SerializationError{Err: err}
    160 	}
    161 
    162 	if request.Request, err = restEncoder.Encode(request.Request); err != nil {
    163 		return out, metadata, &smithy.SerializationError{Err: err}
    164 	}
    165 	in.Request = request
    166 
    167 	return next.HandleSerialize(ctx, in)
    168 }
    169 func awsRestjson1_serializeOpHttpBindingsRegisterClientInput(v *RegisterClientInput, encoder *httpbinding.Encoder) error {
    170 	if v == nil {
    171 		return fmt.Errorf("unsupported serialization of nil %T", v)
    172 	}
    173 
    174 	return nil
    175 }
    176 
    177 func awsRestjson1_serializeOpDocumentRegisterClientInput(v *RegisterClientInput, value smithyjson.Value) error {
    178 	object := value.Object()
    179 	defer object.Close()
    180 
    181 	if v.ClientName != nil {
    182 		ok := object.Key("clientName")
    183 		ok.String(*v.ClientName)
    184 	}
    185 
    186 	if v.ClientType != nil {
    187 		ok := object.Key("clientType")
    188 		ok.String(*v.ClientType)
    189 	}
    190 
    191 	if v.Scopes != nil {
    192 		ok := object.Key("scopes")
    193 		if err := awsRestjson1_serializeDocumentScopes(v.Scopes, ok); err != nil {
    194 			return err
    195 		}
    196 	}
    197 
    198 	return nil
    199 }
    200 
    201 type awsRestjson1_serializeOpStartDeviceAuthorization struct {
    202 }
    203 
    204 func (*awsRestjson1_serializeOpStartDeviceAuthorization) ID() string {
    205 	return "OperationSerializer"
    206 }
    207 
    208 func (m *awsRestjson1_serializeOpStartDeviceAuthorization) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
    209 	out middleware.SerializeOutput, metadata middleware.Metadata, err error,
    210 ) {
    211 	request, ok := in.Request.(*smithyhttp.Request)
    212 	if !ok {
    213 		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
    214 	}
    215 
    216 	input, ok := in.Parameters.(*StartDeviceAuthorizationInput)
    217 	_ = input
    218 	if !ok {
    219 		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
    220 	}
    221 
    222 	opPath, opQuery := httpbinding.SplitURI("/device_authorization")
    223 	request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
    224 	request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
    225 	request.Method = "POST"
    226 	restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
    227 	if err != nil {
    228 		return out, metadata, &smithy.SerializationError{Err: err}
    229 	}
    230 
    231 	restEncoder.SetHeader("Content-Type").String("application/json")
    232 
    233 	jsonEncoder := smithyjson.NewEncoder()
    234 	if err := awsRestjson1_serializeOpDocumentStartDeviceAuthorizationInput(input, jsonEncoder.Value); err != nil {
    235 		return out, metadata, &smithy.SerializationError{Err: err}
    236 	}
    237 
    238 	if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil {
    239 		return out, metadata, &smithy.SerializationError{Err: err}
    240 	}
    241 
    242 	if request.Request, err = restEncoder.Encode(request.Request); err != nil {
    243 		return out, metadata, &smithy.SerializationError{Err: err}
    244 	}
    245 	in.Request = request
    246 
    247 	return next.HandleSerialize(ctx, in)
    248 }
    249 func awsRestjson1_serializeOpHttpBindingsStartDeviceAuthorizationInput(v *StartDeviceAuthorizationInput, encoder *httpbinding.Encoder) error {
    250 	if v == nil {
    251 		return fmt.Errorf("unsupported serialization of nil %T", v)
    252 	}
    253 
    254 	return nil
    255 }
    256 
    257 func awsRestjson1_serializeOpDocumentStartDeviceAuthorizationInput(v *StartDeviceAuthorizationInput, value smithyjson.Value) error {
    258 	object := value.Object()
    259 	defer object.Close()
    260 
    261 	if v.ClientId != nil {
    262 		ok := object.Key("clientId")
    263 		ok.String(*v.ClientId)
    264 	}
    265 
    266 	if v.ClientSecret != nil {
    267 		ok := object.Key("clientSecret")
    268 		ok.String(*v.ClientSecret)
    269 	}
    270 
    271 	if v.StartUrl != nil {
    272 		ok := object.Key("startUrl")
    273 		ok.String(*v.StartUrl)
    274 	}
    275 
    276 	return nil
    277 }
    278 
    279 func awsRestjson1_serializeDocumentScopes(v []string, value smithyjson.Value) error {
    280 	array := value.Array()
    281 	defer array.Close()
    282 
    283 	for i := range v {
    284 		av := array.Value()
    285 		av.String(v[i])
    286 	}
    287 	return nil
    288 }