src

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

validators.go (5361B)


      1 // Code generated by smithy-go-codegen DO NOT EDIT.
      2 
      3 package ssooidc
      4 
      5 import (
      6 	"context"
      7 	"fmt"
      8 	smithy "github.com/aws/smithy-go"
      9 	"github.com/aws/smithy-go/middleware"
     10 )
     11 
     12 type validateOpCreateToken struct {
     13 }
     14 
     15 func (*validateOpCreateToken) ID() string {
     16 	return "OperationInputValidation"
     17 }
     18 
     19 func (m *validateOpCreateToken) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
     20 	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
     21 ) {
     22 	input, ok := in.Parameters.(*CreateTokenInput)
     23 	if !ok {
     24 		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
     25 	}
     26 	if err := validateOpCreateTokenInput(input); err != nil {
     27 		return out, metadata, err
     28 	}
     29 	return next.HandleInitialize(ctx, in)
     30 }
     31 
     32 type validateOpCreateTokenWithIAM struct {
     33 }
     34 
     35 func (*validateOpCreateTokenWithIAM) ID() string {
     36 	return "OperationInputValidation"
     37 }
     38 
     39 func (m *validateOpCreateTokenWithIAM) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
     40 	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
     41 ) {
     42 	input, ok := in.Parameters.(*CreateTokenWithIAMInput)
     43 	if !ok {
     44 		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
     45 	}
     46 	if err := validateOpCreateTokenWithIAMInput(input); err != nil {
     47 		return out, metadata, err
     48 	}
     49 	return next.HandleInitialize(ctx, in)
     50 }
     51 
     52 type validateOpRegisterClient struct {
     53 }
     54 
     55 func (*validateOpRegisterClient) ID() string {
     56 	return "OperationInputValidation"
     57 }
     58 
     59 func (m *validateOpRegisterClient) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
     60 	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
     61 ) {
     62 	input, ok := in.Parameters.(*RegisterClientInput)
     63 	if !ok {
     64 		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
     65 	}
     66 	if err := validateOpRegisterClientInput(input); err != nil {
     67 		return out, metadata, err
     68 	}
     69 	return next.HandleInitialize(ctx, in)
     70 }
     71 
     72 type validateOpStartDeviceAuthorization struct {
     73 }
     74 
     75 func (*validateOpStartDeviceAuthorization) ID() string {
     76 	return "OperationInputValidation"
     77 }
     78 
     79 func (m *validateOpStartDeviceAuthorization) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
     80 	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
     81 ) {
     82 	input, ok := in.Parameters.(*StartDeviceAuthorizationInput)
     83 	if !ok {
     84 		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
     85 	}
     86 	if err := validateOpStartDeviceAuthorizationInput(input); err != nil {
     87 		return out, metadata, err
     88 	}
     89 	return next.HandleInitialize(ctx, in)
     90 }
     91 
     92 func addOpCreateTokenValidationMiddleware(stack *middleware.Stack) error {
     93 	return stack.Initialize.Add(&validateOpCreateToken{}, middleware.After)
     94 }
     95 
     96 func addOpCreateTokenWithIAMValidationMiddleware(stack *middleware.Stack) error {
     97 	return stack.Initialize.Add(&validateOpCreateTokenWithIAM{}, middleware.After)
     98 }
     99 
    100 func addOpRegisterClientValidationMiddleware(stack *middleware.Stack) error {
    101 	return stack.Initialize.Add(&validateOpRegisterClient{}, middleware.After)
    102 }
    103 
    104 func addOpStartDeviceAuthorizationValidationMiddleware(stack *middleware.Stack) error {
    105 	return stack.Initialize.Add(&validateOpStartDeviceAuthorization{}, middleware.After)
    106 }
    107 
    108 func validateOpCreateTokenInput(v *CreateTokenInput) error {
    109 	if v == nil {
    110 		return nil
    111 	}
    112 	invalidParams := smithy.InvalidParamsError{Context: "CreateTokenInput"}
    113 	if v.ClientId == nil {
    114 		invalidParams.Add(smithy.NewErrParamRequired("ClientId"))
    115 	}
    116 	if v.ClientSecret == nil {
    117 		invalidParams.Add(smithy.NewErrParamRequired("ClientSecret"))
    118 	}
    119 	if v.GrantType == nil {
    120 		invalidParams.Add(smithy.NewErrParamRequired("GrantType"))
    121 	}
    122 	if invalidParams.Len() > 0 {
    123 		return invalidParams
    124 	} else {
    125 		return nil
    126 	}
    127 }
    128 
    129 func validateOpCreateTokenWithIAMInput(v *CreateTokenWithIAMInput) error {
    130 	if v == nil {
    131 		return nil
    132 	}
    133 	invalidParams := smithy.InvalidParamsError{Context: "CreateTokenWithIAMInput"}
    134 	if v.ClientId == nil {
    135 		invalidParams.Add(smithy.NewErrParamRequired("ClientId"))
    136 	}
    137 	if v.GrantType == nil {
    138 		invalidParams.Add(smithy.NewErrParamRequired("GrantType"))
    139 	}
    140 	if invalidParams.Len() > 0 {
    141 		return invalidParams
    142 	} else {
    143 		return nil
    144 	}
    145 }
    146 
    147 func validateOpRegisterClientInput(v *RegisterClientInput) error {
    148 	if v == nil {
    149 		return nil
    150 	}
    151 	invalidParams := smithy.InvalidParamsError{Context: "RegisterClientInput"}
    152 	if v.ClientName == nil {
    153 		invalidParams.Add(smithy.NewErrParamRequired("ClientName"))
    154 	}
    155 	if v.ClientType == nil {
    156 		invalidParams.Add(smithy.NewErrParamRequired("ClientType"))
    157 	}
    158 	if invalidParams.Len() > 0 {
    159 		return invalidParams
    160 	} else {
    161 		return nil
    162 	}
    163 }
    164 
    165 func validateOpStartDeviceAuthorizationInput(v *StartDeviceAuthorizationInput) error {
    166 	if v == nil {
    167 		return nil
    168 	}
    169 	invalidParams := smithy.InvalidParamsError{Context: "StartDeviceAuthorizationInput"}
    170 	if v.ClientId == nil {
    171 		invalidParams.Add(smithy.NewErrParamRequired("ClientId"))
    172 	}
    173 	if v.ClientSecret == nil {
    174 		invalidParams.Add(smithy.NewErrParamRequired("ClientSecret"))
    175 	}
    176 	if v.StartUrl == nil {
    177 		invalidParams.Add(smithy.NewErrParamRequired("StartUrl"))
    178 	}
    179 	if invalidParams.Len() > 0 {
    180 		return invalidParams
    181 	} else {
    182 		return nil
    183 	}
    184 }