src

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

validators.go (4946B)


      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/middleware"
     10 )
     11 
     12 type validateOpGetRoleCredentials struct {
     13 }
     14 
     15 func (*validateOpGetRoleCredentials) ID() string {
     16 	return "OperationInputValidation"
     17 }
     18 
     19 func (m *validateOpGetRoleCredentials) 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.(*GetRoleCredentialsInput)
     23 	if !ok {
     24 		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
     25 	}
     26 	if err := validateOpGetRoleCredentialsInput(input); err != nil {
     27 		return out, metadata, err
     28 	}
     29 	return next.HandleInitialize(ctx, in)
     30 }
     31 
     32 type validateOpListAccountRoles struct {
     33 }
     34 
     35 func (*validateOpListAccountRoles) ID() string {
     36 	return "OperationInputValidation"
     37 }
     38 
     39 func (m *validateOpListAccountRoles) 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.(*ListAccountRolesInput)
     43 	if !ok {
     44 		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
     45 	}
     46 	if err := validateOpListAccountRolesInput(input); err != nil {
     47 		return out, metadata, err
     48 	}
     49 	return next.HandleInitialize(ctx, in)
     50 }
     51 
     52 type validateOpListAccounts struct {
     53 }
     54 
     55 func (*validateOpListAccounts) ID() string {
     56 	return "OperationInputValidation"
     57 }
     58 
     59 func (m *validateOpListAccounts) 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.(*ListAccountsInput)
     63 	if !ok {
     64 		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
     65 	}
     66 	if err := validateOpListAccountsInput(input); err != nil {
     67 		return out, metadata, err
     68 	}
     69 	return next.HandleInitialize(ctx, in)
     70 }
     71 
     72 type validateOpLogout struct {
     73 }
     74 
     75 func (*validateOpLogout) ID() string {
     76 	return "OperationInputValidation"
     77 }
     78 
     79 func (m *validateOpLogout) 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.(*LogoutInput)
     83 	if !ok {
     84 		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
     85 	}
     86 	if err := validateOpLogoutInput(input); err != nil {
     87 		return out, metadata, err
     88 	}
     89 	return next.HandleInitialize(ctx, in)
     90 }
     91 
     92 func addOpGetRoleCredentialsValidationMiddleware(stack *middleware.Stack) error {
     93 	return stack.Initialize.Add(&validateOpGetRoleCredentials{}, middleware.After)
     94 }
     95 
     96 func addOpListAccountRolesValidationMiddleware(stack *middleware.Stack) error {
     97 	return stack.Initialize.Add(&validateOpListAccountRoles{}, middleware.After)
     98 }
     99 
    100 func addOpListAccountsValidationMiddleware(stack *middleware.Stack) error {
    101 	return stack.Initialize.Add(&validateOpListAccounts{}, middleware.After)
    102 }
    103 
    104 func addOpLogoutValidationMiddleware(stack *middleware.Stack) error {
    105 	return stack.Initialize.Add(&validateOpLogout{}, middleware.After)
    106 }
    107 
    108 func validateOpGetRoleCredentialsInput(v *GetRoleCredentialsInput) error {
    109 	if v == nil {
    110 		return nil
    111 	}
    112 	invalidParams := smithy.InvalidParamsError{Context: "GetRoleCredentialsInput"}
    113 	if v.RoleName == nil {
    114 		invalidParams.Add(smithy.NewErrParamRequired("RoleName"))
    115 	}
    116 	if v.AccountId == nil {
    117 		invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
    118 	}
    119 	if v.AccessToken == nil {
    120 		invalidParams.Add(smithy.NewErrParamRequired("AccessToken"))
    121 	}
    122 	if invalidParams.Len() > 0 {
    123 		return invalidParams
    124 	} else {
    125 		return nil
    126 	}
    127 }
    128 
    129 func validateOpListAccountRolesInput(v *ListAccountRolesInput) error {
    130 	if v == nil {
    131 		return nil
    132 	}
    133 	invalidParams := smithy.InvalidParamsError{Context: "ListAccountRolesInput"}
    134 	if v.AccessToken == nil {
    135 		invalidParams.Add(smithy.NewErrParamRequired("AccessToken"))
    136 	}
    137 	if v.AccountId == nil {
    138 		invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
    139 	}
    140 	if invalidParams.Len() > 0 {
    141 		return invalidParams
    142 	} else {
    143 		return nil
    144 	}
    145 }
    146 
    147 func validateOpListAccountsInput(v *ListAccountsInput) error {
    148 	if v == nil {
    149 		return nil
    150 	}
    151 	invalidParams := smithy.InvalidParamsError{Context: "ListAccountsInput"}
    152 	if v.AccessToken == nil {
    153 		invalidParams.Add(smithy.NewErrParamRequired("AccessToken"))
    154 	}
    155 	if invalidParams.Len() > 0 {
    156 		return invalidParams
    157 	} else {
    158 		return nil
    159 	}
    160 }
    161 
    162 func validateOpLogoutInput(v *LogoutInput) error {
    163 	if v == nil {
    164 		return nil
    165 	}
    166 	invalidParams := smithy.InvalidParamsError{Context: "LogoutInput"}
    167 	if v.AccessToken == nil {
    168 		invalidParams.Add(smithy.NewErrParamRequired("AccessToken"))
    169 	}
    170 	if invalidParams.Len() > 0 {
    171 		return invalidParams
    172 	} else {
    173 		return nil
    174 	}
    175 }