// Code generated by smithy-go-codegen DO NOT EDIT. package ssooidc import ( "bytes" "context" "fmt" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/encoding/httpbinding" smithyjson "github.com/aws/smithy-go/encoding/json" "github.com/aws/smithy-go/middleware" "github.com/aws/smithy-go/tracing" smithyhttp "github.com/aws/smithy-go/transport/http" ) type awsRestjson1_serializeOpCreateToken struct { } func (*awsRestjson1_serializeOpCreateToken) ID() string { return "OperationSerializer" } func (m *awsRestjson1_serializeOpCreateToken) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { _, span := tracing.StartSpan(ctx, "OperationSerializer") endTimer := startMetricTimer(ctx, "client.call.serialization_duration") defer endTimer() defer span.End() request, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } input, ok := in.Parameters.(*CreateTokenInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/token") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "POST" var restEncoder *httpbinding.Encoder if request.URL.RawPath == "" { restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) } else { request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) } if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } restEncoder.SetHeader("Content-Type").String("application/json") jsonEncoder := smithyjson.NewEncoder() if err := awsRestjson1_serializeOpDocumentCreateTokenInput(input, jsonEncoder.Value); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if request.Request, err = restEncoder.Encode(request.Request); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } in.Request = request endTimer() span.End() return next.HandleSerialize(ctx, in) } func awsRestjson1_serializeOpHttpBindingsCreateTokenInput(v *CreateTokenInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } return nil } func awsRestjson1_serializeOpDocumentCreateTokenInput(v *CreateTokenInput, value smithyjson.Value) error { object := value.Object() defer object.Close() if v.ClientId != nil { ok := object.Key("clientId") ok.String(*v.ClientId) } if v.ClientSecret != nil { ok := object.Key("clientSecret") ok.String(*v.ClientSecret) } if v.Code != nil { ok := object.Key("code") ok.String(*v.Code) } if v.CodeVerifier != nil { ok := object.Key("codeVerifier") ok.String(*v.CodeVerifier) } if v.DeviceCode != nil { ok := object.Key("deviceCode") ok.String(*v.DeviceCode) } if v.GrantType != nil { ok := object.Key("grantType") ok.String(*v.GrantType) } if v.RedirectUri != nil { ok := object.Key("redirectUri") ok.String(*v.RedirectUri) } if v.RefreshToken != nil { ok := object.Key("refreshToken") ok.String(*v.RefreshToken) } if v.Scope != nil { ok := object.Key("scope") if err := awsRestjson1_serializeDocumentScopes(v.Scope, ok); err != nil { return err } } return nil } type awsRestjson1_serializeOpCreateTokenWithIAM struct { } func (*awsRestjson1_serializeOpCreateTokenWithIAM) ID() string { return "OperationSerializer" } func (m *awsRestjson1_serializeOpCreateTokenWithIAM) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { _, span := tracing.StartSpan(ctx, "OperationSerializer") endTimer := startMetricTimer(ctx, "client.call.serialization_duration") defer endTimer() defer span.End() request, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } input, ok := in.Parameters.(*CreateTokenWithIAMInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/token?aws_iam=t") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "POST" var restEncoder *httpbinding.Encoder if request.URL.RawPath == "" { restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) } else { request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) } if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } restEncoder.SetHeader("Content-Type").String("application/json") jsonEncoder := smithyjson.NewEncoder() if err := awsRestjson1_serializeOpDocumentCreateTokenWithIAMInput(input, jsonEncoder.Value); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if request.Request, err = restEncoder.Encode(request.Request); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } in.Request = request endTimer() span.End() return next.HandleSerialize(ctx, in) } func awsRestjson1_serializeOpHttpBindingsCreateTokenWithIAMInput(v *CreateTokenWithIAMInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } return nil } func awsRestjson1_serializeOpDocumentCreateTokenWithIAMInput(v *CreateTokenWithIAMInput, value smithyjson.Value) error { object := value.Object() defer object.Close() if v.Assertion != nil { ok := object.Key("assertion") ok.String(*v.Assertion) } if v.ClientId != nil { ok := object.Key("clientId") ok.String(*v.ClientId) } if v.Code != nil { ok := object.Key("code") ok.String(*v.Code) } if v.CodeVerifier != nil { ok := object.Key("codeVerifier") ok.String(*v.CodeVerifier) } if v.GrantType != nil { ok := object.Key("grantType") ok.String(*v.GrantType) } if v.RedirectUri != nil { ok := object.Key("redirectUri") ok.String(*v.RedirectUri) } if v.RefreshToken != nil { ok := object.Key("refreshToken") ok.String(*v.RefreshToken) } if v.RequestedTokenType != nil { ok := object.Key("requestedTokenType") ok.String(*v.RequestedTokenType) } if v.Scope != nil { ok := object.Key("scope") if err := awsRestjson1_serializeDocumentScopes(v.Scope, ok); err != nil { return err } } if v.SubjectToken != nil { ok := object.Key("subjectToken") ok.String(*v.SubjectToken) } if v.SubjectTokenType != nil { ok := object.Key("subjectTokenType") ok.String(*v.SubjectTokenType) } return nil } type awsRestjson1_serializeOpRegisterClient struct { } func (*awsRestjson1_serializeOpRegisterClient) ID() string { return "OperationSerializer" } func (m *awsRestjson1_serializeOpRegisterClient) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { _, span := tracing.StartSpan(ctx, "OperationSerializer") endTimer := startMetricTimer(ctx, "client.call.serialization_duration") defer endTimer() defer span.End() request, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } input, ok := in.Parameters.(*RegisterClientInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/client/register") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "POST" var restEncoder *httpbinding.Encoder if request.URL.RawPath == "" { restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) } else { request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) } if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } restEncoder.SetHeader("Content-Type").String("application/json") jsonEncoder := smithyjson.NewEncoder() if err := awsRestjson1_serializeOpDocumentRegisterClientInput(input, jsonEncoder.Value); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if request.Request, err = restEncoder.Encode(request.Request); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } in.Request = request endTimer() span.End() return next.HandleSerialize(ctx, in) } func awsRestjson1_serializeOpHttpBindingsRegisterClientInput(v *RegisterClientInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } return nil } func awsRestjson1_serializeOpDocumentRegisterClientInput(v *RegisterClientInput, value smithyjson.Value) error { object := value.Object() defer object.Close() if v.ClientName != nil { ok := object.Key("clientName") ok.String(*v.ClientName) } if v.ClientType != nil { ok := object.Key("clientType") ok.String(*v.ClientType) } if v.EntitledApplicationArn != nil { ok := object.Key("entitledApplicationArn") ok.String(*v.EntitledApplicationArn) } if v.GrantTypes != nil { ok := object.Key("grantTypes") if err := awsRestjson1_serializeDocumentGrantTypes(v.GrantTypes, ok); err != nil { return err } } if v.IssuerUrl != nil { ok := object.Key("issuerUrl") ok.String(*v.IssuerUrl) } if v.RedirectUris != nil { ok := object.Key("redirectUris") if err := awsRestjson1_serializeDocumentRedirectUris(v.RedirectUris, ok); err != nil { return err } } if v.Scopes != nil { ok := object.Key("scopes") if err := awsRestjson1_serializeDocumentScopes(v.Scopes, ok); err != nil { return err } } return nil } type awsRestjson1_serializeOpStartDeviceAuthorization struct { } func (*awsRestjson1_serializeOpStartDeviceAuthorization) ID() string { return "OperationSerializer" } func (m *awsRestjson1_serializeOpStartDeviceAuthorization) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { _, span := tracing.StartSpan(ctx, "OperationSerializer") endTimer := startMetricTimer(ctx, "client.call.serialization_duration") defer endTimer() defer span.End() request, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } input, ok := in.Parameters.(*StartDeviceAuthorizationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/device_authorization") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "POST" var restEncoder *httpbinding.Encoder if request.URL.RawPath == "" { restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) } else { request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) } if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } restEncoder.SetHeader("Content-Type").String("application/json") jsonEncoder := smithyjson.NewEncoder() if err := awsRestjson1_serializeOpDocumentStartDeviceAuthorizationInput(input, jsonEncoder.Value); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if request.Request, err = restEncoder.Encode(request.Request); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } in.Request = request endTimer() span.End() return next.HandleSerialize(ctx, in) } func awsRestjson1_serializeOpHttpBindingsStartDeviceAuthorizationInput(v *StartDeviceAuthorizationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } return nil } func awsRestjson1_serializeOpDocumentStartDeviceAuthorizationInput(v *StartDeviceAuthorizationInput, value smithyjson.Value) error { object := value.Object() defer object.Close() if v.ClientId != nil { ok := object.Key("clientId") ok.String(*v.ClientId) } if v.ClientSecret != nil { ok := object.Key("clientSecret") ok.String(*v.ClientSecret) } if v.StartUrl != nil { ok := object.Key("startUrl") ok.String(*v.StartUrl) } return nil } func awsRestjson1_serializeDocumentGrantTypes(v []string, value smithyjson.Value) error { array := value.Array() defer array.Close() for i := range v { av := array.Value() av.String(v[i]) } return nil } func awsRestjson1_serializeDocumentRedirectUris(v []string, value smithyjson.Value) error { array := value.Array() defer array.Close() for i := range v { av := array.Value() av.String(v[i]) } return nil } func awsRestjson1_serializeDocumentScopes(v []string, value smithyjson.Value) error { array := value.Array() defer array.Close() for i := range v { av := array.Value() av.String(v[i]) } return nil }