| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512 |
- // 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
- }
|