1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package pricing 4 5import ( 6 "bytes" 7 "context" 8 "fmt" 9 "github.com/aws/aws-sdk-go-v2/service/pricing/types" 10 smithy "github.com/aws/smithy-go" 11 "github.com/aws/smithy-go/encoding/httpbinding" 12 smithyjson "github.com/aws/smithy-go/encoding/json" 13 "github.com/aws/smithy-go/middleware" 14 smithyhttp "github.com/aws/smithy-go/transport/http" 15) 16 17type awsAwsjson11_serializeOpDescribeServices struct { 18} 19 20func (*awsAwsjson11_serializeOpDescribeServices) ID() string { 21 return "OperationSerializer" 22} 23 24func (m *awsAwsjson11_serializeOpDescribeServices) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 25 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 26) { 27 request, ok := in.Request.(*smithyhttp.Request) 28 if !ok { 29 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 30 } 31 32 input, ok := in.Parameters.(*DescribeServicesInput) 33 _ = input 34 if !ok { 35 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 36 } 37 38 request.Request.URL.Path = "/" 39 request.Request.Method = "POST" 40 httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 41 if err != nil { 42 return out, metadata, &smithy.SerializationError{Err: err} 43 } 44 httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") 45 httpBindingEncoder.SetHeader("X-Amz-Target").String("AWSPriceListService.DescribeServices") 46 47 jsonEncoder := smithyjson.NewEncoder() 48 if err := awsAwsjson11_serializeOpDocumentDescribeServicesInput(input, jsonEncoder.Value); err != nil { 49 return out, metadata, &smithy.SerializationError{Err: err} 50 } 51 52 if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { 53 return out, metadata, &smithy.SerializationError{Err: err} 54 } 55 56 if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { 57 return out, metadata, &smithy.SerializationError{Err: err} 58 } 59 in.Request = request 60 61 return next.HandleSerialize(ctx, in) 62} 63 64type awsAwsjson11_serializeOpGetAttributeValues struct { 65} 66 67func (*awsAwsjson11_serializeOpGetAttributeValues) ID() string { 68 return "OperationSerializer" 69} 70 71func (m *awsAwsjson11_serializeOpGetAttributeValues) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 72 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 73) { 74 request, ok := in.Request.(*smithyhttp.Request) 75 if !ok { 76 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 77 } 78 79 input, ok := in.Parameters.(*GetAttributeValuesInput) 80 _ = input 81 if !ok { 82 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 83 } 84 85 request.Request.URL.Path = "/" 86 request.Request.Method = "POST" 87 httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 88 if err != nil { 89 return out, metadata, &smithy.SerializationError{Err: err} 90 } 91 httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") 92 httpBindingEncoder.SetHeader("X-Amz-Target").String("AWSPriceListService.GetAttributeValues") 93 94 jsonEncoder := smithyjson.NewEncoder() 95 if err := awsAwsjson11_serializeOpDocumentGetAttributeValuesInput(input, jsonEncoder.Value); err != nil { 96 return out, metadata, &smithy.SerializationError{Err: err} 97 } 98 99 if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { 100 return out, metadata, &smithy.SerializationError{Err: err} 101 } 102 103 if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { 104 return out, metadata, &smithy.SerializationError{Err: err} 105 } 106 in.Request = request 107 108 return next.HandleSerialize(ctx, in) 109} 110 111type awsAwsjson11_serializeOpGetProducts struct { 112} 113 114func (*awsAwsjson11_serializeOpGetProducts) ID() string { 115 return "OperationSerializer" 116} 117 118func (m *awsAwsjson11_serializeOpGetProducts) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 119 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 120) { 121 request, ok := in.Request.(*smithyhttp.Request) 122 if !ok { 123 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 124 } 125 126 input, ok := in.Parameters.(*GetProductsInput) 127 _ = input 128 if !ok { 129 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 130 } 131 132 request.Request.URL.Path = "/" 133 request.Request.Method = "POST" 134 httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 135 if err != nil { 136 return out, metadata, &smithy.SerializationError{Err: err} 137 } 138 httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") 139 httpBindingEncoder.SetHeader("X-Amz-Target").String("AWSPriceListService.GetProducts") 140 141 jsonEncoder := smithyjson.NewEncoder() 142 if err := awsAwsjson11_serializeOpDocumentGetProductsInput(input, jsonEncoder.Value); err != nil { 143 return out, metadata, &smithy.SerializationError{Err: err} 144 } 145 146 if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { 147 return out, metadata, &smithy.SerializationError{Err: err} 148 } 149 150 if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { 151 return out, metadata, &smithy.SerializationError{Err: err} 152 } 153 in.Request = request 154 155 return next.HandleSerialize(ctx, in) 156} 157func awsAwsjson11_serializeDocumentFilter(v *types.Filter, value smithyjson.Value) error { 158 object := value.Object() 159 defer object.Close() 160 161 if v.Field != nil { 162 ok := object.Key("Field") 163 ok.String(*v.Field) 164 } 165 166 if len(v.Type) > 0 { 167 ok := object.Key("Type") 168 ok.String(string(v.Type)) 169 } 170 171 if v.Value != nil { 172 ok := object.Key("Value") 173 ok.String(*v.Value) 174 } 175 176 return nil 177} 178 179func awsAwsjson11_serializeDocumentFilters(v []types.Filter, value smithyjson.Value) error { 180 array := value.Array() 181 defer array.Close() 182 183 for i := range v { 184 av := array.Value() 185 if err := awsAwsjson11_serializeDocumentFilter(&v[i], av); err != nil { 186 return err 187 } 188 } 189 return nil 190} 191 192func awsAwsjson11_serializeOpDocumentDescribeServicesInput(v *DescribeServicesInput, value smithyjson.Value) error { 193 object := value.Object() 194 defer object.Close() 195 196 if v.FormatVersion != nil { 197 ok := object.Key("FormatVersion") 198 ok.String(*v.FormatVersion) 199 } 200 201 if v.MaxResults != 0 { 202 ok := object.Key("MaxResults") 203 ok.Integer(v.MaxResults) 204 } 205 206 if v.NextToken != nil { 207 ok := object.Key("NextToken") 208 ok.String(*v.NextToken) 209 } 210 211 if v.ServiceCode != nil { 212 ok := object.Key("ServiceCode") 213 ok.String(*v.ServiceCode) 214 } 215 216 return nil 217} 218 219func awsAwsjson11_serializeOpDocumentGetAttributeValuesInput(v *GetAttributeValuesInput, value smithyjson.Value) error { 220 object := value.Object() 221 defer object.Close() 222 223 if v.AttributeName != nil { 224 ok := object.Key("AttributeName") 225 ok.String(*v.AttributeName) 226 } 227 228 if v.MaxResults != 0 { 229 ok := object.Key("MaxResults") 230 ok.Integer(v.MaxResults) 231 } 232 233 if v.NextToken != nil { 234 ok := object.Key("NextToken") 235 ok.String(*v.NextToken) 236 } 237 238 if v.ServiceCode != nil { 239 ok := object.Key("ServiceCode") 240 ok.String(*v.ServiceCode) 241 } 242 243 return nil 244} 245 246func awsAwsjson11_serializeOpDocumentGetProductsInput(v *GetProductsInput, value smithyjson.Value) error { 247 object := value.Object() 248 defer object.Close() 249 250 if v.Filters != nil { 251 ok := object.Key("Filters") 252 if err := awsAwsjson11_serializeDocumentFilters(v.Filters, ok); err != nil { 253 return err 254 } 255 } 256 257 if v.FormatVersion != nil { 258 ok := object.Key("FormatVersion") 259 ok.String(*v.FormatVersion) 260 } 261 262 if v.MaxResults != 0 { 263 ok := object.Key("MaxResults") 264 ok.Integer(v.MaxResults) 265 } 266 267 if v.NextToken != nil { 268 ok := object.Key("NextToken") 269 ok.String(*v.NextToken) 270 } 271 272 if v.ServiceCode != nil { 273 ok := object.Key("ServiceCode") 274 ok.String(*v.ServiceCode) 275 } 276 277 return nil 278} 279