1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package kinesisvideoarchivedmedia 4 5import ( 6 "context" 7 "fmt" 8 "github.com/aws/aws-sdk-go-v2/service/kinesisvideoarchivedmedia/types" 9 smithy "github.com/aws/smithy-go" 10 "github.com/aws/smithy-go/middleware" 11) 12 13type validateOpGetClip struct { 14} 15 16func (*validateOpGetClip) ID() string { 17 return "OperationInputValidation" 18} 19 20func (m *validateOpGetClip) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( 21 out middleware.InitializeOutput, metadata middleware.Metadata, err error, 22) { 23 input, ok := in.Parameters.(*GetClipInput) 24 if !ok { 25 return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) 26 } 27 if err := validateOpGetClipInput(input); err != nil { 28 return out, metadata, err 29 } 30 return next.HandleInitialize(ctx, in) 31} 32 33type validateOpGetMediaForFragmentList struct { 34} 35 36func (*validateOpGetMediaForFragmentList) ID() string { 37 return "OperationInputValidation" 38} 39 40func (m *validateOpGetMediaForFragmentList) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( 41 out middleware.InitializeOutput, metadata middleware.Metadata, err error, 42) { 43 input, ok := in.Parameters.(*GetMediaForFragmentListInput) 44 if !ok { 45 return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) 46 } 47 if err := validateOpGetMediaForFragmentListInput(input); err != nil { 48 return out, metadata, err 49 } 50 return next.HandleInitialize(ctx, in) 51} 52 53type validateOpListFragments struct { 54} 55 56func (*validateOpListFragments) ID() string { 57 return "OperationInputValidation" 58} 59 60func (m *validateOpListFragments) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( 61 out middleware.InitializeOutput, metadata middleware.Metadata, err error, 62) { 63 input, ok := in.Parameters.(*ListFragmentsInput) 64 if !ok { 65 return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) 66 } 67 if err := validateOpListFragmentsInput(input); err != nil { 68 return out, metadata, err 69 } 70 return next.HandleInitialize(ctx, in) 71} 72 73func addOpGetClipValidationMiddleware(stack *middleware.Stack) error { 74 return stack.Initialize.Add(&validateOpGetClip{}, middleware.After) 75} 76 77func addOpGetMediaForFragmentListValidationMiddleware(stack *middleware.Stack) error { 78 return stack.Initialize.Add(&validateOpGetMediaForFragmentList{}, middleware.After) 79} 80 81func addOpListFragmentsValidationMiddleware(stack *middleware.Stack) error { 82 return stack.Initialize.Add(&validateOpListFragments{}, middleware.After) 83} 84 85func validateClipFragmentSelector(v *types.ClipFragmentSelector) error { 86 if v == nil { 87 return nil 88 } 89 invalidParams := smithy.InvalidParamsError{Context: "ClipFragmentSelector"} 90 if len(v.FragmentSelectorType) == 0 { 91 invalidParams.Add(smithy.NewErrParamRequired("FragmentSelectorType")) 92 } 93 if v.TimestampRange == nil { 94 invalidParams.Add(smithy.NewErrParamRequired("TimestampRange")) 95 } else if v.TimestampRange != nil { 96 if err := validateClipTimestampRange(v.TimestampRange); err != nil { 97 invalidParams.AddNested("TimestampRange", err.(smithy.InvalidParamsError)) 98 } 99 } 100 if invalidParams.Len() > 0 { 101 return invalidParams 102 } else { 103 return nil 104 } 105} 106 107func validateClipTimestampRange(v *types.ClipTimestampRange) error { 108 if v == nil { 109 return nil 110 } 111 invalidParams := smithy.InvalidParamsError{Context: "ClipTimestampRange"} 112 if v.StartTimestamp == nil { 113 invalidParams.Add(smithy.NewErrParamRequired("StartTimestamp")) 114 } 115 if v.EndTimestamp == nil { 116 invalidParams.Add(smithy.NewErrParamRequired("EndTimestamp")) 117 } 118 if invalidParams.Len() > 0 { 119 return invalidParams 120 } else { 121 return nil 122 } 123} 124 125func validateFragmentSelector(v *types.FragmentSelector) error { 126 if v == nil { 127 return nil 128 } 129 invalidParams := smithy.InvalidParamsError{Context: "FragmentSelector"} 130 if len(v.FragmentSelectorType) == 0 { 131 invalidParams.Add(smithy.NewErrParamRequired("FragmentSelectorType")) 132 } 133 if v.TimestampRange == nil { 134 invalidParams.Add(smithy.NewErrParamRequired("TimestampRange")) 135 } else if v.TimestampRange != nil { 136 if err := validateTimestampRange(v.TimestampRange); err != nil { 137 invalidParams.AddNested("TimestampRange", err.(smithy.InvalidParamsError)) 138 } 139 } 140 if invalidParams.Len() > 0 { 141 return invalidParams 142 } else { 143 return nil 144 } 145} 146 147func validateTimestampRange(v *types.TimestampRange) error { 148 if v == nil { 149 return nil 150 } 151 invalidParams := smithy.InvalidParamsError{Context: "TimestampRange"} 152 if v.StartTimestamp == nil { 153 invalidParams.Add(smithy.NewErrParamRequired("StartTimestamp")) 154 } 155 if v.EndTimestamp == nil { 156 invalidParams.Add(smithy.NewErrParamRequired("EndTimestamp")) 157 } 158 if invalidParams.Len() > 0 { 159 return invalidParams 160 } else { 161 return nil 162 } 163} 164 165func validateOpGetClipInput(v *GetClipInput) error { 166 if v == nil { 167 return nil 168 } 169 invalidParams := smithy.InvalidParamsError{Context: "GetClipInput"} 170 if v.ClipFragmentSelector == nil { 171 invalidParams.Add(smithy.NewErrParamRequired("ClipFragmentSelector")) 172 } else if v.ClipFragmentSelector != nil { 173 if err := validateClipFragmentSelector(v.ClipFragmentSelector); err != nil { 174 invalidParams.AddNested("ClipFragmentSelector", err.(smithy.InvalidParamsError)) 175 } 176 } 177 if invalidParams.Len() > 0 { 178 return invalidParams 179 } else { 180 return nil 181 } 182} 183 184func validateOpGetMediaForFragmentListInput(v *GetMediaForFragmentListInput) error { 185 if v == nil { 186 return nil 187 } 188 invalidParams := smithy.InvalidParamsError{Context: "GetMediaForFragmentListInput"} 189 if v.StreamName == nil { 190 invalidParams.Add(smithy.NewErrParamRequired("StreamName")) 191 } 192 if v.Fragments == nil { 193 invalidParams.Add(smithy.NewErrParamRequired("Fragments")) 194 } 195 if invalidParams.Len() > 0 { 196 return invalidParams 197 } else { 198 return nil 199 } 200} 201 202func validateOpListFragmentsInput(v *ListFragmentsInput) error { 203 if v == nil { 204 return nil 205 } 206 invalidParams := smithy.InvalidParamsError{Context: "ListFragmentsInput"} 207 if v.StreamName == nil { 208 invalidParams.Add(smithy.NewErrParamRequired("StreamName")) 209 } 210 if v.FragmentSelector != nil { 211 if err := validateFragmentSelector(v.FragmentSelector); err != nil { 212 invalidParams.AddNested("FragmentSelector", err.(smithy.InvalidParamsError)) 213 } 214 } 215 if invalidParams.Len() > 0 { 216 return invalidParams 217 } else { 218 return nil 219 } 220} 221