src

Go monorepo.
git clone git://code.dwrz.net/src
Log | Files | Refs

serializers.go (9612B)


      1 // Code generated by smithy-go-codegen DO NOT EDIT.
      2 
      3 package sso
      4 
      5 import (
      6 	"context"
      7 	"fmt"
      8 	smithy "github.com/aws/smithy-go"
      9 	"github.com/aws/smithy-go/encoding/httpbinding"
     10 	"github.com/aws/smithy-go/middleware"
     11 	smithyhttp "github.com/aws/smithy-go/transport/http"
     12 )
     13 
     14 type awsRestjson1_serializeOpGetRoleCredentials struct {
     15 }
     16 
     17 func (*awsRestjson1_serializeOpGetRoleCredentials) ID() string {
     18 	return "OperationSerializer"
     19 }
     20 
     21 func (m *awsRestjson1_serializeOpGetRoleCredentials) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
     22 	out middleware.SerializeOutput, metadata middleware.Metadata, err error,
     23 ) {
     24 	request, ok := in.Request.(*smithyhttp.Request)
     25 	if !ok {
     26 		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
     27 	}
     28 
     29 	input, ok := in.Parameters.(*GetRoleCredentialsInput)
     30 	_ = input
     31 	if !ok {
     32 		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
     33 	}
     34 
     35 	opPath, opQuery := httpbinding.SplitURI("/federation/credentials")
     36 	request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
     37 	request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
     38 	request.Method = "GET"
     39 	var restEncoder *httpbinding.Encoder
     40 	if request.URL.RawPath == "" {
     41 		restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
     42 	} else {
     43 		request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath)
     44 		restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header)
     45 	}
     46 
     47 	if err != nil {
     48 		return out, metadata, &smithy.SerializationError{Err: err}
     49 	}
     50 
     51 	if err := awsRestjson1_serializeOpHttpBindingsGetRoleCredentialsInput(input, restEncoder); err != nil {
     52 		return out, metadata, &smithy.SerializationError{Err: err}
     53 	}
     54 
     55 	if request.Request, err = restEncoder.Encode(request.Request); err != nil {
     56 		return out, metadata, &smithy.SerializationError{Err: err}
     57 	}
     58 	in.Request = request
     59 
     60 	return next.HandleSerialize(ctx, in)
     61 }
     62 func awsRestjson1_serializeOpHttpBindingsGetRoleCredentialsInput(v *GetRoleCredentialsInput, encoder *httpbinding.Encoder) error {
     63 	if v == nil {
     64 		return fmt.Errorf("unsupported serialization of nil %T", v)
     65 	}
     66 
     67 	if v.AccessToken != nil && len(*v.AccessToken) > 0 {
     68 		locationName := "X-Amz-Sso_bearer_token"
     69 		encoder.SetHeader(locationName).String(*v.AccessToken)
     70 	}
     71 
     72 	if v.AccountId != nil {
     73 		encoder.SetQuery("account_id").String(*v.AccountId)
     74 	}
     75 
     76 	if v.RoleName != nil {
     77 		encoder.SetQuery("role_name").String(*v.RoleName)
     78 	}
     79 
     80 	return nil
     81 }
     82 
     83 type awsRestjson1_serializeOpListAccountRoles struct {
     84 }
     85 
     86 func (*awsRestjson1_serializeOpListAccountRoles) ID() string {
     87 	return "OperationSerializer"
     88 }
     89 
     90 func (m *awsRestjson1_serializeOpListAccountRoles) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
     91 	out middleware.SerializeOutput, metadata middleware.Metadata, err error,
     92 ) {
     93 	request, ok := in.Request.(*smithyhttp.Request)
     94 	if !ok {
     95 		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
     96 	}
     97 
     98 	input, ok := in.Parameters.(*ListAccountRolesInput)
     99 	_ = input
    100 	if !ok {
    101 		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
    102 	}
    103 
    104 	opPath, opQuery := httpbinding.SplitURI("/assignment/roles")
    105 	request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
    106 	request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
    107 	request.Method = "GET"
    108 	var restEncoder *httpbinding.Encoder
    109 	if request.URL.RawPath == "" {
    110 		restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
    111 	} else {
    112 		request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath)
    113 		restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header)
    114 	}
    115 
    116 	if err != nil {
    117 		return out, metadata, &smithy.SerializationError{Err: err}
    118 	}
    119 
    120 	if err := awsRestjson1_serializeOpHttpBindingsListAccountRolesInput(input, restEncoder); err != nil {
    121 		return out, metadata, &smithy.SerializationError{Err: err}
    122 	}
    123 
    124 	if request.Request, err = restEncoder.Encode(request.Request); err != nil {
    125 		return out, metadata, &smithy.SerializationError{Err: err}
    126 	}
    127 	in.Request = request
    128 
    129 	return next.HandleSerialize(ctx, in)
    130 }
    131 func awsRestjson1_serializeOpHttpBindingsListAccountRolesInput(v *ListAccountRolesInput, encoder *httpbinding.Encoder) error {
    132 	if v == nil {
    133 		return fmt.Errorf("unsupported serialization of nil %T", v)
    134 	}
    135 
    136 	if v.AccessToken != nil && len(*v.AccessToken) > 0 {
    137 		locationName := "X-Amz-Sso_bearer_token"
    138 		encoder.SetHeader(locationName).String(*v.AccessToken)
    139 	}
    140 
    141 	if v.AccountId != nil {
    142 		encoder.SetQuery("account_id").String(*v.AccountId)
    143 	}
    144 
    145 	if v.MaxResults != nil {
    146 		encoder.SetQuery("max_result").Integer(*v.MaxResults)
    147 	}
    148 
    149 	if v.NextToken != nil {
    150 		encoder.SetQuery("next_token").String(*v.NextToken)
    151 	}
    152 
    153 	return nil
    154 }
    155 
    156 type awsRestjson1_serializeOpListAccounts struct {
    157 }
    158 
    159 func (*awsRestjson1_serializeOpListAccounts) ID() string {
    160 	return "OperationSerializer"
    161 }
    162 
    163 func (m *awsRestjson1_serializeOpListAccounts) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
    164 	out middleware.SerializeOutput, metadata middleware.Metadata, err error,
    165 ) {
    166 	request, ok := in.Request.(*smithyhttp.Request)
    167 	if !ok {
    168 		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
    169 	}
    170 
    171 	input, ok := in.Parameters.(*ListAccountsInput)
    172 	_ = input
    173 	if !ok {
    174 		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
    175 	}
    176 
    177 	opPath, opQuery := httpbinding.SplitURI("/assignment/accounts")
    178 	request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
    179 	request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
    180 	request.Method = "GET"
    181 	var restEncoder *httpbinding.Encoder
    182 	if request.URL.RawPath == "" {
    183 		restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
    184 	} else {
    185 		request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath)
    186 		restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header)
    187 	}
    188 
    189 	if err != nil {
    190 		return out, metadata, &smithy.SerializationError{Err: err}
    191 	}
    192 
    193 	if err := awsRestjson1_serializeOpHttpBindingsListAccountsInput(input, restEncoder); err != nil {
    194 		return out, metadata, &smithy.SerializationError{Err: err}
    195 	}
    196 
    197 	if request.Request, err = restEncoder.Encode(request.Request); err != nil {
    198 		return out, metadata, &smithy.SerializationError{Err: err}
    199 	}
    200 	in.Request = request
    201 
    202 	return next.HandleSerialize(ctx, in)
    203 }
    204 func awsRestjson1_serializeOpHttpBindingsListAccountsInput(v *ListAccountsInput, encoder *httpbinding.Encoder) error {
    205 	if v == nil {
    206 		return fmt.Errorf("unsupported serialization of nil %T", v)
    207 	}
    208 
    209 	if v.AccessToken != nil && len(*v.AccessToken) > 0 {
    210 		locationName := "X-Amz-Sso_bearer_token"
    211 		encoder.SetHeader(locationName).String(*v.AccessToken)
    212 	}
    213 
    214 	if v.MaxResults != nil {
    215 		encoder.SetQuery("max_result").Integer(*v.MaxResults)
    216 	}
    217 
    218 	if v.NextToken != nil {
    219 		encoder.SetQuery("next_token").String(*v.NextToken)
    220 	}
    221 
    222 	return nil
    223 }
    224 
    225 type awsRestjson1_serializeOpLogout struct {
    226 }
    227 
    228 func (*awsRestjson1_serializeOpLogout) ID() string {
    229 	return "OperationSerializer"
    230 }
    231 
    232 func (m *awsRestjson1_serializeOpLogout) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
    233 	out middleware.SerializeOutput, metadata middleware.Metadata, err error,
    234 ) {
    235 	request, ok := in.Request.(*smithyhttp.Request)
    236 	if !ok {
    237 		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
    238 	}
    239 
    240 	input, ok := in.Parameters.(*LogoutInput)
    241 	_ = input
    242 	if !ok {
    243 		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
    244 	}
    245 
    246 	opPath, opQuery := httpbinding.SplitURI("/logout")
    247 	request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
    248 	request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
    249 	request.Method = "POST"
    250 	var restEncoder *httpbinding.Encoder
    251 	if request.URL.RawPath == "" {
    252 		restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
    253 	} else {
    254 		request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath)
    255 		restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header)
    256 	}
    257 
    258 	if err != nil {
    259 		return out, metadata, &smithy.SerializationError{Err: err}
    260 	}
    261 
    262 	if err := awsRestjson1_serializeOpHttpBindingsLogoutInput(input, restEncoder); err != nil {
    263 		return out, metadata, &smithy.SerializationError{Err: err}
    264 	}
    265 
    266 	if request.Request, err = restEncoder.Encode(request.Request); err != nil {
    267 		return out, metadata, &smithy.SerializationError{Err: err}
    268 	}
    269 	in.Request = request
    270 
    271 	return next.HandleSerialize(ctx, in)
    272 }
    273 func awsRestjson1_serializeOpHttpBindingsLogoutInput(v *LogoutInput, encoder *httpbinding.Encoder) error {
    274 	if v == nil {
    275 		return fmt.Errorf("unsupported serialization of nil %T", v)
    276 	}
    277 
    278 	if v.AccessToken != nil && len(*v.AccessToken) > 0 {
    279 		locationName := "X-Amz-Sso_bearer_token"
    280 		encoder.SetHeader(locationName).String(*v.AccessToken)
    281 	}
    282 
    283 	return nil
    284 }