1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package restxml 4 5import ( 6 "bytes" 7 "context" 8 "fmt" 9 "github.com/aws/aws-sdk-go-v2/internal/protocoltest/restxml/types" 10 smithy "github.com/aws/smithy-go" 11 "github.com/aws/smithy-go/encoding/httpbinding" 12 smithyxml "github.com/aws/smithy-go/encoding/xml" 13 "github.com/aws/smithy-go/middleware" 14 smithytime "github.com/aws/smithy-go/time" 15 smithyhttp "github.com/aws/smithy-go/transport/http" 16 "math" 17 "net/http" 18 "time" 19) 20 21type awsRestxml_serializeOpAllQueryStringTypes struct { 22} 23 24func (*awsRestxml_serializeOpAllQueryStringTypes) ID() string { 25 return "OperationSerializer" 26} 27 28func (m *awsRestxml_serializeOpAllQueryStringTypes) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 29 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 30) { 31 request, ok := in.Request.(*smithyhttp.Request) 32 if !ok { 33 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 34 } 35 36 input, ok := in.Parameters.(*AllQueryStringTypesInput) 37 _ = input 38 if !ok { 39 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 40 } 41 42 opPath, opQuery := httpbinding.SplitURI("/AllQueryStringTypesInput") 43 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 44 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 45 request.Method = "GET" 46 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 47 if err != nil { 48 return out, metadata, &smithy.SerializationError{Err: err} 49 } 50 51 if err := awsRestxml_serializeOpHttpBindingsAllQueryStringTypesInput(input, restEncoder); err != nil { 52 return out, metadata, &smithy.SerializationError{Err: err} 53 } 54 55 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 56 return out, metadata, &smithy.SerializationError{Err: err} 57 } 58 in.Request = request 59 60 return next.HandleSerialize(ctx, in) 61} 62func awsRestxml_serializeOpHttpBindingsAllQueryStringTypesInput(v *AllQueryStringTypesInput, encoder *httpbinding.Encoder) error { 63 if v == nil { 64 return fmt.Errorf("unsupported serialization of nil %T", v) 65 } 66 67 if v.QueryBoolean != nil { 68 encoder.SetQuery("Boolean").Boolean(*v.QueryBoolean) 69 } 70 71 if v.QueryBooleanList != nil { 72 for i := range v.QueryBooleanList { 73 encoder.AddQuery("BooleanList").Boolean(v.QueryBooleanList[i]) 74 } 75 } 76 77 if v.QueryByte != nil { 78 encoder.SetQuery("Byte").Byte(*v.QueryByte) 79 } 80 81 if v.QueryDouble != nil { 82 encoder.SetQuery("Double").Double(*v.QueryDouble) 83 } 84 85 if v.QueryDoubleList != nil { 86 for i := range v.QueryDoubleList { 87 encoder.AddQuery("DoubleList").Double(v.QueryDoubleList[i]) 88 } 89 } 90 91 if len(v.QueryEnum) > 0 { 92 encoder.SetQuery("Enum").String(string(v.QueryEnum)) 93 } 94 95 if v.QueryEnumList != nil { 96 for i := range v.QueryEnumList { 97 encoder.AddQuery("EnumList").String(string(v.QueryEnumList[i])) 98 } 99 } 100 101 if v.QueryFloat != nil { 102 encoder.SetQuery("Float").Float(*v.QueryFloat) 103 } 104 105 if v.QueryInteger != nil { 106 encoder.SetQuery("Integer").Integer(*v.QueryInteger) 107 } 108 109 if v.QueryIntegerList != nil { 110 for i := range v.QueryIntegerList { 111 encoder.AddQuery("IntegerList").Integer(v.QueryIntegerList[i]) 112 } 113 } 114 115 if v.QueryIntegerSet != nil { 116 for i := range v.QueryIntegerSet { 117 encoder.AddQuery("IntegerSet").Integer(v.QueryIntegerSet[i]) 118 } 119 } 120 121 if v.QueryLong != nil { 122 encoder.SetQuery("Long").Long(*v.QueryLong) 123 } 124 125 if v.QueryParamsMapOfStrings != nil { 126 for qkey, qvalue := range v.QueryParamsMapOfStrings { 127 if encoder.HasQuery(qkey) { 128 continue 129 } 130 encoder.SetQuery(qkey).String(qvalue) 131 } 132 } 133 134 if v.QueryShort != nil { 135 encoder.SetQuery("Short").Short(*v.QueryShort) 136 } 137 138 if v.QueryString != nil { 139 encoder.SetQuery("String").String(*v.QueryString) 140 } 141 142 if v.QueryStringList != nil { 143 for i := range v.QueryStringList { 144 encoder.AddQuery("StringList").String(v.QueryStringList[i]) 145 } 146 } 147 148 if v.QueryStringSet != nil { 149 for i := range v.QueryStringSet { 150 encoder.AddQuery("StringSet").String(v.QueryStringSet[i]) 151 } 152 } 153 154 if v.QueryTimestamp != nil { 155 encoder.SetQuery("Timestamp").String(smithytime.FormatDateTime(*v.QueryTimestamp)) 156 } 157 158 if v.QueryTimestampList != nil { 159 for i := range v.QueryTimestampList { 160 encoder.AddQuery("TimestampList").String(smithytime.FormatDateTime(v.QueryTimestampList[i])) 161 } 162 } 163 164 return nil 165} 166 167type awsRestxml_serializeOpBodyWithXmlName struct { 168} 169 170func (*awsRestxml_serializeOpBodyWithXmlName) ID() string { 171 return "OperationSerializer" 172} 173 174func (m *awsRestxml_serializeOpBodyWithXmlName) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 175 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 176) { 177 request, ok := in.Request.(*smithyhttp.Request) 178 if !ok { 179 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 180 } 181 182 input, ok := in.Parameters.(*BodyWithXmlNameInput) 183 _ = input 184 if !ok { 185 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 186 } 187 188 opPath, opQuery := httpbinding.SplitURI("/BodyWithXmlName") 189 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 190 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 191 request.Method = "PUT" 192 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 193 if err != nil { 194 return out, metadata, &smithy.SerializationError{Err: err} 195 } 196 197 restEncoder.SetHeader("Content-Type").String("application/xml") 198 199 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 200 rootAttr := []smithyxml.Attr{} 201 root := smithyxml.StartElement{ 202 Name: smithyxml.Name{ 203 Local: "Ahoy", 204 }, 205 Attr: rootAttr, 206 } 207 if err := awsRestxml_serializeOpDocumentBodyWithXmlNameInput(input, xmlEncoder.RootElement(root)); err != nil { 208 return out, metadata, &smithy.SerializationError{Err: err} 209 } 210 if request, err = request.SetStream(bytes.NewReader(xmlEncoder.Bytes())); err != nil { 211 return out, metadata, &smithy.SerializationError{Err: err} 212 } 213 214 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 215 return out, metadata, &smithy.SerializationError{Err: err} 216 } 217 in.Request = request 218 219 return next.HandleSerialize(ctx, in) 220} 221func awsRestxml_serializeOpHttpBindingsBodyWithXmlNameInput(v *BodyWithXmlNameInput, encoder *httpbinding.Encoder) error { 222 if v == nil { 223 return fmt.Errorf("unsupported serialization of nil %T", v) 224 } 225 226 return nil 227} 228 229func awsRestxml_serializeOpDocumentBodyWithXmlNameInput(v *BodyWithXmlNameInput, value smithyxml.Value) error { 230 defer value.Close() 231 if v.Nested != nil { 232 rootAttr := []smithyxml.Attr{} 233 root := smithyxml.StartElement{ 234 Name: smithyxml.Name{ 235 Local: "nested", 236 }, 237 Attr: rootAttr, 238 } 239 el := value.MemberElement(root) 240 if err := awsRestxml_serializeDocumentPayloadWithXmlName(v.Nested, el); err != nil { 241 return err 242 } 243 } 244 return nil 245} 246 247type awsRestxml_serializeOpConstantAndVariableQueryString struct { 248} 249 250func (*awsRestxml_serializeOpConstantAndVariableQueryString) ID() string { 251 return "OperationSerializer" 252} 253 254func (m *awsRestxml_serializeOpConstantAndVariableQueryString) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 255 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 256) { 257 request, ok := in.Request.(*smithyhttp.Request) 258 if !ok { 259 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 260 } 261 262 input, ok := in.Parameters.(*ConstantAndVariableQueryStringInput) 263 _ = input 264 if !ok { 265 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 266 } 267 268 opPath, opQuery := httpbinding.SplitURI("/ConstantAndVariableQueryString?foo=bar") 269 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 270 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 271 request.Method = "GET" 272 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 273 if err != nil { 274 return out, metadata, &smithy.SerializationError{Err: err} 275 } 276 277 if err := awsRestxml_serializeOpHttpBindingsConstantAndVariableQueryStringInput(input, restEncoder); err != nil { 278 return out, metadata, &smithy.SerializationError{Err: err} 279 } 280 281 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 282 return out, metadata, &smithy.SerializationError{Err: err} 283 } 284 in.Request = request 285 286 return next.HandleSerialize(ctx, in) 287} 288func awsRestxml_serializeOpHttpBindingsConstantAndVariableQueryStringInput(v *ConstantAndVariableQueryStringInput, encoder *httpbinding.Encoder) error { 289 if v == nil { 290 return fmt.Errorf("unsupported serialization of nil %T", v) 291 } 292 293 if v.Baz != nil { 294 encoder.SetQuery("baz").String(*v.Baz) 295 } 296 297 if v.MaybeSet != nil { 298 encoder.SetQuery("maybeSet").String(*v.MaybeSet) 299 } 300 301 return nil 302} 303 304type awsRestxml_serializeOpConstantQueryString struct { 305} 306 307func (*awsRestxml_serializeOpConstantQueryString) ID() string { 308 return "OperationSerializer" 309} 310 311func (m *awsRestxml_serializeOpConstantQueryString) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 312 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 313) { 314 request, ok := in.Request.(*smithyhttp.Request) 315 if !ok { 316 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 317 } 318 319 input, ok := in.Parameters.(*ConstantQueryStringInput) 320 _ = input 321 if !ok { 322 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 323 } 324 325 opPath, opQuery := httpbinding.SplitURI("/ConstantQueryString/{hello}?foo=bar&hello") 326 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 327 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 328 request.Method = "GET" 329 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 330 if err != nil { 331 return out, metadata, &smithy.SerializationError{Err: err} 332 } 333 334 if err := awsRestxml_serializeOpHttpBindingsConstantQueryStringInput(input, restEncoder); err != nil { 335 return out, metadata, &smithy.SerializationError{Err: err} 336 } 337 338 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 339 return out, metadata, &smithy.SerializationError{Err: err} 340 } 341 in.Request = request 342 343 return next.HandleSerialize(ctx, in) 344} 345func awsRestxml_serializeOpHttpBindingsConstantQueryStringInput(v *ConstantQueryStringInput, encoder *httpbinding.Encoder) error { 346 if v == nil { 347 return fmt.Errorf("unsupported serialization of nil %T", v) 348 } 349 350 if v.Hello == nil || len(*v.Hello) == 0 { 351 return &smithy.SerializationError{Err: fmt.Errorf("input member hello must not be empty")} 352 } 353 if v.Hello != nil { 354 if err := encoder.SetURI("hello").String(*v.Hello); err != nil { 355 return err 356 } 357 } 358 359 return nil 360} 361 362type awsRestxml_serializeOpEmptyInputAndEmptyOutput struct { 363} 364 365func (*awsRestxml_serializeOpEmptyInputAndEmptyOutput) ID() string { 366 return "OperationSerializer" 367} 368 369func (m *awsRestxml_serializeOpEmptyInputAndEmptyOutput) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 370 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 371) { 372 request, ok := in.Request.(*smithyhttp.Request) 373 if !ok { 374 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 375 } 376 377 input, ok := in.Parameters.(*EmptyInputAndEmptyOutputInput) 378 _ = input 379 if !ok { 380 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 381 } 382 383 opPath, opQuery := httpbinding.SplitURI("/EmptyInputAndEmptyOutput") 384 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 385 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 386 request.Method = "POST" 387 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 388 if err != nil { 389 return out, metadata, &smithy.SerializationError{Err: err} 390 } 391 392 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 393 return out, metadata, &smithy.SerializationError{Err: err} 394 } 395 in.Request = request 396 397 return next.HandleSerialize(ctx, in) 398} 399func awsRestxml_serializeOpHttpBindingsEmptyInputAndEmptyOutputInput(v *EmptyInputAndEmptyOutputInput, encoder *httpbinding.Encoder) error { 400 if v == nil { 401 return fmt.Errorf("unsupported serialization of nil %T", v) 402 } 403 404 return nil 405} 406 407type awsRestxml_serializeOpEndpointOperation struct { 408} 409 410func (*awsRestxml_serializeOpEndpointOperation) ID() string { 411 return "OperationSerializer" 412} 413 414func (m *awsRestxml_serializeOpEndpointOperation) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 415 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 416) { 417 request, ok := in.Request.(*smithyhttp.Request) 418 if !ok { 419 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 420 } 421 422 input, ok := in.Parameters.(*EndpointOperationInput) 423 _ = input 424 if !ok { 425 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 426 } 427 428 opPath, opQuery := httpbinding.SplitURI("/EndpointOperation") 429 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 430 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 431 request.Method = "POST" 432 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 433 if err != nil { 434 return out, metadata, &smithy.SerializationError{Err: err} 435 } 436 437 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 438 return out, metadata, &smithy.SerializationError{Err: err} 439 } 440 in.Request = request 441 442 return next.HandleSerialize(ctx, in) 443} 444func awsRestxml_serializeOpHttpBindingsEndpointOperationInput(v *EndpointOperationInput, encoder *httpbinding.Encoder) error { 445 if v == nil { 446 return fmt.Errorf("unsupported serialization of nil %T", v) 447 } 448 449 return nil 450} 451 452type awsRestxml_serializeOpEndpointWithHostLabelHeaderOperation struct { 453} 454 455func (*awsRestxml_serializeOpEndpointWithHostLabelHeaderOperation) ID() string { 456 return "OperationSerializer" 457} 458 459func (m *awsRestxml_serializeOpEndpointWithHostLabelHeaderOperation) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 460 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 461) { 462 request, ok := in.Request.(*smithyhttp.Request) 463 if !ok { 464 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 465 } 466 467 input, ok := in.Parameters.(*EndpointWithHostLabelHeaderOperationInput) 468 _ = input 469 if !ok { 470 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 471 } 472 473 opPath, opQuery := httpbinding.SplitURI("/EndpointWithHostLabelHeaderOperation") 474 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 475 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 476 request.Method = "POST" 477 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 478 if err != nil { 479 return out, metadata, &smithy.SerializationError{Err: err} 480 } 481 482 if err := awsRestxml_serializeOpHttpBindingsEndpointWithHostLabelHeaderOperationInput(input, restEncoder); err != nil { 483 return out, metadata, &smithy.SerializationError{Err: err} 484 } 485 486 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 487 return out, metadata, &smithy.SerializationError{Err: err} 488 } 489 in.Request = request 490 491 return next.HandleSerialize(ctx, in) 492} 493func awsRestxml_serializeOpHttpBindingsEndpointWithHostLabelHeaderOperationInput(v *EndpointWithHostLabelHeaderOperationInput, encoder *httpbinding.Encoder) error { 494 if v == nil { 495 return fmt.Errorf("unsupported serialization of nil %T", v) 496 } 497 498 if v.AccountId != nil && len(*v.AccountId) > 0 { 499 locationName := "X-Amz-Account-Id" 500 encoder.SetHeader(locationName).String(*v.AccountId) 501 } 502 503 return nil 504} 505 506type awsRestxml_serializeOpEndpointWithHostLabelOperation struct { 507} 508 509func (*awsRestxml_serializeOpEndpointWithHostLabelOperation) ID() string { 510 return "OperationSerializer" 511} 512 513func (m *awsRestxml_serializeOpEndpointWithHostLabelOperation) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 514 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 515) { 516 request, ok := in.Request.(*smithyhttp.Request) 517 if !ok { 518 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 519 } 520 521 input, ok := in.Parameters.(*EndpointWithHostLabelOperationInput) 522 _ = input 523 if !ok { 524 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 525 } 526 527 opPath, opQuery := httpbinding.SplitURI("/EndpointWithHostLabelOperation") 528 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 529 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 530 request.Method = "POST" 531 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 532 if err != nil { 533 return out, metadata, &smithy.SerializationError{Err: err} 534 } 535 536 restEncoder.SetHeader("Content-Type").String("application/xml") 537 538 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 539 rootAttr := []smithyxml.Attr{} 540 root := smithyxml.StartElement{ 541 Name: smithyxml.Name{ 542 Local: "HostLabelInput", 543 }, 544 Attr: rootAttr, 545 } 546 if err := awsRestxml_serializeOpDocumentEndpointWithHostLabelOperationInput(input, xmlEncoder.RootElement(root)); err != nil { 547 return out, metadata, &smithy.SerializationError{Err: err} 548 } 549 if request, err = request.SetStream(bytes.NewReader(xmlEncoder.Bytes())); err != nil { 550 return out, metadata, &smithy.SerializationError{Err: err} 551 } 552 553 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 554 return out, metadata, &smithy.SerializationError{Err: err} 555 } 556 in.Request = request 557 558 return next.HandleSerialize(ctx, in) 559} 560func awsRestxml_serializeOpHttpBindingsEndpointWithHostLabelOperationInput(v *EndpointWithHostLabelOperationInput, encoder *httpbinding.Encoder) error { 561 if v == nil { 562 return fmt.Errorf("unsupported serialization of nil %T", v) 563 } 564 565 return nil 566} 567 568func awsRestxml_serializeOpDocumentEndpointWithHostLabelOperationInput(v *EndpointWithHostLabelOperationInput, value smithyxml.Value) error { 569 defer value.Close() 570 if v.Label != nil { 571 rootAttr := []smithyxml.Attr{} 572 root := smithyxml.StartElement{ 573 Name: smithyxml.Name{ 574 Local: "label", 575 }, 576 Attr: rootAttr, 577 } 578 el := value.MemberElement(root) 579 el.String(*v.Label) 580 } 581 return nil 582} 583 584type awsRestxml_serializeOpFlattenedXmlMap struct { 585} 586 587func (*awsRestxml_serializeOpFlattenedXmlMap) ID() string { 588 return "OperationSerializer" 589} 590 591func (m *awsRestxml_serializeOpFlattenedXmlMap) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 592 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 593) { 594 request, ok := in.Request.(*smithyhttp.Request) 595 if !ok { 596 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 597 } 598 599 input, ok := in.Parameters.(*FlattenedXmlMapInput) 600 _ = input 601 if !ok { 602 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 603 } 604 605 opPath, opQuery := httpbinding.SplitURI("/FlattenedXmlMap") 606 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 607 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 608 request.Method = "POST" 609 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 610 if err != nil { 611 return out, metadata, &smithy.SerializationError{Err: err} 612 } 613 614 restEncoder.SetHeader("Content-Type").String("application/xml") 615 616 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 617 rootAttr := []smithyxml.Attr{} 618 root := smithyxml.StartElement{ 619 Name: smithyxml.Name{ 620 Local: "FlattenedXmlMapInputOutput", 621 }, 622 Attr: rootAttr, 623 } 624 if err := awsRestxml_serializeOpDocumentFlattenedXmlMapInput(input, xmlEncoder.RootElement(root)); err != nil { 625 return out, metadata, &smithy.SerializationError{Err: err} 626 } 627 if request, err = request.SetStream(bytes.NewReader(xmlEncoder.Bytes())); err != nil { 628 return out, metadata, &smithy.SerializationError{Err: err} 629 } 630 631 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 632 return out, metadata, &smithy.SerializationError{Err: err} 633 } 634 in.Request = request 635 636 return next.HandleSerialize(ctx, in) 637} 638func awsRestxml_serializeOpHttpBindingsFlattenedXmlMapInput(v *FlattenedXmlMapInput, encoder *httpbinding.Encoder) error { 639 if v == nil { 640 return fmt.Errorf("unsupported serialization of nil %T", v) 641 } 642 643 return nil 644} 645 646func awsRestxml_serializeOpDocumentFlattenedXmlMapInput(v *FlattenedXmlMapInput, value smithyxml.Value) error { 647 defer value.Close() 648 if v.MyMap != nil { 649 rootAttr := []smithyxml.Attr{} 650 root := smithyxml.StartElement{ 651 Name: smithyxml.Name{ 652 Local: "myMap", 653 }, 654 Attr: rootAttr, 655 } 656 el := value.FlattenedElement(root) 657 if err := awsRestxml_serializeDocumentFooEnumMap(v.MyMap, el); err != nil { 658 return err 659 } 660 } 661 return nil 662} 663 664type awsRestxml_serializeOpFlattenedXmlMapWithXmlName struct { 665} 666 667func (*awsRestxml_serializeOpFlattenedXmlMapWithXmlName) ID() string { 668 return "OperationSerializer" 669} 670 671func (m *awsRestxml_serializeOpFlattenedXmlMapWithXmlName) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 672 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 673) { 674 request, ok := in.Request.(*smithyhttp.Request) 675 if !ok { 676 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 677 } 678 679 input, ok := in.Parameters.(*FlattenedXmlMapWithXmlNameInput) 680 _ = input 681 if !ok { 682 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 683 } 684 685 opPath, opQuery := httpbinding.SplitURI("/FlattenedXmlMapWithXmlName") 686 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 687 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 688 request.Method = "POST" 689 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 690 if err != nil { 691 return out, metadata, &smithy.SerializationError{Err: err} 692 } 693 694 restEncoder.SetHeader("Content-Type").String("application/xml") 695 696 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 697 rootAttr := []smithyxml.Attr{} 698 root := smithyxml.StartElement{ 699 Name: smithyxml.Name{ 700 Local: "FlattenedXmlMapWithXmlNameInputOutput", 701 }, 702 Attr: rootAttr, 703 } 704 if err := awsRestxml_serializeOpDocumentFlattenedXmlMapWithXmlNameInput(input, xmlEncoder.RootElement(root)); err != nil { 705 return out, metadata, &smithy.SerializationError{Err: err} 706 } 707 if request, err = request.SetStream(bytes.NewReader(xmlEncoder.Bytes())); err != nil { 708 return out, metadata, &smithy.SerializationError{Err: err} 709 } 710 711 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 712 return out, metadata, &smithy.SerializationError{Err: err} 713 } 714 in.Request = request 715 716 return next.HandleSerialize(ctx, in) 717} 718func awsRestxml_serializeOpHttpBindingsFlattenedXmlMapWithXmlNameInput(v *FlattenedXmlMapWithXmlNameInput, encoder *httpbinding.Encoder) error { 719 if v == nil { 720 return fmt.Errorf("unsupported serialization of nil %T", v) 721 } 722 723 return nil 724} 725 726func awsRestxml_serializeOpDocumentFlattenedXmlMapWithXmlNameInput(v *FlattenedXmlMapWithXmlNameInput, value smithyxml.Value) error { 727 defer value.Close() 728 if v.MyMap != nil { 729 rootAttr := []smithyxml.Attr{} 730 root := smithyxml.StartElement{ 731 Name: smithyxml.Name{ 732 Local: "KVP", 733 }, 734 Attr: rootAttr, 735 } 736 el := value.FlattenedElement(root) 737 if err := awsRestxml_serializeDocumentFlattenedXmlMapWithXmlNameInputOutputMap(v.MyMap, el); err != nil { 738 return err 739 } 740 } 741 return nil 742} 743 744type awsRestxml_serializeOpFlattenedXmlMapWithXmlNamespace struct { 745} 746 747func (*awsRestxml_serializeOpFlattenedXmlMapWithXmlNamespace) ID() string { 748 return "OperationSerializer" 749} 750 751func (m *awsRestxml_serializeOpFlattenedXmlMapWithXmlNamespace) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 752 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 753) { 754 request, ok := in.Request.(*smithyhttp.Request) 755 if !ok { 756 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 757 } 758 759 input, ok := in.Parameters.(*FlattenedXmlMapWithXmlNamespaceInput) 760 _ = input 761 if !ok { 762 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 763 } 764 765 opPath, opQuery := httpbinding.SplitURI("/FlattenedXmlMapWithXmlNamespace") 766 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 767 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 768 request.Method = "POST" 769 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 770 if err != nil { 771 return out, metadata, &smithy.SerializationError{Err: err} 772 } 773 774 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 775 return out, metadata, &smithy.SerializationError{Err: err} 776 } 777 in.Request = request 778 779 return next.HandleSerialize(ctx, in) 780} 781func awsRestxml_serializeOpHttpBindingsFlattenedXmlMapWithXmlNamespaceInput(v *FlattenedXmlMapWithXmlNamespaceInput, encoder *httpbinding.Encoder) error { 782 if v == nil { 783 return fmt.Errorf("unsupported serialization of nil %T", v) 784 } 785 786 return nil 787} 788 789type awsRestxml_serializeOpGreetingWithErrors struct { 790} 791 792func (*awsRestxml_serializeOpGreetingWithErrors) ID() string { 793 return "OperationSerializer" 794} 795 796func (m *awsRestxml_serializeOpGreetingWithErrors) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 797 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 798) { 799 request, ok := in.Request.(*smithyhttp.Request) 800 if !ok { 801 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 802 } 803 804 input, ok := in.Parameters.(*GreetingWithErrorsInput) 805 _ = input 806 if !ok { 807 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 808 } 809 810 opPath, opQuery := httpbinding.SplitURI("/GreetingWithErrors") 811 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 812 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 813 request.Method = "PUT" 814 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 815 if err != nil { 816 return out, metadata, &smithy.SerializationError{Err: err} 817 } 818 819 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 820 return out, metadata, &smithy.SerializationError{Err: err} 821 } 822 in.Request = request 823 824 return next.HandleSerialize(ctx, in) 825} 826func awsRestxml_serializeOpHttpBindingsGreetingWithErrorsInput(v *GreetingWithErrorsInput, encoder *httpbinding.Encoder) error { 827 if v == nil { 828 return fmt.Errorf("unsupported serialization of nil %T", v) 829 } 830 831 return nil 832} 833 834type awsRestxml_serializeOpHttpPayloadTraits struct { 835} 836 837func (*awsRestxml_serializeOpHttpPayloadTraits) ID() string { 838 return "OperationSerializer" 839} 840 841func (m *awsRestxml_serializeOpHttpPayloadTraits) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 842 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 843) { 844 request, ok := in.Request.(*smithyhttp.Request) 845 if !ok { 846 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 847 } 848 849 input, ok := in.Parameters.(*HttpPayloadTraitsInput) 850 _ = input 851 if !ok { 852 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 853 } 854 855 opPath, opQuery := httpbinding.SplitURI("/HttpPayloadTraits") 856 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 857 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 858 request.Method = "POST" 859 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 860 if err != nil { 861 return out, metadata, &smithy.SerializationError{Err: err} 862 } 863 864 if err := awsRestxml_serializeOpHttpBindingsHttpPayloadTraitsInput(input, restEncoder); err != nil { 865 return out, metadata, &smithy.SerializationError{Err: err} 866 } 867 868 if input.Blob != nil { 869 if !restEncoder.HasHeader("Content-Type") { 870 restEncoder.SetHeader("Content-Type").String("application/octet-stream") 871 } 872 873 payload := bytes.NewReader(input.Blob) 874 if request, err = request.SetStream(payload); err != nil { 875 return out, metadata, &smithy.SerializationError{Err: err} 876 } 877 } 878 879 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 880 return out, metadata, &smithy.SerializationError{Err: err} 881 } 882 in.Request = request 883 884 return next.HandleSerialize(ctx, in) 885} 886func awsRestxml_serializeOpHttpBindingsHttpPayloadTraitsInput(v *HttpPayloadTraitsInput, encoder *httpbinding.Encoder) error { 887 if v == nil { 888 return fmt.Errorf("unsupported serialization of nil %T", v) 889 } 890 891 if v.Foo != nil && len(*v.Foo) > 0 { 892 locationName := "X-Foo" 893 encoder.SetHeader(locationName).String(*v.Foo) 894 } 895 896 return nil 897} 898 899type awsRestxml_serializeOpHttpPayloadTraitsWithMediaType struct { 900} 901 902func (*awsRestxml_serializeOpHttpPayloadTraitsWithMediaType) ID() string { 903 return "OperationSerializer" 904} 905 906func (m *awsRestxml_serializeOpHttpPayloadTraitsWithMediaType) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 907 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 908) { 909 request, ok := in.Request.(*smithyhttp.Request) 910 if !ok { 911 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 912 } 913 914 input, ok := in.Parameters.(*HttpPayloadTraitsWithMediaTypeInput) 915 _ = input 916 if !ok { 917 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 918 } 919 920 opPath, opQuery := httpbinding.SplitURI("/HttpPayloadTraitsWithMediaType") 921 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 922 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 923 request.Method = "POST" 924 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 925 if err != nil { 926 return out, metadata, &smithy.SerializationError{Err: err} 927 } 928 929 if err := awsRestxml_serializeOpHttpBindingsHttpPayloadTraitsWithMediaTypeInput(input, restEncoder); err != nil { 930 return out, metadata, &smithy.SerializationError{Err: err} 931 } 932 933 if input.Blob != nil { 934 if !restEncoder.HasHeader("Content-Type") { 935 restEncoder.SetHeader("Content-Type").String("text/plain") 936 } 937 938 payload := bytes.NewReader(input.Blob) 939 if request, err = request.SetStream(payload); err != nil { 940 return out, metadata, &smithy.SerializationError{Err: err} 941 } 942 } 943 944 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 945 return out, metadata, &smithy.SerializationError{Err: err} 946 } 947 in.Request = request 948 949 return next.HandleSerialize(ctx, in) 950} 951func awsRestxml_serializeOpHttpBindingsHttpPayloadTraitsWithMediaTypeInput(v *HttpPayloadTraitsWithMediaTypeInput, encoder *httpbinding.Encoder) error { 952 if v == nil { 953 return fmt.Errorf("unsupported serialization of nil %T", v) 954 } 955 956 if v.Foo != nil && len(*v.Foo) > 0 { 957 locationName := "X-Foo" 958 encoder.SetHeader(locationName).String(*v.Foo) 959 } 960 961 return nil 962} 963 964type awsRestxml_serializeOpHttpPayloadWithMemberXmlName struct { 965} 966 967func (*awsRestxml_serializeOpHttpPayloadWithMemberXmlName) ID() string { 968 return "OperationSerializer" 969} 970 971func (m *awsRestxml_serializeOpHttpPayloadWithMemberXmlName) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 972 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 973) { 974 request, ok := in.Request.(*smithyhttp.Request) 975 if !ok { 976 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 977 } 978 979 input, ok := in.Parameters.(*HttpPayloadWithMemberXmlNameInput) 980 _ = input 981 if !ok { 982 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 983 } 984 985 opPath, opQuery := httpbinding.SplitURI("/HttpPayloadWithMemberXmlName") 986 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 987 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 988 request.Method = "PUT" 989 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 990 if err != nil { 991 return out, metadata, &smithy.SerializationError{Err: err} 992 } 993 994 if input.Nested != nil { 995 if !restEncoder.HasHeader("Content-Type") { 996 restEncoder.SetHeader("Content-Type").String("application/xml") 997 } 998 999 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 1000 payloadRootAttr := []smithyxml.Attr{} 1001 payloadRoot := smithyxml.StartElement{ 1002 Name: smithyxml.Name{ 1003 Local: "Hola", 1004 }, 1005 Attr: payloadRootAttr, 1006 } 1007 if err := awsRestxml_serializeDocumentPayloadWithXmlName(input.Nested, xmlEncoder.RootElement(payloadRoot)); err != nil { 1008 return out, metadata, &smithy.SerializationError{Err: err} 1009 } 1010 payload := bytes.NewReader(xmlEncoder.Bytes()) 1011 if request, err = request.SetStream(payload); err != nil { 1012 return out, metadata, &smithy.SerializationError{Err: err} 1013 } 1014 } 1015 1016 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 1017 return out, metadata, &smithy.SerializationError{Err: err} 1018 } 1019 in.Request = request 1020 1021 return next.HandleSerialize(ctx, in) 1022} 1023func awsRestxml_serializeOpHttpBindingsHttpPayloadWithMemberXmlNameInput(v *HttpPayloadWithMemberXmlNameInput, encoder *httpbinding.Encoder) error { 1024 if v == nil { 1025 return fmt.Errorf("unsupported serialization of nil %T", v) 1026 } 1027 1028 return nil 1029} 1030 1031type awsRestxml_serializeOpHttpPayloadWithStructure struct { 1032} 1033 1034func (*awsRestxml_serializeOpHttpPayloadWithStructure) ID() string { 1035 return "OperationSerializer" 1036} 1037 1038func (m *awsRestxml_serializeOpHttpPayloadWithStructure) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 1039 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 1040) { 1041 request, ok := in.Request.(*smithyhttp.Request) 1042 if !ok { 1043 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 1044 } 1045 1046 input, ok := in.Parameters.(*HttpPayloadWithStructureInput) 1047 _ = input 1048 if !ok { 1049 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 1050 } 1051 1052 opPath, opQuery := httpbinding.SplitURI("/HttpPayloadWithStructure") 1053 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 1054 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 1055 request.Method = "PUT" 1056 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 1057 if err != nil { 1058 return out, metadata, &smithy.SerializationError{Err: err} 1059 } 1060 1061 if input.Nested != nil { 1062 if !restEncoder.HasHeader("Content-Type") { 1063 restEncoder.SetHeader("Content-Type").String("application/xml") 1064 } 1065 1066 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 1067 payloadRootAttr := []smithyxml.Attr{} 1068 payloadRoot := smithyxml.StartElement{ 1069 Name: smithyxml.Name{ 1070 Local: "NestedPayload", 1071 }, 1072 Attr: payloadRootAttr, 1073 } 1074 if err := awsRestxml_serializeDocumentNestedPayload(input.Nested, xmlEncoder.RootElement(payloadRoot)); err != nil { 1075 return out, metadata, &smithy.SerializationError{Err: err} 1076 } 1077 payload := bytes.NewReader(xmlEncoder.Bytes()) 1078 if request, err = request.SetStream(payload); err != nil { 1079 return out, metadata, &smithy.SerializationError{Err: err} 1080 } 1081 } 1082 1083 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 1084 return out, metadata, &smithy.SerializationError{Err: err} 1085 } 1086 in.Request = request 1087 1088 return next.HandleSerialize(ctx, in) 1089} 1090func awsRestxml_serializeOpHttpBindingsHttpPayloadWithStructureInput(v *HttpPayloadWithStructureInput, encoder *httpbinding.Encoder) error { 1091 if v == nil { 1092 return fmt.Errorf("unsupported serialization of nil %T", v) 1093 } 1094 1095 return nil 1096} 1097 1098type awsRestxml_serializeOpHttpPayloadWithXmlName struct { 1099} 1100 1101func (*awsRestxml_serializeOpHttpPayloadWithXmlName) ID() string { 1102 return "OperationSerializer" 1103} 1104 1105func (m *awsRestxml_serializeOpHttpPayloadWithXmlName) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 1106 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 1107) { 1108 request, ok := in.Request.(*smithyhttp.Request) 1109 if !ok { 1110 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 1111 } 1112 1113 input, ok := in.Parameters.(*HttpPayloadWithXmlNameInput) 1114 _ = input 1115 if !ok { 1116 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 1117 } 1118 1119 opPath, opQuery := httpbinding.SplitURI("/HttpPayloadWithXmlName") 1120 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 1121 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 1122 request.Method = "PUT" 1123 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 1124 if err != nil { 1125 return out, metadata, &smithy.SerializationError{Err: err} 1126 } 1127 1128 if input.Nested != nil { 1129 if !restEncoder.HasHeader("Content-Type") { 1130 restEncoder.SetHeader("Content-Type").String("application/xml") 1131 } 1132 1133 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 1134 payloadRootAttr := []smithyxml.Attr{} 1135 payloadRoot := smithyxml.StartElement{ 1136 Name: smithyxml.Name{ 1137 Local: "Hello", 1138 }, 1139 Attr: payloadRootAttr, 1140 } 1141 if err := awsRestxml_serializeDocumentPayloadWithXmlName(input.Nested, xmlEncoder.RootElement(payloadRoot)); err != nil { 1142 return out, metadata, &smithy.SerializationError{Err: err} 1143 } 1144 payload := bytes.NewReader(xmlEncoder.Bytes()) 1145 if request, err = request.SetStream(payload); err != nil { 1146 return out, metadata, &smithy.SerializationError{Err: err} 1147 } 1148 } 1149 1150 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 1151 return out, metadata, &smithy.SerializationError{Err: err} 1152 } 1153 in.Request = request 1154 1155 return next.HandleSerialize(ctx, in) 1156} 1157func awsRestxml_serializeOpHttpBindingsHttpPayloadWithXmlNameInput(v *HttpPayloadWithXmlNameInput, encoder *httpbinding.Encoder) error { 1158 if v == nil { 1159 return fmt.Errorf("unsupported serialization of nil %T", v) 1160 } 1161 1162 return nil 1163} 1164 1165type awsRestxml_serializeOpHttpPayloadWithXmlNamespace struct { 1166} 1167 1168func (*awsRestxml_serializeOpHttpPayloadWithXmlNamespace) ID() string { 1169 return "OperationSerializer" 1170} 1171 1172func (m *awsRestxml_serializeOpHttpPayloadWithXmlNamespace) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 1173 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 1174) { 1175 request, ok := in.Request.(*smithyhttp.Request) 1176 if !ok { 1177 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 1178 } 1179 1180 input, ok := in.Parameters.(*HttpPayloadWithXmlNamespaceInput) 1181 _ = input 1182 if !ok { 1183 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 1184 } 1185 1186 opPath, opQuery := httpbinding.SplitURI("/HttpPayloadWithXmlNamespace") 1187 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 1188 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 1189 request.Method = "PUT" 1190 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 1191 if err != nil { 1192 return out, metadata, &smithy.SerializationError{Err: err} 1193 } 1194 1195 if input.Nested != nil { 1196 if !restEncoder.HasHeader("Content-Type") { 1197 restEncoder.SetHeader("Content-Type").String("application/xml") 1198 } 1199 1200 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 1201 payloadRootAttr := []smithyxml.Attr{} 1202 payloadRootAttr = append(payloadRootAttr, smithyxml.NewNamespaceAttribute("", "http://foo.com")) 1203 payloadRoot := smithyxml.StartElement{ 1204 Name: smithyxml.Name{ 1205 Local: "PayloadWithXmlNamespace", 1206 }, 1207 Attr: payloadRootAttr, 1208 } 1209 if err := awsRestxml_serializeDocumentPayloadWithXmlNamespace(input.Nested, xmlEncoder.RootElement(payloadRoot)); err != nil { 1210 return out, metadata, &smithy.SerializationError{Err: err} 1211 } 1212 payload := bytes.NewReader(xmlEncoder.Bytes()) 1213 if request, err = request.SetStream(payload); err != nil { 1214 return out, metadata, &smithy.SerializationError{Err: err} 1215 } 1216 } 1217 1218 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 1219 return out, metadata, &smithy.SerializationError{Err: err} 1220 } 1221 in.Request = request 1222 1223 return next.HandleSerialize(ctx, in) 1224} 1225func awsRestxml_serializeOpHttpBindingsHttpPayloadWithXmlNamespaceInput(v *HttpPayloadWithXmlNamespaceInput, encoder *httpbinding.Encoder) error { 1226 if v == nil { 1227 return fmt.Errorf("unsupported serialization of nil %T", v) 1228 } 1229 1230 return nil 1231} 1232 1233type awsRestxml_serializeOpHttpPayloadWithXmlNamespaceAndPrefix struct { 1234} 1235 1236func (*awsRestxml_serializeOpHttpPayloadWithXmlNamespaceAndPrefix) ID() string { 1237 return "OperationSerializer" 1238} 1239 1240func (m *awsRestxml_serializeOpHttpPayloadWithXmlNamespaceAndPrefix) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 1241 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 1242) { 1243 request, ok := in.Request.(*smithyhttp.Request) 1244 if !ok { 1245 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 1246 } 1247 1248 input, ok := in.Parameters.(*HttpPayloadWithXmlNamespaceAndPrefixInput) 1249 _ = input 1250 if !ok { 1251 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 1252 } 1253 1254 opPath, opQuery := httpbinding.SplitURI("/HttpPayloadWithXmlNamespaceAndPrefix") 1255 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 1256 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 1257 request.Method = "PUT" 1258 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 1259 if err != nil { 1260 return out, metadata, &smithy.SerializationError{Err: err} 1261 } 1262 1263 if input.Nested != nil { 1264 if !restEncoder.HasHeader("Content-Type") { 1265 restEncoder.SetHeader("Content-Type").String("application/xml") 1266 } 1267 1268 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 1269 payloadRootAttr := []smithyxml.Attr{} 1270 payloadRootAttr = append(payloadRootAttr, smithyxml.NewNamespaceAttribute("baz", "http://foo.com")) 1271 payloadRoot := smithyxml.StartElement{ 1272 Name: smithyxml.Name{ 1273 Local: "PayloadWithXmlNamespaceAndPrefix", 1274 }, 1275 Attr: payloadRootAttr, 1276 } 1277 if err := awsRestxml_serializeDocumentPayloadWithXmlNamespaceAndPrefix(input.Nested, xmlEncoder.RootElement(payloadRoot)); err != nil { 1278 return out, metadata, &smithy.SerializationError{Err: err} 1279 } 1280 payload := bytes.NewReader(xmlEncoder.Bytes()) 1281 if request, err = request.SetStream(payload); err != nil { 1282 return out, metadata, &smithy.SerializationError{Err: err} 1283 } 1284 } 1285 1286 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 1287 return out, metadata, &smithy.SerializationError{Err: err} 1288 } 1289 in.Request = request 1290 1291 return next.HandleSerialize(ctx, in) 1292} 1293func awsRestxml_serializeOpHttpBindingsHttpPayloadWithXmlNamespaceAndPrefixInput(v *HttpPayloadWithXmlNamespaceAndPrefixInput, encoder *httpbinding.Encoder) error { 1294 if v == nil { 1295 return fmt.Errorf("unsupported serialization of nil %T", v) 1296 } 1297 1298 return nil 1299} 1300 1301type awsRestxml_serializeOpHttpPrefixHeaders struct { 1302} 1303 1304func (*awsRestxml_serializeOpHttpPrefixHeaders) ID() string { 1305 return "OperationSerializer" 1306} 1307 1308func (m *awsRestxml_serializeOpHttpPrefixHeaders) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 1309 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 1310) { 1311 request, ok := in.Request.(*smithyhttp.Request) 1312 if !ok { 1313 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 1314 } 1315 1316 input, ok := in.Parameters.(*HttpPrefixHeadersInput) 1317 _ = input 1318 if !ok { 1319 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 1320 } 1321 1322 opPath, opQuery := httpbinding.SplitURI("/HttpPrefixHeaders") 1323 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 1324 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 1325 request.Method = "GET" 1326 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 1327 if err != nil { 1328 return out, metadata, &smithy.SerializationError{Err: err} 1329 } 1330 1331 if err := awsRestxml_serializeOpHttpBindingsHttpPrefixHeadersInput(input, restEncoder); err != nil { 1332 return out, metadata, &smithy.SerializationError{Err: err} 1333 } 1334 1335 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 1336 return out, metadata, &smithy.SerializationError{Err: err} 1337 } 1338 in.Request = request 1339 1340 return next.HandleSerialize(ctx, in) 1341} 1342func awsRestxml_serializeOpHttpBindingsHttpPrefixHeadersInput(v *HttpPrefixHeadersInput, encoder *httpbinding.Encoder) error { 1343 if v == nil { 1344 return fmt.Errorf("unsupported serialization of nil %T", v) 1345 } 1346 1347 if v.Foo != nil && len(*v.Foo) > 0 { 1348 locationName := "X-Foo" 1349 encoder.SetHeader(locationName).String(*v.Foo) 1350 } 1351 1352 if v.FooMap != nil { 1353 hv := encoder.Headers("X-Foo-") 1354 for mapKey, mapVal := range v.FooMap { 1355 if len(mapVal) > 0 { 1356 hv.SetHeader(http.CanonicalHeaderKey(mapKey)).String(mapVal) 1357 } 1358 } 1359 } 1360 1361 return nil 1362} 1363 1364type awsRestxml_serializeOpHttpRequestWithFloatLabels struct { 1365} 1366 1367func (*awsRestxml_serializeOpHttpRequestWithFloatLabels) ID() string { 1368 return "OperationSerializer" 1369} 1370 1371func (m *awsRestxml_serializeOpHttpRequestWithFloatLabels) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 1372 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 1373) { 1374 request, ok := in.Request.(*smithyhttp.Request) 1375 if !ok { 1376 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 1377 } 1378 1379 input, ok := in.Parameters.(*HttpRequestWithFloatLabelsInput) 1380 _ = input 1381 if !ok { 1382 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 1383 } 1384 1385 opPath, opQuery := httpbinding.SplitURI("/FloatHttpLabels/{float}/{double}") 1386 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 1387 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 1388 request.Method = "GET" 1389 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 1390 if err != nil { 1391 return out, metadata, &smithy.SerializationError{Err: err} 1392 } 1393 1394 if err := awsRestxml_serializeOpHttpBindingsHttpRequestWithFloatLabelsInput(input, restEncoder); err != nil { 1395 return out, metadata, &smithy.SerializationError{Err: err} 1396 } 1397 1398 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 1399 return out, metadata, &smithy.SerializationError{Err: err} 1400 } 1401 in.Request = request 1402 1403 return next.HandleSerialize(ctx, in) 1404} 1405func awsRestxml_serializeOpHttpBindingsHttpRequestWithFloatLabelsInput(v *HttpRequestWithFloatLabelsInput, encoder *httpbinding.Encoder) error { 1406 if v == nil { 1407 return fmt.Errorf("unsupported serialization of nil %T", v) 1408 } 1409 1410 if v.Double == nil { 1411 return &smithy.SerializationError{Err: fmt.Errorf("input member double must not be empty")} 1412 } 1413 if v.Double != nil { 1414 if err := encoder.SetURI("double").Double(*v.Double); err != nil { 1415 return err 1416 } 1417 } 1418 1419 if v.Float == nil { 1420 return &smithy.SerializationError{Err: fmt.Errorf("input member float must not be empty")} 1421 } 1422 if v.Float != nil { 1423 if err := encoder.SetURI("float").Float(*v.Float); err != nil { 1424 return err 1425 } 1426 } 1427 1428 return nil 1429} 1430 1431type awsRestxml_serializeOpHttpRequestWithGreedyLabelInPath struct { 1432} 1433 1434func (*awsRestxml_serializeOpHttpRequestWithGreedyLabelInPath) ID() string { 1435 return "OperationSerializer" 1436} 1437 1438func (m *awsRestxml_serializeOpHttpRequestWithGreedyLabelInPath) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 1439 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 1440) { 1441 request, ok := in.Request.(*smithyhttp.Request) 1442 if !ok { 1443 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 1444 } 1445 1446 input, ok := in.Parameters.(*HttpRequestWithGreedyLabelInPathInput) 1447 _ = input 1448 if !ok { 1449 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 1450 } 1451 1452 opPath, opQuery := httpbinding.SplitURI("/HttpRequestWithGreedyLabelInPath/foo/{foo}/baz/{baz+}") 1453 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 1454 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 1455 request.Method = "GET" 1456 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 1457 if err != nil { 1458 return out, metadata, &smithy.SerializationError{Err: err} 1459 } 1460 1461 if err := awsRestxml_serializeOpHttpBindingsHttpRequestWithGreedyLabelInPathInput(input, restEncoder); err != nil { 1462 return out, metadata, &smithy.SerializationError{Err: err} 1463 } 1464 1465 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 1466 return out, metadata, &smithy.SerializationError{Err: err} 1467 } 1468 in.Request = request 1469 1470 return next.HandleSerialize(ctx, in) 1471} 1472func awsRestxml_serializeOpHttpBindingsHttpRequestWithGreedyLabelInPathInput(v *HttpRequestWithGreedyLabelInPathInput, encoder *httpbinding.Encoder) error { 1473 if v == nil { 1474 return fmt.Errorf("unsupported serialization of nil %T", v) 1475 } 1476 1477 if v.Baz == nil || len(*v.Baz) == 0 { 1478 return &smithy.SerializationError{Err: fmt.Errorf("input member baz must not be empty")} 1479 } 1480 if v.Baz != nil { 1481 if err := encoder.SetURI("baz").String(*v.Baz); err != nil { 1482 return err 1483 } 1484 } 1485 1486 if v.Foo == nil || len(*v.Foo) == 0 { 1487 return &smithy.SerializationError{Err: fmt.Errorf("input member foo must not be empty")} 1488 } 1489 if v.Foo != nil { 1490 if err := encoder.SetURI("foo").String(*v.Foo); err != nil { 1491 return err 1492 } 1493 } 1494 1495 return nil 1496} 1497 1498type awsRestxml_serializeOpHttpRequestWithLabels struct { 1499} 1500 1501func (*awsRestxml_serializeOpHttpRequestWithLabels) ID() string { 1502 return "OperationSerializer" 1503} 1504 1505func (m *awsRestxml_serializeOpHttpRequestWithLabels) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 1506 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 1507) { 1508 request, ok := in.Request.(*smithyhttp.Request) 1509 if !ok { 1510 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 1511 } 1512 1513 input, ok := in.Parameters.(*HttpRequestWithLabelsInput) 1514 _ = input 1515 if !ok { 1516 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 1517 } 1518 1519 opPath, opQuery := httpbinding.SplitURI("/HttpRequestWithLabels/{string}/{short}/{integer}/{long}/{float}/{double}/{boolean}/{timestamp}") 1520 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 1521 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 1522 request.Method = "GET" 1523 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 1524 if err != nil { 1525 return out, metadata, &smithy.SerializationError{Err: err} 1526 } 1527 1528 if err := awsRestxml_serializeOpHttpBindingsHttpRequestWithLabelsInput(input, restEncoder); err != nil { 1529 return out, metadata, &smithy.SerializationError{Err: err} 1530 } 1531 1532 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 1533 return out, metadata, &smithy.SerializationError{Err: err} 1534 } 1535 in.Request = request 1536 1537 return next.HandleSerialize(ctx, in) 1538} 1539func awsRestxml_serializeOpHttpBindingsHttpRequestWithLabelsInput(v *HttpRequestWithLabelsInput, encoder *httpbinding.Encoder) error { 1540 if v == nil { 1541 return fmt.Errorf("unsupported serialization of nil %T", v) 1542 } 1543 1544 if v.Boolean == nil { 1545 return &smithy.SerializationError{Err: fmt.Errorf("input member boolean must not be empty")} 1546 } 1547 if v.Boolean != nil { 1548 if err := encoder.SetURI("boolean").Boolean(*v.Boolean); err != nil { 1549 return err 1550 } 1551 } 1552 1553 if v.Double == nil { 1554 return &smithy.SerializationError{Err: fmt.Errorf("input member double must not be empty")} 1555 } 1556 if v.Double != nil { 1557 if err := encoder.SetURI("double").Double(*v.Double); err != nil { 1558 return err 1559 } 1560 } 1561 1562 if v.Float == nil { 1563 return &smithy.SerializationError{Err: fmt.Errorf("input member float must not be empty")} 1564 } 1565 if v.Float != nil { 1566 if err := encoder.SetURI("float").Float(*v.Float); err != nil { 1567 return err 1568 } 1569 } 1570 1571 if v.Integer == nil { 1572 return &smithy.SerializationError{Err: fmt.Errorf("input member integer must not be empty")} 1573 } 1574 if v.Integer != nil { 1575 if err := encoder.SetURI("integer").Integer(*v.Integer); err != nil { 1576 return err 1577 } 1578 } 1579 1580 if v.Long == nil { 1581 return &smithy.SerializationError{Err: fmt.Errorf("input member long must not be empty")} 1582 } 1583 if v.Long != nil { 1584 if err := encoder.SetURI("long").Long(*v.Long); err != nil { 1585 return err 1586 } 1587 } 1588 1589 if v.Short == nil { 1590 return &smithy.SerializationError{Err: fmt.Errorf("input member short must not be empty")} 1591 } 1592 if v.Short != nil { 1593 if err := encoder.SetURI("short").Short(*v.Short); err != nil { 1594 return err 1595 } 1596 } 1597 1598 if v.String_ == nil || len(*v.String_) == 0 { 1599 return &smithy.SerializationError{Err: fmt.Errorf("input member string must not be empty")} 1600 } 1601 if v.String_ != nil { 1602 if err := encoder.SetURI("string").String(*v.String_); err != nil { 1603 return err 1604 } 1605 } 1606 1607 if v.Timestamp == nil { 1608 return &smithy.SerializationError{Err: fmt.Errorf("input member timestamp must not be empty")} 1609 } 1610 if v.Timestamp != nil { 1611 if err := encoder.SetURI("timestamp").String(smithytime.FormatDateTime(*v.Timestamp)); err != nil { 1612 return err 1613 } 1614 } 1615 1616 return nil 1617} 1618 1619type awsRestxml_serializeOpHttpRequestWithLabelsAndTimestampFormat struct { 1620} 1621 1622func (*awsRestxml_serializeOpHttpRequestWithLabelsAndTimestampFormat) ID() string { 1623 return "OperationSerializer" 1624} 1625 1626func (m *awsRestxml_serializeOpHttpRequestWithLabelsAndTimestampFormat) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 1627 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 1628) { 1629 request, ok := in.Request.(*smithyhttp.Request) 1630 if !ok { 1631 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 1632 } 1633 1634 input, ok := in.Parameters.(*HttpRequestWithLabelsAndTimestampFormatInput) 1635 _ = input 1636 if !ok { 1637 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 1638 } 1639 1640 opPath, opQuery := httpbinding.SplitURI("/HttpRequestWithLabelsAndTimestampFormat/{memberEpochSeconds}/{memberHttpDate}/{memberDateTime}/{defaultFormat}/{targetEpochSeconds}/{targetHttpDate}/{targetDateTime}") 1641 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 1642 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 1643 request.Method = "GET" 1644 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 1645 if err != nil { 1646 return out, metadata, &smithy.SerializationError{Err: err} 1647 } 1648 1649 if err := awsRestxml_serializeOpHttpBindingsHttpRequestWithLabelsAndTimestampFormatInput(input, restEncoder); err != nil { 1650 return out, metadata, &smithy.SerializationError{Err: err} 1651 } 1652 1653 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 1654 return out, metadata, &smithy.SerializationError{Err: err} 1655 } 1656 in.Request = request 1657 1658 return next.HandleSerialize(ctx, in) 1659} 1660func awsRestxml_serializeOpHttpBindingsHttpRequestWithLabelsAndTimestampFormatInput(v *HttpRequestWithLabelsAndTimestampFormatInput, encoder *httpbinding.Encoder) error { 1661 if v == nil { 1662 return fmt.Errorf("unsupported serialization of nil %T", v) 1663 } 1664 1665 if v.DefaultFormat == nil { 1666 return &smithy.SerializationError{Err: fmt.Errorf("input member defaultFormat must not be empty")} 1667 } 1668 if v.DefaultFormat != nil { 1669 if err := encoder.SetURI("defaultFormat").String(smithytime.FormatDateTime(*v.DefaultFormat)); err != nil { 1670 return err 1671 } 1672 } 1673 1674 if v.MemberDateTime == nil { 1675 return &smithy.SerializationError{Err: fmt.Errorf("input member memberDateTime must not be empty")} 1676 } 1677 if v.MemberDateTime != nil { 1678 if err := encoder.SetURI("memberDateTime").String(smithytime.FormatDateTime(*v.MemberDateTime)); err != nil { 1679 return err 1680 } 1681 } 1682 1683 if v.MemberEpochSeconds == nil { 1684 return &smithy.SerializationError{Err: fmt.Errorf("input member memberEpochSeconds must not be empty")} 1685 } 1686 if v.MemberEpochSeconds != nil { 1687 if err := encoder.SetURI("memberEpochSeconds").Double(smithytime.FormatEpochSeconds(*v.MemberEpochSeconds)); err != nil { 1688 return err 1689 } 1690 } 1691 1692 if v.MemberHttpDate == nil { 1693 return &smithy.SerializationError{Err: fmt.Errorf("input member memberHttpDate must not be empty")} 1694 } 1695 if v.MemberHttpDate != nil { 1696 if err := encoder.SetURI("memberHttpDate").String(smithytime.FormatHTTPDate(*v.MemberHttpDate)); err != nil { 1697 return err 1698 } 1699 } 1700 1701 if v.TargetDateTime == nil { 1702 return &smithy.SerializationError{Err: fmt.Errorf("input member targetDateTime must not be empty")} 1703 } 1704 if v.TargetDateTime != nil { 1705 if err := encoder.SetURI("targetDateTime").String(smithytime.FormatDateTime(*v.TargetDateTime)); err != nil { 1706 return err 1707 } 1708 } 1709 1710 if v.TargetEpochSeconds == nil { 1711 return &smithy.SerializationError{Err: fmt.Errorf("input member targetEpochSeconds must not be empty")} 1712 } 1713 if v.TargetEpochSeconds != nil { 1714 if err := encoder.SetURI("targetEpochSeconds").Double(smithytime.FormatEpochSeconds(*v.TargetEpochSeconds)); err != nil { 1715 return err 1716 } 1717 } 1718 1719 if v.TargetHttpDate == nil { 1720 return &smithy.SerializationError{Err: fmt.Errorf("input member targetHttpDate must not be empty")} 1721 } 1722 if v.TargetHttpDate != nil { 1723 if err := encoder.SetURI("targetHttpDate").String(smithytime.FormatHTTPDate(*v.TargetHttpDate)); err != nil { 1724 return err 1725 } 1726 } 1727 1728 return nil 1729} 1730 1731type awsRestxml_serializeOpHttpResponseCode struct { 1732} 1733 1734func (*awsRestxml_serializeOpHttpResponseCode) ID() string { 1735 return "OperationSerializer" 1736} 1737 1738func (m *awsRestxml_serializeOpHttpResponseCode) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 1739 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 1740) { 1741 request, ok := in.Request.(*smithyhttp.Request) 1742 if !ok { 1743 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 1744 } 1745 1746 input, ok := in.Parameters.(*HttpResponseCodeInput) 1747 _ = input 1748 if !ok { 1749 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 1750 } 1751 1752 opPath, opQuery := httpbinding.SplitURI("/HttpResponseCode") 1753 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 1754 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 1755 request.Method = "PUT" 1756 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 1757 if err != nil { 1758 return out, metadata, &smithy.SerializationError{Err: err} 1759 } 1760 1761 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 1762 return out, metadata, &smithy.SerializationError{Err: err} 1763 } 1764 in.Request = request 1765 1766 return next.HandleSerialize(ctx, in) 1767} 1768func awsRestxml_serializeOpHttpBindingsHttpResponseCodeInput(v *HttpResponseCodeInput, encoder *httpbinding.Encoder) error { 1769 if v == nil { 1770 return fmt.Errorf("unsupported serialization of nil %T", v) 1771 } 1772 1773 return nil 1774} 1775 1776type awsRestxml_serializeOpIgnoreQueryParamsInResponse struct { 1777} 1778 1779func (*awsRestxml_serializeOpIgnoreQueryParamsInResponse) ID() string { 1780 return "OperationSerializer" 1781} 1782 1783func (m *awsRestxml_serializeOpIgnoreQueryParamsInResponse) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 1784 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 1785) { 1786 request, ok := in.Request.(*smithyhttp.Request) 1787 if !ok { 1788 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 1789 } 1790 1791 input, ok := in.Parameters.(*IgnoreQueryParamsInResponseInput) 1792 _ = input 1793 if !ok { 1794 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 1795 } 1796 1797 opPath, opQuery := httpbinding.SplitURI("/IgnoreQueryParamsInResponse") 1798 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 1799 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 1800 request.Method = "GET" 1801 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 1802 if err != nil { 1803 return out, metadata, &smithy.SerializationError{Err: err} 1804 } 1805 1806 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 1807 return out, metadata, &smithy.SerializationError{Err: err} 1808 } 1809 in.Request = request 1810 1811 return next.HandleSerialize(ctx, in) 1812} 1813func awsRestxml_serializeOpHttpBindingsIgnoreQueryParamsInResponseInput(v *IgnoreQueryParamsInResponseInput, encoder *httpbinding.Encoder) error { 1814 if v == nil { 1815 return fmt.Errorf("unsupported serialization of nil %T", v) 1816 } 1817 1818 return nil 1819} 1820 1821type awsRestxml_serializeOpInputAndOutputWithHeaders struct { 1822} 1823 1824func (*awsRestxml_serializeOpInputAndOutputWithHeaders) ID() string { 1825 return "OperationSerializer" 1826} 1827 1828func (m *awsRestxml_serializeOpInputAndOutputWithHeaders) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 1829 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 1830) { 1831 request, ok := in.Request.(*smithyhttp.Request) 1832 if !ok { 1833 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 1834 } 1835 1836 input, ok := in.Parameters.(*InputAndOutputWithHeadersInput) 1837 _ = input 1838 if !ok { 1839 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 1840 } 1841 1842 opPath, opQuery := httpbinding.SplitURI("/InputAndOutputWithHeaders") 1843 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 1844 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 1845 request.Method = "POST" 1846 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 1847 if err != nil { 1848 return out, metadata, &smithy.SerializationError{Err: err} 1849 } 1850 1851 if err := awsRestxml_serializeOpHttpBindingsInputAndOutputWithHeadersInput(input, restEncoder); err != nil { 1852 return out, metadata, &smithy.SerializationError{Err: err} 1853 } 1854 1855 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 1856 return out, metadata, &smithy.SerializationError{Err: err} 1857 } 1858 in.Request = request 1859 1860 return next.HandleSerialize(ctx, in) 1861} 1862func awsRestxml_serializeOpHttpBindingsInputAndOutputWithHeadersInput(v *InputAndOutputWithHeadersInput, encoder *httpbinding.Encoder) error { 1863 if v == nil { 1864 return fmt.Errorf("unsupported serialization of nil %T", v) 1865 } 1866 1867 if v.HeaderBooleanList != nil { 1868 locationName := "X-Booleanlist" 1869 for i := range v.HeaderBooleanList { 1870 { 1871 encoder.AddHeader(locationName).Boolean(v.HeaderBooleanList[i]) 1872 } 1873 } 1874 } 1875 1876 if v.HeaderByte != nil { 1877 locationName := "X-Byte" 1878 encoder.SetHeader(locationName).Byte(*v.HeaderByte) 1879 } 1880 1881 if v.HeaderDouble != nil { 1882 locationName := "X-Double" 1883 encoder.SetHeader(locationName).Double(*v.HeaderDouble) 1884 } 1885 1886 if len(v.HeaderEnum) > 0 { 1887 locationName := "X-Enum" 1888 encoder.SetHeader(locationName).String(string(v.HeaderEnum)) 1889 } 1890 1891 if v.HeaderEnumList != nil { 1892 locationName := "X-Enumlist" 1893 for i := range v.HeaderEnumList { 1894 if len(v.HeaderEnumList[i]) > 0 { 1895 encoder.AddHeader(locationName).String(string(v.HeaderEnumList[i])) 1896 } 1897 } 1898 } 1899 1900 if v.HeaderFalseBool != nil { 1901 locationName := "X-Boolean2" 1902 encoder.SetHeader(locationName).Boolean(*v.HeaderFalseBool) 1903 } 1904 1905 if v.HeaderFloat != nil { 1906 locationName := "X-Float" 1907 encoder.SetHeader(locationName).Float(*v.HeaderFloat) 1908 } 1909 1910 if v.HeaderInteger != nil { 1911 locationName := "X-Integer" 1912 encoder.SetHeader(locationName).Integer(*v.HeaderInteger) 1913 } 1914 1915 if v.HeaderIntegerList != nil { 1916 locationName := "X-Integerlist" 1917 for i := range v.HeaderIntegerList { 1918 { 1919 encoder.AddHeader(locationName).Integer(v.HeaderIntegerList[i]) 1920 } 1921 } 1922 } 1923 1924 if v.HeaderLong != nil { 1925 locationName := "X-Long" 1926 encoder.SetHeader(locationName).Long(*v.HeaderLong) 1927 } 1928 1929 if v.HeaderShort != nil { 1930 locationName := "X-Short" 1931 encoder.SetHeader(locationName).Short(*v.HeaderShort) 1932 } 1933 1934 if v.HeaderString != nil && len(*v.HeaderString) > 0 { 1935 locationName := "X-String" 1936 encoder.SetHeader(locationName).String(*v.HeaderString) 1937 } 1938 1939 if v.HeaderStringList != nil { 1940 locationName := "X-Stringlist" 1941 for i := range v.HeaderStringList { 1942 if len(v.HeaderStringList[i]) > 0 { 1943 encoder.AddHeader(locationName).String(v.HeaderStringList[i]) 1944 } 1945 } 1946 } 1947 1948 if v.HeaderStringSet != nil { 1949 locationName := "X-Stringset" 1950 for i := range v.HeaderStringSet { 1951 if len(v.HeaderStringSet[i]) > 0 { 1952 encoder.AddHeader(locationName).String(v.HeaderStringSet[i]) 1953 } 1954 } 1955 } 1956 1957 if v.HeaderTimestampList != nil { 1958 locationName := "X-Timestamplist" 1959 for i := range v.HeaderTimestampList { 1960 { 1961 encoder.AddHeader(locationName).String(smithytime.FormatHTTPDate(v.HeaderTimestampList[i])) 1962 } 1963 } 1964 } 1965 1966 if v.HeaderTrueBool != nil { 1967 locationName := "X-Boolean1" 1968 encoder.SetHeader(locationName).Boolean(*v.HeaderTrueBool) 1969 } 1970 1971 return nil 1972} 1973 1974type awsRestxml_serializeOpNestedXmlMaps struct { 1975} 1976 1977func (*awsRestxml_serializeOpNestedXmlMaps) ID() string { 1978 return "OperationSerializer" 1979} 1980 1981func (m *awsRestxml_serializeOpNestedXmlMaps) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 1982 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 1983) { 1984 request, ok := in.Request.(*smithyhttp.Request) 1985 if !ok { 1986 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 1987 } 1988 1989 input, ok := in.Parameters.(*NestedXmlMapsInput) 1990 _ = input 1991 if !ok { 1992 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 1993 } 1994 1995 opPath, opQuery := httpbinding.SplitURI("/NestedXmlMaps") 1996 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 1997 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 1998 request.Method = "POST" 1999 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 2000 if err != nil { 2001 return out, metadata, &smithy.SerializationError{Err: err} 2002 } 2003 2004 restEncoder.SetHeader("Content-Type").String("application/xml") 2005 2006 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 2007 rootAttr := []smithyxml.Attr{} 2008 root := smithyxml.StartElement{ 2009 Name: smithyxml.Name{ 2010 Local: "NestedXmlMapsInputOutput", 2011 }, 2012 Attr: rootAttr, 2013 } 2014 if err := awsRestxml_serializeOpDocumentNestedXmlMapsInput(input, xmlEncoder.RootElement(root)); err != nil { 2015 return out, metadata, &smithy.SerializationError{Err: err} 2016 } 2017 if request, err = request.SetStream(bytes.NewReader(xmlEncoder.Bytes())); err != nil { 2018 return out, metadata, &smithy.SerializationError{Err: err} 2019 } 2020 2021 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 2022 return out, metadata, &smithy.SerializationError{Err: err} 2023 } 2024 in.Request = request 2025 2026 return next.HandleSerialize(ctx, in) 2027} 2028func awsRestxml_serializeOpHttpBindingsNestedXmlMapsInput(v *NestedXmlMapsInput, encoder *httpbinding.Encoder) error { 2029 if v == nil { 2030 return fmt.Errorf("unsupported serialization of nil %T", v) 2031 } 2032 2033 return nil 2034} 2035 2036func awsRestxml_serializeOpDocumentNestedXmlMapsInput(v *NestedXmlMapsInput, value smithyxml.Value) error { 2037 defer value.Close() 2038 if v.FlatNestedMap != nil { 2039 rootAttr := []smithyxml.Attr{} 2040 root := smithyxml.StartElement{ 2041 Name: smithyxml.Name{ 2042 Local: "flatNestedMap", 2043 }, 2044 Attr: rootAttr, 2045 } 2046 el := value.FlattenedElement(root) 2047 if err := awsRestxml_serializeDocumentNestedMap(v.FlatNestedMap, el); err != nil { 2048 return err 2049 } 2050 } 2051 if v.NestedMap != nil { 2052 rootAttr := []smithyxml.Attr{} 2053 root := smithyxml.StartElement{ 2054 Name: smithyxml.Name{ 2055 Local: "nestedMap", 2056 }, 2057 Attr: rootAttr, 2058 } 2059 el := value.MemberElement(root) 2060 if err := awsRestxml_serializeDocumentNestedMap(v.NestedMap, el); err != nil { 2061 return err 2062 } 2063 } 2064 return nil 2065} 2066 2067type awsRestxml_serializeOpNoInputAndNoOutput struct { 2068} 2069 2070func (*awsRestxml_serializeOpNoInputAndNoOutput) ID() string { 2071 return "OperationSerializer" 2072} 2073 2074func (m *awsRestxml_serializeOpNoInputAndNoOutput) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 2075 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 2076) { 2077 request, ok := in.Request.(*smithyhttp.Request) 2078 if !ok { 2079 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 2080 } 2081 2082 input, ok := in.Parameters.(*NoInputAndNoOutputInput) 2083 _ = input 2084 if !ok { 2085 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 2086 } 2087 2088 opPath, opQuery := httpbinding.SplitURI("/NoInputAndNoOutput") 2089 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 2090 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 2091 request.Method = "POST" 2092 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 2093 if err != nil { 2094 return out, metadata, &smithy.SerializationError{Err: err} 2095 } 2096 2097 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 2098 return out, metadata, &smithy.SerializationError{Err: err} 2099 } 2100 in.Request = request 2101 2102 return next.HandleSerialize(ctx, in) 2103} 2104func awsRestxml_serializeOpHttpBindingsNoInputAndNoOutputInput(v *NoInputAndNoOutputInput, encoder *httpbinding.Encoder) error { 2105 if v == nil { 2106 return fmt.Errorf("unsupported serialization of nil %T", v) 2107 } 2108 2109 return nil 2110} 2111 2112type awsRestxml_serializeOpNoInputAndOutput struct { 2113} 2114 2115func (*awsRestxml_serializeOpNoInputAndOutput) ID() string { 2116 return "OperationSerializer" 2117} 2118 2119func (m *awsRestxml_serializeOpNoInputAndOutput) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 2120 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 2121) { 2122 request, ok := in.Request.(*smithyhttp.Request) 2123 if !ok { 2124 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 2125 } 2126 2127 input, ok := in.Parameters.(*NoInputAndOutputInput) 2128 _ = input 2129 if !ok { 2130 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 2131 } 2132 2133 opPath, opQuery := httpbinding.SplitURI("/NoInputAndOutputOutput") 2134 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 2135 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 2136 request.Method = "POST" 2137 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 2138 if err != nil { 2139 return out, metadata, &smithy.SerializationError{Err: err} 2140 } 2141 2142 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 2143 return out, metadata, &smithy.SerializationError{Err: err} 2144 } 2145 in.Request = request 2146 2147 return next.HandleSerialize(ctx, in) 2148} 2149func awsRestxml_serializeOpHttpBindingsNoInputAndOutputInput(v *NoInputAndOutputInput, encoder *httpbinding.Encoder) error { 2150 if v == nil { 2151 return fmt.Errorf("unsupported serialization of nil %T", v) 2152 } 2153 2154 return nil 2155} 2156 2157type awsRestxml_serializeOpNullAndEmptyHeadersClient struct { 2158} 2159 2160func (*awsRestxml_serializeOpNullAndEmptyHeadersClient) ID() string { 2161 return "OperationSerializer" 2162} 2163 2164func (m *awsRestxml_serializeOpNullAndEmptyHeadersClient) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 2165 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 2166) { 2167 request, ok := in.Request.(*smithyhttp.Request) 2168 if !ok { 2169 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 2170 } 2171 2172 input, ok := in.Parameters.(*NullAndEmptyHeadersClientInput) 2173 _ = input 2174 if !ok { 2175 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 2176 } 2177 2178 opPath, opQuery := httpbinding.SplitURI("/NullAndEmptyHeadersClient") 2179 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 2180 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 2181 request.Method = "GET" 2182 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 2183 if err != nil { 2184 return out, metadata, &smithy.SerializationError{Err: err} 2185 } 2186 2187 if err := awsRestxml_serializeOpHttpBindingsNullAndEmptyHeadersClientInput(input, restEncoder); err != nil { 2188 return out, metadata, &smithy.SerializationError{Err: err} 2189 } 2190 2191 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 2192 return out, metadata, &smithy.SerializationError{Err: err} 2193 } 2194 in.Request = request 2195 2196 return next.HandleSerialize(ctx, in) 2197} 2198func awsRestxml_serializeOpHttpBindingsNullAndEmptyHeadersClientInput(v *NullAndEmptyHeadersClientInput, encoder *httpbinding.Encoder) error { 2199 if v == nil { 2200 return fmt.Errorf("unsupported serialization of nil %T", v) 2201 } 2202 2203 if v.A != nil && len(*v.A) > 0 { 2204 locationName := "X-A" 2205 encoder.SetHeader(locationName).String(*v.A) 2206 } 2207 2208 if v.B != nil && len(*v.B) > 0 { 2209 locationName := "X-B" 2210 encoder.SetHeader(locationName).String(*v.B) 2211 } 2212 2213 if v.C != nil { 2214 locationName := "X-C" 2215 for i := range v.C { 2216 if len(v.C[i]) > 0 { 2217 encoder.AddHeader(locationName).String(v.C[i]) 2218 } 2219 } 2220 } 2221 2222 return nil 2223} 2224 2225type awsRestxml_serializeOpNullAndEmptyHeadersServer struct { 2226} 2227 2228func (*awsRestxml_serializeOpNullAndEmptyHeadersServer) ID() string { 2229 return "OperationSerializer" 2230} 2231 2232func (m *awsRestxml_serializeOpNullAndEmptyHeadersServer) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 2233 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 2234) { 2235 request, ok := in.Request.(*smithyhttp.Request) 2236 if !ok { 2237 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 2238 } 2239 2240 input, ok := in.Parameters.(*NullAndEmptyHeadersServerInput) 2241 _ = input 2242 if !ok { 2243 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 2244 } 2245 2246 opPath, opQuery := httpbinding.SplitURI("/NullAndEmptyHeadersServer") 2247 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 2248 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 2249 request.Method = "GET" 2250 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 2251 if err != nil { 2252 return out, metadata, &smithy.SerializationError{Err: err} 2253 } 2254 2255 if err := awsRestxml_serializeOpHttpBindingsNullAndEmptyHeadersServerInput(input, restEncoder); err != nil { 2256 return out, metadata, &smithy.SerializationError{Err: err} 2257 } 2258 2259 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 2260 return out, metadata, &smithy.SerializationError{Err: err} 2261 } 2262 in.Request = request 2263 2264 return next.HandleSerialize(ctx, in) 2265} 2266func awsRestxml_serializeOpHttpBindingsNullAndEmptyHeadersServerInput(v *NullAndEmptyHeadersServerInput, encoder *httpbinding.Encoder) error { 2267 if v == nil { 2268 return fmt.Errorf("unsupported serialization of nil %T", v) 2269 } 2270 2271 if v.A != nil && len(*v.A) > 0 { 2272 locationName := "X-A" 2273 encoder.SetHeader(locationName).String(*v.A) 2274 } 2275 2276 if v.B != nil && len(*v.B) > 0 { 2277 locationName := "X-B" 2278 encoder.SetHeader(locationName).String(*v.B) 2279 } 2280 2281 if v.C != nil { 2282 locationName := "X-C" 2283 for i := range v.C { 2284 if len(v.C[i]) > 0 { 2285 encoder.AddHeader(locationName).String(v.C[i]) 2286 } 2287 } 2288 } 2289 2290 return nil 2291} 2292 2293type awsRestxml_serializeOpOmitsNullSerializesEmptyString struct { 2294} 2295 2296func (*awsRestxml_serializeOpOmitsNullSerializesEmptyString) ID() string { 2297 return "OperationSerializer" 2298} 2299 2300func (m *awsRestxml_serializeOpOmitsNullSerializesEmptyString) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 2301 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 2302) { 2303 request, ok := in.Request.(*smithyhttp.Request) 2304 if !ok { 2305 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 2306 } 2307 2308 input, ok := in.Parameters.(*OmitsNullSerializesEmptyStringInput) 2309 _ = input 2310 if !ok { 2311 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 2312 } 2313 2314 opPath, opQuery := httpbinding.SplitURI("/OmitsNullSerializesEmptyString") 2315 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 2316 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 2317 request.Method = "GET" 2318 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 2319 if err != nil { 2320 return out, metadata, &smithy.SerializationError{Err: err} 2321 } 2322 2323 if err := awsRestxml_serializeOpHttpBindingsOmitsNullSerializesEmptyStringInput(input, restEncoder); err != nil { 2324 return out, metadata, &smithy.SerializationError{Err: err} 2325 } 2326 2327 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 2328 return out, metadata, &smithy.SerializationError{Err: err} 2329 } 2330 in.Request = request 2331 2332 return next.HandleSerialize(ctx, in) 2333} 2334func awsRestxml_serializeOpHttpBindingsOmitsNullSerializesEmptyStringInput(v *OmitsNullSerializesEmptyStringInput, encoder *httpbinding.Encoder) error { 2335 if v == nil { 2336 return fmt.Errorf("unsupported serialization of nil %T", v) 2337 } 2338 2339 if v.EmptyString != nil { 2340 encoder.SetQuery("Empty").String(*v.EmptyString) 2341 } 2342 2343 if v.NullValue != nil { 2344 encoder.SetQuery("Null").String(*v.NullValue) 2345 } 2346 2347 return nil 2348} 2349 2350type awsRestxml_serializeOpQueryIdempotencyTokenAutoFill struct { 2351} 2352 2353func (*awsRestxml_serializeOpQueryIdempotencyTokenAutoFill) ID() string { 2354 return "OperationSerializer" 2355} 2356 2357func (m *awsRestxml_serializeOpQueryIdempotencyTokenAutoFill) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 2358 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 2359) { 2360 request, ok := in.Request.(*smithyhttp.Request) 2361 if !ok { 2362 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 2363 } 2364 2365 input, ok := in.Parameters.(*QueryIdempotencyTokenAutoFillInput) 2366 _ = input 2367 if !ok { 2368 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 2369 } 2370 2371 opPath, opQuery := httpbinding.SplitURI("/QueryIdempotencyTokenAutoFill") 2372 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 2373 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 2374 request.Method = "POST" 2375 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 2376 if err != nil { 2377 return out, metadata, &smithy.SerializationError{Err: err} 2378 } 2379 2380 if err := awsRestxml_serializeOpHttpBindingsQueryIdempotencyTokenAutoFillInput(input, restEncoder); err != nil { 2381 return out, metadata, &smithy.SerializationError{Err: err} 2382 } 2383 2384 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 2385 return out, metadata, &smithy.SerializationError{Err: err} 2386 } 2387 in.Request = request 2388 2389 return next.HandleSerialize(ctx, in) 2390} 2391func awsRestxml_serializeOpHttpBindingsQueryIdempotencyTokenAutoFillInput(v *QueryIdempotencyTokenAutoFillInput, encoder *httpbinding.Encoder) error { 2392 if v == nil { 2393 return fmt.Errorf("unsupported serialization of nil %T", v) 2394 } 2395 2396 if v.Token != nil { 2397 encoder.SetQuery("token").String(*v.Token) 2398 } 2399 2400 return nil 2401} 2402 2403type awsRestxml_serializeOpQueryParamsAsStringListMap struct { 2404} 2405 2406func (*awsRestxml_serializeOpQueryParamsAsStringListMap) ID() string { 2407 return "OperationSerializer" 2408} 2409 2410func (m *awsRestxml_serializeOpQueryParamsAsStringListMap) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 2411 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 2412) { 2413 request, ok := in.Request.(*smithyhttp.Request) 2414 if !ok { 2415 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 2416 } 2417 2418 input, ok := in.Parameters.(*QueryParamsAsStringListMapInput) 2419 _ = input 2420 if !ok { 2421 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 2422 } 2423 2424 opPath, opQuery := httpbinding.SplitURI("/StringListMap") 2425 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 2426 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 2427 request.Method = "POST" 2428 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 2429 if err != nil { 2430 return out, metadata, &smithy.SerializationError{Err: err} 2431 } 2432 2433 if err := awsRestxml_serializeOpHttpBindingsQueryParamsAsStringListMapInput(input, restEncoder); err != nil { 2434 return out, metadata, &smithy.SerializationError{Err: err} 2435 } 2436 2437 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 2438 return out, metadata, &smithy.SerializationError{Err: err} 2439 } 2440 in.Request = request 2441 2442 return next.HandleSerialize(ctx, in) 2443} 2444func awsRestxml_serializeOpHttpBindingsQueryParamsAsStringListMapInput(v *QueryParamsAsStringListMapInput, encoder *httpbinding.Encoder) error { 2445 if v == nil { 2446 return fmt.Errorf("unsupported serialization of nil %T", v) 2447 } 2448 2449 if v.Foo != nil { 2450 for qkey, qvalue := range v.Foo { 2451 if encoder.HasQuery(qkey) { 2452 continue 2453 } 2454 for i := range qvalue { 2455 encoder.AddQuery(qkey).String(qvalue[i]) 2456 } 2457 } 2458 } 2459 2460 if v.Qux != nil { 2461 encoder.SetQuery("corge").String(*v.Qux) 2462 } 2463 2464 return nil 2465} 2466 2467type awsRestxml_serializeOpQueryPrecedence struct { 2468} 2469 2470func (*awsRestxml_serializeOpQueryPrecedence) ID() string { 2471 return "OperationSerializer" 2472} 2473 2474func (m *awsRestxml_serializeOpQueryPrecedence) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 2475 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 2476) { 2477 request, ok := in.Request.(*smithyhttp.Request) 2478 if !ok { 2479 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 2480 } 2481 2482 input, ok := in.Parameters.(*QueryPrecedenceInput) 2483 _ = input 2484 if !ok { 2485 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 2486 } 2487 2488 opPath, opQuery := httpbinding.SplitURI("/Precedence") 2489 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 2490 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 2491 request.Method = "POST" 2492 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 2493 if err != nil { 2494 return out, metadata, &smithy.SerializationError{Err: err} 2495 } 2496 2497 if err := awsRestxml_serializeOpHttpBindingsQueryPrecedenceInput(input, restEncoder); err != nil { 2498 return out, metadata, &smithy.SerializationError{Err: err} 2499 } 2500 2501 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 2502 return out, metadata, &smithy.SerializationError{Err: err} 2503 } 2504 in.Request = request 2505 2506 return next.HandleSerialize(ctx, in) 2507} 2508func awsRestxml_serializeOpHttpBindingsQueryPrecedenceInput(v *QueryPrecedenceInput, encoder *httpbinding.Encoder) error { 2509 if v == nil { 2510 return fmt.Errorf("unsupported serialization of nil %T", v) 2511 } 2512 2513 if v.Baz != nil { 2514 for qkey, qvalue := range v.Baz { 2515 if encoder.HasQuery(qkey) { 2516 continue 2517 } 2518 encoder.SetQuery(qkey).String(qvalue) 2519 } 2520 } 2521 2522 if v.Foo != nil { 2523 encoder.SetQuery("bar").String(*v.Foo) 2524 } 2525 2526 return nil 2527} 2528 2529type awsRestxml_serializeOpRecursiveShapes struct { 2530} 2531 2532func (*awsRestxml_serializeOpRecursiveShapes) ID() string { 2533 return "OperationSerializer" 2534} 2535 2536func (m *awsRestxml_serializeOpRecursiveShapes) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 2537 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 2538) { 2539 request, ok := in.Request.(*smithyhttp.Request) 2540 if !ok { 2541 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 2542 } 2543 2544 input, ok := in.Parameters.(*RecursiveShapesInput) 2545 _ = input 2546 if !ok { 2547 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 2548 } 2549 2550 opPath, opQuery := httpbinding.SplitURI("/RecursiveShapes") 2551 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 2552 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 2553 request.Method = "PUT" 2554 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 2555 if err != nil { 2556 return out, metadata, &smithy.SerializationError{Err: err} 2557 } 2558 2559 restEncoder.SetHeader("Content-Type").String("application/xml") 2560 2561 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 2562 rootAttr := []smithyxml.Attr{} 2563 root := smithyxml.StartElement{ 2564 Name: smithyxml.Name{ 2565 Local: "RecursiveShapesInputOutput", 2566 }, 2567 Attr: rootAttr, 2568 } 2569 if err := awsRestxml_serializeOpDocumentRecursiveShapesInput(input, xmlEncoder.RootElement(root)); err != nil { 2570 return out, metadata, &smithy.SerializationError{Err: err} 2571 } 2572 if request, err = request.SetStream(bytes.NewReader(xmlEncoder.Bytes())); err != nil { 2573 return out, metadata, &smithy.SerializationError{Err: err} 2574 } 2575 2576 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 2577 return out, metadata, &smithy.SerializationError{Err: err} 2578 } 2579 in.Request = request 2580 2581 return next.HandleSerialize(ctx, in) 2582} 2583func awsRestxml_serializeOpHttpBindingsRecursiveShapesInput(v *RecursiveShapesInput, encoder *httpbinding.Encoder) error { 2584 if v == nil { 2585 return fmt.Errorf("unsupported serialization of nil %T", v) 2586 } 2587 2588 return nil 2589} 2590 2591func awsRestxml_serializeOpDocumentRecursiveShapesInput(v *RecursiveShapesInput, value smithyxml.Value) error { 2592 defer value.Close() 2593 if v.Nested != nil { 2594 rootAttr := []smithyxml.Attr{} 2595 root := smithyxml.StartElement{ 2596 Name: smithyxml.Name{ 2597 Local: "nested", 2598 }, 2599 Attr: rootAttr, 2600 } 2601 el := value.MemberElement(root) 2602 if err := awsRestxml_serializeDocumentRecursiveShapesInputOutputNested1(v.Nested, el); err != nil { 2603 return err 2604 } 2605 } 2606 return nil 2607} 2608 2609type awsRestxml_serializeOpSimpleScalarProperties struct { 2610} 2611 2612func (*awsRestxml_serializeOpSimpleScalarProperties) ID() string { 2613 return "OperationSerializer" 2614} 2615 2616func (m *awsRestxml_serializeOpSimpleScalarProperties) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 2617 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 2618) { 2619 request, ok := in.Request.(*smithyhttp.Request) 2620 if !ok { 2621 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 2622 } 2623 2624 input, ok := in.Parameters.(*SimpleScalarPropertiesInput) 2625 _ = input 2626 if !ok { 2627 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 2628 } 2629 2630 opPath, opQuery := httpbinding.SplitURI("/SimpleScalarProperties") 2631 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 2632 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 2633 request.Method = "PUT" 2634 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 2635 if err != nil { 2636 return out, metadata, &smithy.SerializationError{Err: err} 2637 } 2638 2639 if err := awsRestxml_serializeOpHttpBindingsSimpleScalarPropertiesInput(input, restEncoder); err != nil { 2640 return out, metadata, &smithy.SerializationError{Err: err} 2641 } 2642 2643 restEncoder.SetHeader("Content-Type").String("application/xml") 2644 2645 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 2646 rootAttr := []smithyxml.Attr{} 2647 root := smithyxml.StartElement{ 2648 Name: smithyxml.Name{ 2649 Local: "SimpleScalarPropertiesInputOutput", 2650 }, 2651 Attr: rootAttr, 2652 } 2653 if err := awsRestxml_serializeOpDocumentSimpleScalarPropertiesInput(input, xmlEncoder.RootElement(root)); err != nil { 2654 return out, metadata, &smithy.SerializationError{Err: err} 2655 } 2656 if request, err = request.SetStream(bytes.NewReader(xmlEncoder.Bytes())); err != nil { 2657 return out, metadata, &smithy.SerializationError{Err: err} 2658 } 2659 2660 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 2661 return out, metadata, &smithy.SerializationError{Err: err} 2662 } 2663 in.Request = request 2664 2665 return next.HandleSerialize(ctx, in) 2666} 2667func awsRestxml_serializeOpHttpBindingsSimpleScalarPropertiesInput(v *SimpleScalarPropertiesInput, encoder *httpbinding.Encoder) error { 2668 if v == nil { 2669 return fmt.Errorf("unsupported serialization of nil %T", v) 2670 } 2671 2672 if v.Foo != nil && len(*v.Foo) > 0 { 2673 locationName := "X-Foo" 2674 encoder.SetHeader(locationName).String(*v.Foo) 2675 } 2676 2677 return nil 2678} 2679 2680func awsRestxml_serializeOpDocumentSimpleScalarPropertiesInput(v *SimpleScalarPropertiesInput, value smithyxml.Value) error { 2681 defer value.Close() 2682 if v.ByteValue != nil { 2683 rootAttr := []smithyxml.Attr{} 2684 root := smithyxml.StartElement{ 2685 Name: smithyxml.Name{ 2686 Local: "byteValue", 2687 }, 2688 Attr: rootAttr, 2689 } 2690 el := value.MemberElement(root) 2691 el.Byte(*v.ByteValue) 2692 } 2693 if v.DoubleValue != nil { 2694 rootAttr := []smithyxml.Attr{} 2695 root := smithyxml.StartElement{ 2696 Name: smithyxml.Name{ 2697 Local: "DoubleDribble", 2698 }, 2699 Attr: rootAttr, 2700 } 2701 el := value.MemberElement(root) 2702 switch { 2703 case math.IsNaN(*v.DoubleValue): 2704 el.String("NaN") 2705 2706 case math.IsInf(*v.DoubleValue, 1): 2707 el.String("Infinity") 2708 2709 case math.IsInf(*v.DoubleValue, -1): 2710 el.String("-Infinity") 2711 2712 default: 2713 el.Double(*v.DoubleValue) 2714 2715 } 2716 } 2717 if v.FalseBooleanValue != nil { 2718 rootAttr := []smithyxml.Attr{} 2719 root := smithyxml.StartElement{ 2720 Name: smithyxml.Name{ 2721 Local: "falseBooleanValue", 2722 }, 2723 Attr: rootAttr, 2724 } 2725 el := value.MemberElement(root) 2726 el.Boolean(*v.FalseBooleanValue) 2727 } 2728 if v.FloatValue != nil { 2729 rootAttr := []smithyxml.Attr{} 2730 root := smithyxml.StartElement{ 2731 Name: smithyxml.Name{ 2732 Local: "floatValue", 2733 }, 2734 Attr: rootAttr, 2735 } 2736 el := value.MemberElement(root) 2737 switch { 2738 case math.IsNaN(float64(*v.FloatValue)): 2739 el.String("NaN") 2740 2741 case math.IsInf(float64(*v.FloatValue), 1): 2742 el.String("Infinity") 2743 2744 case math.IsInf(float64(*v.FloatValue), -1): 2745 el.String("-Infinity") 2746 2747 default: 2748 el.Float(*v.FloatValue) 2749 2750 } 2751 } 2752 if v.IntegerValue != nil { 2753 rootAttr := []smithyxml.Attr{} 2754 root := smithyxml.StartElement{ 2755 Name: smithyxml.Name{ 2756 Local: "integerValue", 2757 }, 2758 Attr: rootAttr, 2759 } 2760 el := value.MemberElement(root) 2761 el.Integer(*v.IntegerValue) 2762 } 2763 if v.LongValue != nil { 2764 rootAttr := []smithyxml.Attr{} 2765 root := smithyxml.StartElement{ 2766 Name: smithyxml.Name{ 2767 Local: "longValue", 2768 }, 2769 Attr: rootAttr, 2770 } 2771 el := value.MemberElement(root) 2772 el.Long(*v.LongValue) 2773 } 2774 if v.ShortValue != nil { 2775 rootAttr := []smithyxml.Attr{} 2776 root := smithyxml.StartElement{ 2777 Name: smithyxml.Name{ 2778 Local: "shortValue", 2779 }, 2780 Attr: rootAttr, 2781 } 2782 el := value.MemberElement(root) 2783 el.Short(*v.ShortValue) 2784 } 2785 if v.StringValue != nil { 2786 rootAttr := []smithyxml.Attr{} 2787 root := smithyxml.StartElement{ 2788 Name: smithyxml.Name{ 2789 Local: "stringValue", 2790 }, 2791 Attr: rootAttr, 2792 } 2793 el := value.MemberElement(root) 2794 el.String(*v.StringValue) 2795 } 2796 if v.TrueBooleanValue != nil { 2797 rootAttr := []smithyxml.Attr{} 2798 root := smithyxml.StartElement{ 2799 Name: smithyxml.Name{ 2800 Local: "trueBooleanValue", 2801 }, 2802 Attr: rootAttr, 2803 } 2804 el := value.MemberElement(root) 2805 el.Boolean(*v.TrueBooleanValue) 2806 } 2807 return nil 2808} 2809 2810type awsRestxml_serializeOpTimestampFormatHeaders struct { 2811} 2812 2813func (*awsRestxml_serializeOpTimestampFormatHeaders) ID() string { 2814 return "OperationSerializer" 2815} 2816 2817func (m *awsRestxml_serializeOpTimestampFormatHeaders) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 2818 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 2819) { 2820 request, ok := in.Request.(*smithyhttp.Request) 2821 if !ok { 2822 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 2823 } 2824 2825 input, ok := in.Parameters.(*TimestampFormatHeadersInput) 2826 _ = input 2827 if !ok { 2828 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 2829 } 2830 2831 opPath, opQuery := httpbinding.SplitURI("/TimestampFormatHeaders") 2832 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 2833 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 2834 request.Method = "POST" 2835 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 2836 if err != nil { 2837 return out, metadata, &smithy.SerializationError{Err: err} 2838 } 2839 2840 if err := awsRestxml_serializeOpHttpBindingsTimestampFormatHeadersInput(input, restEncoder); err != nil { 2841 return out, metadata, &smithy.SerializationError{Err: err} 2842 } 2843 2844 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 2845 return out, metadata, &smithy.SerializationError{Err: err} 2846 } 2847 in.Request = request 2848 2849 return next.HandleSerialize(ctx, in) 2850} 2851func awsRestxml_serializeOpHttpBindingsTimestampFormatHeadersInput(v *TimestampFormatHeadersInput, encoder *httpbinding.Encoder) error { 2852 if v == nil { 2853 return fmt.Errorf("unsupported serialization of nil %T", v) 2854 } 2855 2856 if v.DefaultFormat != nil { 2857 locationName := "X-Defaultformat" 2858 encoder.SetHeader(locationName).String(smithytime.FormatHTTPDate(*v.DefaultFormat)) 2859 } 2860 2861 if v.MemberDateTime != nil { 2862 locationName := "X-Memberdatetime" 2863 encoder.SetHeader(locationName).String(smithytime.FormatDateTime(*v.MemberDateTime)) 2864 } 2865 2866 if v.MemberEpochSeconds != nil { 2867 locationName := "X-Memberepochseconds" 2868 encoder.SetHeader(locationName).Double(smithytime.FormatEpochSeconds(*v.MemberEpochSeconds)) 2869 } 2870 2871 if v.MemberHttpDate != nil { 2872 locationName := "X-Memberhttpdate" 2873 encoder.SetHeader(locationName).String(smithytime.FormatHTTPDate(*v.MemberHttpDate)) 2874 } 2875 2876 if v.TargetDateTime != nil { 2877 locationName := "X-Targetdatetime" 2878 encoder.SetHeader(locationName).String(smithytime.FormatDateTime(*v.TargetDateTime)) 2879 } 2880 2881 if v.TargetEpochSeconds != nil { 2882 locationName := "X-Targetepochseconds" 2883 encoder.SetHeader(locationName).Double(smithytime.FormatEpochSeconds(*v.TargetEpochSeconds)) 2884 } 2885 2886 if v.TargetHttpDate != nil { 2887 locationName := "X-Targethttpdate" 2888 encoder.SetHeader(locationName).String(smithytime.FormatHTTPDate(*v.TargetHttpDate)) 2889 } 2890 2891 return nil 2892} 2893 2894type awsRestxml_serializeOpXmlAttributes struct { 2895} 2896 2897func (*awsRestxml_serializeOpXmlAttributes) ID() string { 2898 return "OperationSerializer" 2899} 2900 2901func (m *awsRestxml_serializeOpXmlAttributes) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 2902 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 2903) { 2904 request, ok := in.Request.(*smithyhttp.Request) 2905 if !ok { 2906 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 2907 } 2908 2909 input, ok := in.Parameters.(*XmlAttributesInput) 2910 _ = input 2911 if !ok { 2912 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 2913 } 2914 2915 opPath, opQuery := httpbinding.SplitURI("/XmlAttributes") 2916 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 2917 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 2918 request.Method = "PUT" 2919 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 2920 if err != nil { 2921 return out, metadata, &smithy.SerializationError{Err: err} 2922 } 2923 2924 restEncoder.SetHeader("Content-Type").String("application/xml") 2925 2926 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 2927 rootAttr := []smithyxml.Attr{} 2928 if input.Attr != nil { 2929 var av string 2930 av = *input.Attr 2931 rootAttr = append(rootAttr, smithyxml.NewAttribute("test", av)) 2932 } 2933 root := smithyxml.StartElement{ 2934 Name: smithyxml.Name{ 2935 Local: "XmlAttributesInputOutput", 2936 }, 2937 Attr: rootAttr, 2938 } 2939 if err := awsRestxml_serializeOpDocumentXmlAttributesInput(input, xmlEncoder.RootElement(root)); err != nil { 2940 return out, metadata, &smithy.SerializationError{Err: err} 2941 } 2942 if request, err = request.SetStream(bytes.NewReader(xmlEncoder.Bytes())); err != nil { 2943 return out, metadata, &smithy.SerializationError{Err: err} 2944 } 2945 2946 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 2947 return out, metadata, &smithy.SerializationError{Err: err} 2948 } 2949 in.Request = request 2950 2951 return next.HandleSerialize(ctx, in) 2952} 2953func awsRestxml_serializeOpHttpBindingsXmlAttributesInput(v *XmlAttributesInput, encoder *httpbinding.Encoder) error { 2954 if v == nil { 2955 return fmt.Errorf("unsupported serialization of nil %T", v) 2956 } 2957 2958 return nil 2959} 2960 2961func awsRestxml_serializeOpDocumentXmlAttributesInput(v *XmlAttributesInput, value smithyxml.Value) error { 2962 defer value.Close() 2963 if v.Foo != nil { 2964 rootAttr := []smithyxml.Attr{} 2965 root := smithyxml.StartElement{ 2966 Name: smithyxml.Name{ 2967 Local: "foo", 2968 }, 2969 Attr: rootAttr, 2970 } 2971 el := value.MemberElement(root) 2972 el.String(*v.Foo) 2973 } 2974 return nil 2975} 2976 2977type awsRestxml_serializeOpXmlAttributesOnPayload struct { 2978} 2979 2980func (*awsRestxml_serializeOpXmlAttributesOnPayload) ID() string { 2981 return "OperationSerializer" 2982} 2983 2984func (m *awsRestxml_serializeOpXmlAttributesOnPayload) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 2985 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 2986) { 2987 request, ok := in.Request.(*smithyhttp.Request) 2988 if !ok { 2989 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 2990 } 2991 2992 input, ok := in.Parameters.(*XmlAttributesOnPayloadInput) 2993 _ = input 2994 if !ok { 2995 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 2996 } 2997 2998 opPath, opQuery := httpbinding.SplitURI("/XmlAttributesOnPayload") 2999 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 3000 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 3001 request.Method = "PUT" 3002 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 3003 if err != nil { 3004 return out, metadata, &smithy.SerializationError{Err: err} 3005 } 3006 3007 if input.Payload != nil { 3008 if !restEncoder.HasHeader("Content-Type") { 3009 restEncoder.SetHeader("Content-Type").String("application/xml") 3010 } 3011 3012 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 3013 payloadRootAttr := []smithyxml.Attr{} 3014 if input.Payload.Attr != nil { 3015 var av string 3016 av = *input.Payload.Attr 3017 payloadRootAttr = append(payloadRootAttr, smithyxml.NewAttribute("test", av)) 3018 } 3019 payloadRoot := smithyxml.StartElement{ 3020 Name: smithyxml.Name{ 3021 Local: "XmlAttributesInputOutput", 3022 }, 3023 Attr: payloadRootAttr, 3024 } 3025 if err := awsRestxml_serializeDocumentXmlAttributesInputOutput(input.Payload, xmlEncoder.RootElement(payloadRoot)); err != nil { 3026 return out, metadata, &smithy.SerializationError{Err: err} 3027 } 3028 payload := bytes.NewReader(xmlEncoder.Bytes()) 3029 if request, err = request.SetStream(payload); err != nil { 3030 return out, metadata, &smithy.SerializationError{Err: err} 3031 } 3032 } 3033 3034 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 3035 return out, metadata, &smithy.SerializationError{Err: err} 3036 } 3037 in.Request = request 3038 3039 return next.HandleSerialize(ctx, in) 3040} 3041func awsRestxml_serializeOpHttpBindingsXmlAttributesOnPayloadInput(v *XmlAttributesOnPayloadInput, encoder *httpbinding.Encoder) error { 3042 if v == nil { 3043 return fmt.Errorf("unsupported serialization of nil %T", v) 3044 } 3045 3046 return nil 3047} 3048 3049type awsRestxml_serializeOpXmlBlobs struct { 3050} 3051 3052func (*awsRestxml_serializeOpXmlBlobs) ID() string { 3053 return "OperationSerializer" 3054} 3055 3056func (m *awsRestxml_serializeOpXmlBlobs) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 3057 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 3058) { 3059 request, ok := in.Request.(*smithyhttp.Request) 3060 if !ok { 3061 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 3062 } 3063 3064 input, ok := in.Parameters.(*XmlBlobsInput) 3065 _ = input 3066 if !ok { 3067 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 3068 } 3069 3070 opPath, opQuery := httpbinding.SplitURI("/XmlBlobs") 3071 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 3072 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 3073 request.Method = "POST" 3074 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 3075 if err != nil { 3076 return out, metadata, &smithy.SerializationError{Err: err} 3077 } 3078 3079 restEncoder.SetHeader("Content-Type").String("application/xml") 3080 3081 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 3082 rootAttr := []smithyxml.Attr{} 3083 root := smithyxml.StartElement{ 3084 Name: smithyxml.Name{ 3085 Local: "XmlBlobsInputOutput", 3086 }, 3087 Attr: rootAttr, 3088 } 3089 if err := awsRestxml_serializeOpDocumentXmlBlobsInput(input, xmlEncoder.RootElement(root)); err != nil { 3090 return out, metadata, &smithy.SerializationError{Err: err} 3091 } 3092 if request, err = request.SetStream(bytes.NewReader(xmlEncoder.Bytes())); err != nil { 3093 return out, metadata, &smithy.SerializationError{Err: err} 3094 } 3095 3096 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 3097 return out, metadata, &smithy.SerializationError{Err: err} 3098 } 3099 in.Request = request 3100 3101 return next.HandleSerialize(ctx, in) 3102} 3103func awsRestxml_serializeOpHttpBindingsXmlBlobsInput(v *XmlBlobsInput, encoder *httpbinding.Encoder) error { 3104 if v == nil { 3105 return fmt.Errorf("unsupported serialization of nil %T", v) 3106 } 3107 3108 return nil 3109} 3110 3111func awsRestxml_serializeOpDocumentXmlBlobsInput(v *XmlBlobsInput, value smithyxml.Value) error { 3112 defer value.Close() 3113 if v.Data != nil { 3114 rootAttr := []smithyxml.Attr{} 3115 root := smithyxml.StartElement{ 3116 Name: smithyxml.Name{ 3117 Local: "data", 3118 }, 3119 Attr: rootAttr, 3120 } 3121 el := value.MemberElement(root) 3122 el.Base64EncodeBytes(v.Data) 3123 } 3124 return nil 3125} 3126 3127type awsRestxml_serializeOpXmlEmptyBlobs struct { 3128} 3129 3130func (*awsRestxml_serializeOpXmlEmptyBlobs) ID() string { 3131 return "OperationSerializer" 3132} 3133 3134func (m *awsRestxml_serializeOpXmlEmptyBlobs) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 3135 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 3136) { 3137 request, ok := in.Request.(*smithyhttp.Request) 3138 if !ok { 3139 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 3140 } 3141 3142 input, ok := in.Parameters.(*XmlEmptyBlobsInput) 3143 _ = input 3144 if !ok { 3145 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 3146 } 3147 3148 opPath, opQuery := httpbinding.SplitURI("/XmlEmptyBlobs") 3149 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 3150 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 3151 request.Method = "POST" 3152 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 3153 if err != nil { 3154 return out, metadata, &smithy.SerializationError{Err: err} 3155 } 3156 3157 restEncoder.SetHeader("Content-Type").String("application/xml") 3158 3159 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 3160 rootAttr := []smithyxml.Attr{} 3161 root := smithyxml.StartElement{ 3162 Name: smithyxml.Name{ 3163 Local: "XmlBlobsInputOutput", 3164 }, 3165 Attr: rootAttr, 3166 } 3167 if err := awsRestxml_serializeOpDocumentXmlEmptyBlobsInput(input, xmlEncoder.RootElement(root)); err != nil { 3168 return out, metadata, &smithy.SerializationError{Err: err} 3169 } 3170 if request, err = request.SetStream(bytes.NewReader(xmlEncoder.Bytes())); err != nil { 3171 return out, metadata, &smithy.SerializationError{Err: err} 3172 } 3173 3174 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 3175 return out, metadata, &smithy.SerializationError{Err: err} 3176 } 3177 in.Request = request 3178 3179 return next.HandleSerialize(ctx, in) 3180} 3181func awsRestxml_serializeOpHttpBindingsXmlEmptyBlobsInput(v *XmlEmptyBlobsInput, encoder *httpbinding.Encoder) error { 3182 if v == nil { 3183 return fmt.Errorf("unsupported serialization of nil %T", v) 3184 } 3185 3186 return nil 3187} 3188 3189func awsRestxml_serializeOpDocumentXmlEmptyBlobsInput(v *XmlEmptyBlobsInput, value smithyxml.Value) error { 3190 defer value.Close() 3191 if v.Data != nil { 3192 rootAttr := []smithyxml.Attr{} 3193 root := smithyxml.StartElement{ 3194 Name: smithyxml.Name{ 3195 Local: "data", 3196 }, 3197 Attr: rootAttr, 3198 } 3199 el := value.MemberElement(root) 3200 el.Base64EncodeBytes(v.Data) 3201 } 3202 return nil 3203} 3204 3205type awsRestxml_serializeOpXmlEmptyLists struct { 3206} 3207 3208func (*awsRestxml_serializeOpXmlEmptyLists) ID() string { 3209 return "OperationSerializer" 3210} 3211 3212func (m *awsRestxml_serializeOpXmlEmptyLists) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 3213 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 3214) { 3215 request, ok := in.Request.(*smithyhttp.Request) 3216 if !ok { 3217 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 3218 } 3219 3220 input, ok := in.Parameters.(*XmlEmptyListsInput) 3221 _ = input 3222 if !ok { 3223 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 3224 } 3225 3226 opPath, opQuery := httpbinding.SplitURI("/XmlEmptyLists") 3227 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 3228 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 3229 request.Method = "PUT" 3230 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 3231 if err != nil { 3232 return out, metadata, &smithy.SerializationError{Err: err} 3233 } 3234 3235 restEncoder.SetHeader("Content-Type").String("application/xml") 3236 3237 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 3238 rootAttr := []smithyxml.Attr{} 3239 root := smithyxml.StartElement{ 3240 Name: smithyxml.Name{ 3241 Local: "XmlListsInputOutput", 3242 }, 3243 Attr: rootAttr, 3244 } 3245 if err := awsRestxml_serializeOpDocumentXmlEmptyListsInput(input, xmlEncoder.RootElement(root)); err != nil { 3246 return out, metadata, &smithy.SerializationError{Err: err} 3247 } 3248 if request, err = request.SetStream(bytes.NewReader(xmlEncoder.Bytes())); err != nil { 3249 return out, metadata, &smithy.SerializationError{Err: err} 3250 } 3251 3252 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 3253 return out, metadata, &smithy.SerializationError{Err: err} 3254 } 3255 in.Request = request 3256 3257 return next.HandleSerialize(ctx, in) 3258} 3259func awsRestxml_serializeOpHttpBindingsXmlEmptyListsInput(v *XmlEmptyListsInput, encoder *httpbinding.Encoder) error { 3260 if v == nil { 3261 return fmt.Errorf("unsupported serialization of nil %T", v) 3262 } 3263 3264 return nil 3265} 3266 3267func awsRestxml_serializeOpDocumentXmlEmptyListsInput(v *XmlEmptyListsInput, value smithyxml.Value) error { 3268 defer value.Close() 3269 if v.BooleanList != nil { 3270 rootAttr := []smithyxml.Attr{} 3271 root := smithyxml.StartElement{ 3272 Name: smithyxml.Name{ 3273 Local: "booleanList", 3274 }, 3275 Attr: rootAttr, 3276 } 3277 el := value.MemberElement(root) 3278 if err := awsRestxml_serializeDocumentBooleanList(v.BooleanList, el); err != nil { 3279 return err 3280 } 3281 } 3282 if v.EnumList != nil { 3283 rootAttr := []smithyxml.Attr{} 3284 root := smithyxml.StartElement{ 3285 Name: smithyxml.Name{ 3286 Local: "enumList", 3287 }, 3288 Attr: rootAttr, 3289 } 3290 el := value.MemberElement(root) 3291 if err := awsRestxml_serializeDocumentFooEnumList(v.EnumList, el); err != nil { 3292 return err 3293 } 3294 } 3295 if v.FlattenedList != nil { 3296 rootAttr := []smithyxml.Attr{} 3297 root := smithyxml.StartElement{ 3298 Name: smithyxml.Name{ 3299 Local: "flattenedList", 3300 }, 3301 Attr: rootAttr, 3302 } 3303 el := value.FlattenedElement(root) 3304 if err := awsRestxml_serializeDocumentRenamedListMembers(v.FlattenedList, el); err != nil { 3305 return err 3306 } 3307 } 3308 if v.FlattenedList2 != nil { 3309 rootAttr := []smithyxml.Attr{} 3310 root := smithyxml.StartElement{ 3311 Name: smithyxml.Name{ 3312 Local: "customName", 3313 }, 3314 Attr: rootAttr, 3315 } 3316 el := value.FlattenedElement(root) 3317 if err := awsRestxml_serializeDocumentRenamedListMembers(v.FlattenedList2, el); err != nil { 3318 return err 3319 } 3320 } 3321 if v.FlattenedListWithMemberNamespace != nil { 3322 rootAttr := []smithyxml.Attr{} 3323 root := smithyxml.StartElement{ 3324 Name: smithyxml.Name{ 3325 Local: "flattenedListWithMemberNamespace", 3326 }, 3327 Attr: rootAttr, 3328 } 3329 el := value.FlattenedElement(root) 3330 if err := awsRestxml_serializeDocumentListWithMemberNamespace(v.FlattenedListWithMemberNamespace, el); err != nil { 3331 return err 3332 } 3333 } 3334 if v.FlattenedListWithNamespace != nil { 3335 rootAttr := []smithyxml.Attr{} 3336 root := smithyxml.StartElement{ 3337 Name: smithyxml.Name{ 3338 Local: "flattenedListWithNamespace", 3339 }, 3340 Attr: rootAttr, 3341 } 3342 el := value.FlattenedElement(root) 3343 if err := awsRestxml_serializeDocumentListWithNamespace(v.FlattenedListWithNamespace, el); err != nil { 3344 return err 3345 } 3346 } 3347 if v.FlattenedStructureList != nil { 3348 rootAttr := []smithyxml.Attr{} 3349 root := smithyxml.StartElement{ 3350 Name: smithyxml.Name{ 3351 Local: "flattenedStructureList", 3352 }, 3353 Attr: rootAttr, 3354 } 3355 el := value.FlattenedElement(root) 3356 if err := awsRestxml_serializeDocumentStructureList(v.FlattenedStructureList, el); err != nil { 3357 return err 3358 } 3359 } 3360 if v.IntegerList != nil { 3361 rootAttr := []smithyxml.Attr{} 3362 root := smithyxml.StartElement{ 3363 Name: smithyxml.Name{ 3364 Local: "integerList", 3365 }, 3366 Attr: rootAttr, 3367 } 3368 el := value.MemberElement(root) 3369 if err := awsRestxml_serializeDocumentIntegerList(v.IntegerList, el); err != nil { 3370 return err 3371 } 3372 } 3373 if v.NestedStringList != nil { 3374 rootAttr := []smithyxml.Attr{} 3375 root := smithyxml.StartElement{ 3376 Name: smithyxml.Name{ 3377 Local: "nestedStringList", 3378 }, 3379 Attr: rootAttr, 3380 } 3381 el := value.MemberElement(root) 3382 if err := awsRestxml_serializeDocumentNestedStringList(v.NestedStringList, el); err != nil { 3383 return err 3384 } 3385 } 3386 if v.RenamedListMembers != nil { 3387 rootAttr := []smithyxml.Attr{} 3388 root := smithyxml.StartElement{ 3389 Name: smithyxml.Name{ 3390 Local: "renamed", 3391 }, 3392 Attr: rootAttr, 3393 } 3394 el := value.MemberElement(root) 3395 if err := awsRestxml_serializeDocumentRenamedListMembers(v.RenamedListMembers, el); err != nil { 3396 return err 3397 } 3398 } 3399 if v.StringList != nil { 3400 rootAttr := []smithyxml.Attr{} 3401 root := smithyxml.StartElement{ 3402 Name: smithyxml.Name{ 3403 Local: "stringList", 3404 }, 3405 Attr: rootAttr, 3406 } 3407 el := value.MemberElement(root) 3408 if err := awsRestxml_serializeDocumentStringList(v.StringList, el); err != nil { 3409 return err 3410 } 3411 } 3412 if v.StringSet != nil { 3413 rootAttr := []smithyxml.Attr{} 3414 root := smithyxml.StartElement{ 3415 Name: smithyxml.Name{ 3416 Local: "stringSet", 3417 }, 3418 Attr: rootAttr, 3419 } 3420 el := value.MemberElement(root) 3421 if err := awsRestxml_serializeDocumentStringSet(v.StringSet, el); err != nil { 3422 return err 3423 } 3424 } 3425 if v.StructureList != nil { 3426 rootAttr := []smithyxml.Attr{} 3427 root := smithyxml.StartElement{ 3428 Name: smithyxml.Name{ 3429 Local: "myStructureList", 3430 }, 3431 Attr: rootAttr, 3432 } 3433 el := value.MemberElement(root) 3434 if err := awsRestxml_serializeDocumentStructureList(v.StructureList, el); err != nil { 3435 return err 3436 } 3437 } 3438 if v.TimestampList != nil { 3439 rootAttr := []smithyxml.Attr{} 3440 root := smithyxml.StartElement{ 3441 Name: smithyxml.Name{ 3442 Local: "timestampList", 3443 }, 3444 Attr: rootAttr, 3445 } 3446 el := value.MemberElement(root) 3447 if err := awsRestxml_serializeDocumentTimestampList(v.TimestampList, el); err != nil { 3448 return err 3449 } 3450 } 3451 return nil 3452} 3453 3454type awsRestxml_serializeOpXmlEmptyMaps struct { 3455} 3456 3457func (*awsRestxml_serializeOpXmlEmptyMaps) ID() string { 3458 return "OperationSerializer" 3459} 3460 3461func (m *awsRestxml_serializeOpXmlEmptyMaps) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 3462 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 3463) { 3464 request, ok := in.Request.(*smithyhttp.Request) 3465 if !ok { 3466 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 3467 } 3468 3469 input, ok := in.Parameters.(*XmlEmptyMapsInput) 3470 _ = input 3471 if !ok { 3472 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 3473 } 3474 3475 opPath, opQuery := httpbinding.SplitURI("/XmlEmptyMaps") 3476 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 3477 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 3478 request.Method = "POST" 3479 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 3480 if err != nil { 3481 return out, metadata, &smithy.SerializationError{Err: err} 3482 } 3483 3484 restEncoder.SetHeader("Content-Type").String("application/xml") 3485 3486 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 3487 rootAttr := []smithyxml.Attr{} 3488 root := smithyxml.StartElement{ 3489 Name: smithyxml.Name{ 3490 Local: "XmlMapsInputOutput", 3491 }, 3492 Attr: rootAttr, 3493 } 3494 if err := awsRestxml_serializeOpDocumentXmlEmptyMapsInput(input, xmlEncoder.RootElement(root)); err != nil { 3495 return out, metadata, &smithy.SerializationError{Err: err} 3496 } 3497 if request, err = request.SetStream(bytes.NewReader(xmlEncoder.Bytes())); err != nil { 3498 return out, metadata, &smithy.SerializationError{Err: err} 3499 } 3500 3501 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 3502 return out, metadata, &smithy.SerializationError{Err: err} 3503 } 3504 in.Request = request 3505 3506 return next.HandleSerialize(ctx, in) 3507} 3508func awsRestxml_serializeOpHttpBindingsXmlEmptyMapsInput(v *XmlEmptyMapsInput, encoder *httpbinding.Encoder) error { 3509 if v == nil { 3510 return fmt.Errorf("unsupported serialization of nil %T", v) 3511 } 3512 3513 return nil 3514} 3515 3516func awsRestxml_serializeOpDocumentXmlEmptyMapsInput(v *XmlEmptyMapsInput, value smithyxml.Value) error { 3517 defer value.Close() 3518 if v.MyMap != nil { 3519 rootAttr := []smithyxml.Attr{} 3520 root := smithyxml.StartElement{ 3521 Name: smithyxml.Name{ 3522 Local: "myMap", 3523 }, 3524 Attr: rootAttr, 3525 } 3526 el := value.MemberElement(root) 3527 if err := awsRestxml_serializeDocumentXmlMapsInputOutputMap(v.MyMap, el); err != nil { 3528 return err 3529 } 3530 } 3531 return nil 3532} 3533 3534type awsRestxml_serializeOpXmlEmptyStrings struct { 3535} 3536 3537func (*awsRestxml_serializeOpXmlEmptyStrings) ID() string { 3538 return "OperationSerializer" 3539} 3540 3541func (m *awsRestxml_serializeOpXmlEmptyStrings) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 3542 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 3543) { 3544 request, ok := in.Request.(*smithyhttp.Request) 3545 if !ok { 3546 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 3547 } 3548 3549 input, ok := in.Parameters.(*XmlEmptyStringsInput) 3550 _ = input 3551 if !ok { 3552 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 3553 } 3554 3555 opPath, opQuery := httpbinding.SplitURI("/XmlEmptyStrings") 3556 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 3557 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 3558 request.Method = "PUT" 3559 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 3560 if err != nil { 3561 return out, metadata, &smithy.SerializationError{Err: err} 3562 } 3563 3564 restEncoder.SetHeader("Content-Type").String("application/xml") 3565 3566 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 3567 rootAttr := []smithyxml.Attr{} 3568 root := smithyxml.StartElement{ 3569 Name: smithyxml.Name{ 3570 Local: "XmlEmptyStringsInputOutput", 3571 }, 3572 Attr: rootAttr, 3573 } 3574 if err := awsRestxml_serializeOpDocumentXmlEmptyStringsInput(input, xmlEncoder.RootElement(root)); err != nil { 3575 return out, metadata, &smithy.SerializationError{Err: err} 3576 } 3577 if request, err = request.SetStream(bytes.NewReader(xmlEncoder.Bytes())); err != nil { 3578 return out, metadata, &smithy.SerializationError{Err: err} 3579 } 3580 3581 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 3582 return out, metadata, &smithy.SerializationError{Err: err} 3583 } 3584 in.Request = request 3585 3586 return next.HandleSerialize(ctx, in) 3587} 3588func awsRestxml_serializeOpHttpBindingsXmlEmptyStringsInput(v *XmlEmptyStringsInput, encoder *httpbinding.Encoder) error { 3589 if v == nil { 3590 return fmt.Errorf("unsupported serialization of nil %T", v) 3591 } 3592 3593 return nil 3594} 3595 3596func awsRestxml_serializeOpDocumentXmlEmptyStringsInput(v *XmlEmptyStringsInput, value smithyxml.Value) error { 3597 defer value.Close() 3598 if v.EmptyString != nil { 3599 rootAttr := []smithyxml.Attr{} 3600 root := smithyxml.StartElement{ 3601 Name: smithyxml.Name{ 3602 Local: "emptyString", 3603 }, 3604 Attr: rootAttr, 3605 } 3606 el := value.MemberElement(root) 3607 el.String(*v.EmptyString) 3608 } 3609 return nil 3610} 3611 3612type awsRestxml_serializeOpXmlEnums struct { 3613} 3614 3615func (*awsRestxml_serializeOpXmlEnums) ID() string { 3616 return "OperationSerializer" 3617} 3618 3619func (m *awsRestxml_serializeOpXmlEnums) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 3620 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 3621) { 3622 request, ok := in.Request.(*smithyhttp.Request) 3623 if !ok { 3624 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 3625 } 3626 3627 input, ok := in.Parameters.(*XmlEnumsInput) 3628 _ = input 3629 if !ok { 3630 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 3631 } 3632 3633 opPath, opQuery := httpbinding.SplitURI("/XmlEnums") 3634 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 3635 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 3636 request.Method = "PUT" 3637 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 3638 if err != nil { 3639 return out, metadata, &smithy.SerializationError{Err: err} 3640 } 3641 3642 restEncoder.SetHeader("Content-Type").String("application/xml") 3643 3644 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 3645 rootAttr := []smithyxml.Attr{} 3646 root := smithyxml.StartElement{ 3647 Name: smithyxml.Name{ 3648 Local: "XmlEnumsInputOutput", 3649 }, 3650 Attr: rootAttr, 3651 } 3652 if err := awsRestxml_serializeOpDocumentXmlEnumsInput(input, xmlEncoder.RootElement(root)); err != nil { 3653 return out, metadata, &smithy.SerializationError{Err: err} 3654 } 3655 if request, err = request.SetStream(bytes.NewReader(xmlEncoder.Bytes())); err != nil { 3656 return out, metadata, &smithy.SerializationError{Err: err} 3657 } 3658 3659 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 3660 return out, metadata, &smithy.SerializationError{Err: err} 3661 } 3662 in.Request = request 3663 3664 return next.HandleSerialize(ctx, in) 3665} 3666func awsRestxml_serializeOpHttpBindingsXmlEnumsInput(v *XmlEnumsInput, encoder *httpbinding.Encoder) error { 3667 if v == nil { 3668 return fmt.Errorf("unsupported serialization of nil %T", v) 3669 } 3670 3671 return nil 3672} 3673 3674func awsRestxml_serializeOpDocumentXmlEnumsInput(v *XmlEnumsInput, value smithyxml.Value) error { 3675 defer value.Close() 3676 if len(v.FooEnum1) > 0 { 3677 rootAttr := []smithyxml.Attr{} 3678 root := smithyxml.StartElement{ 3679 Name: smithyxml.Name{ 3680 Local: "fooEnum1", 3681 }, 3682 Attr: rootAttr, 3683 } 3684 el := value.MemberElement(root) 3685 el.String(string(v.FooEnum1)) 3686 } 3687 if len(v.FooEnum2) > 0 { 3688 rootAttr := []smithyxml.Attr{} 3689 root := smithyxml.StartElement{ 3690 Name: smithyxml.Name{ 3691 Local: "fooEnum2", 3692 }, 3693 Attr: rootAttr, 3694 } 3695 el := value.MemberElement(root) 3696 el.String(string(v.FooEnum2)) 3697 } 3698 if len(v.FooEnum3) > 0 { 3699 rootAttr := []smithyxml.Attr{} 3700 root := smithyxml.StartElement{ 3701 Name: smithyxml.Name{ 3702 Local: "fooEnum3", 3703 }, 3704 Attr: rootAttr, 3705 } 3706 el := value.MemberElement(root) 3707 el.String(string(v.FooEnum3)) 3708 } 3709 if v.FooEnumList != nil { 3710 rootAttr := []smithyxml.Attr{} 3711 root := smithyxml.StartElement{ 3712 Name: smithyxml.Name{ 3713 Local: "fooEnumList", 3714 }, 3715 Attr: rootAttr, 3716 } 3717 el := value.MemberElement(root) 3718 if err := awsRestxml_serializeDocumentFooEnumList(v.FooEnumList, el); err != nil { 3719 return err 3720 } 3721 } 3722 if v.FooEnumMap != nil { 3723 rootAttr := []smithyxml.Attr{} 3724 root := smithyxml.StartElement{ 3725 Name: smithyxml.Name{ 3726 Local: "fooEnumMap", 3727 }, 3728 Attr: rootAttr, 3729 } 3730 el := value.MemberElement(root) 3731 if err := awsRestxml_serializeDocumentFooEnumMap(v.FooEnumMap, el); err != nil { 3732 return err 3733 } 3734 } 3735 if v.FooEnumSet != nil { 3736 rootAttr := []smithyxml.Attr{} 3737 root := smithyxml.StartElement{ 3738 Name: smithyxml.Name{ 3739 Local: "fooEnumSet", 3740 }, 3741 Attr: rootAttr, 3742 } 3743 el := value.MemberElement(root) 3744 if err := awsRestxml_serializeDocumentFooEnumSet(v.FooEnumSet, el); err != nil { 3745 return err 3746 } 3747 } 3748 return nil 3749} 3750 3751type awsRestxml_serializeOpXmlLists struct { 3752} 3753 3754func (*awsRestxml_serializeOpXmlLists) ID() string { 3755 return "OperationSerializer" 3756} 3757 3758func (m *awsRestxml_serializeOpXmlLists) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 3759 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 3760) { 3761 request, ok := in.Request.(*smithyhttp.Request) 3762 if !ok { 3763 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 3764 } 3765 3766 input, ok := in.Parameters.(*XmlListsInput) 3767 _ = input 3768 if !ok { 3769 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 3770 } 3771 3772 opPath, opQuery := httpbinding.SplitURI("/XmlLists") 3773 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 3774 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 3775 request.Method = "PUT" 3776 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 3777 if err != nil { 3778 return out, metadata, &smithy.SerializationError{Err: err} 3779 } 3780 3781 restEncoder.SetHeader("Content-Type").String("application/xml") 3782 3783 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 3784 rootAttr := []smithyxml.Attr{} 3785 root := smithyxml.StartElement{ 3786 Name: smithyxml.Name{ 3787 Local: "XmlListsInputOutput", 3788 }, 3789 Attr: rootAttr, 3790 } 3791 if err := awsRestxml_serializeOpDocumentXmlListsInput(input, xmlEncoder.RootElement(root)); err != nil { 3792 return out, metadata, &smithy.SerializationError{Err: err} 3793 } 3794 if request, err = request.SetStream(bytes.NewReader(xmlEncoder.Bytes())); err != nil { 3795 return out, metadata, &smithy.SerializationError{Err: err} 3796 } 3797 3798 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 3799 return out, metadata, &smithy.SerializationError{Err: err} 3800 } 3801 in.Request = request 3802 3803 return next.HandleSerialize(ctx, in) 3804} 3805func awsRestxml_serializeOpHttpBindingsXmlListsInput(v *XmlListsInput, encoder *httpbinding.Encoder) error { 3806 if v == nil { 3807 return fmt.Errorf("unsupported serialization of nil %T", v) 3808 } 3809 3810 return nil 3811} 3812 3813func awsRestxml_serializeOpDocumentXmlListsInput(v *XmlListsInput, value smithyxml.Value) error { 3814 defer value.Close() 3815 if v.BooleanList != nil { 3816 rootAttr := []smithyxml.Attr{} 3817 root := smithyxml.StartElement{ 3818 Name: smithyxml.Name{ 3819 Local: "booleanList", 3820 }, 3821 Attr: rootAttr, 3822 } 3823 el := value.MemberElement(root) 3824 if err := awsRestxml_serializeDocumentBooleanList(v.BooleanList, el); err != nil { 3825 return err 3826 } 3827 } 3828 if v.EnumList != nil { 3829 rootAttr := []smithyxml.Attr{} 3830 root := smithyxml.StartElement{ 3831 Name: smithyxml.Name{ 3832 Local: "enumList", 3833 }, 3834 Attr: rootAttr, 3835 } 3836 el := value.MemberElement(root) 3837 if err := awsRestxml_serializeDocumentFooEnumList(v.EnumList, el); err != nil { 3838 return err 3839 } 3840 } 3841 if v.FlattenedList != nil { 3842 rootAttr := []smithyxml.Attr{} 3843 root := smithyxml.StartElement{ 3844 Name: smithyxml.Name{ 3845 Local: "flattenedList", 3846 }, 3847 Attr: rootAttr, 3848 } 3849 el := value.FlattenedElement(root) 3850 if err := awsRestxml_serializeDocumentRenamedListMembers(v.FlattenedList, el); err != nil { 3851 return err 3852 } 3853 } 3854 if v.FlattenedList2 != nil { 3855 rootAttr := []smithyxml.Attr{} 3856 root := smithyxml.StartElement{ 3857 Name: smithyxml.Name{ 3858 Local: "customName", 3859 }, 3860 Attr: rootAttr, 3861 } 3862 el := value.FlattenedElement(root) 3863 if err := awsRestxml_serializeDocumentRenamedListMembers(v.FlattenedList2, el); err != nil { 3864 return err 3865 } 3866 } 3867 if v.FlattenedListWithMemberNamespace != nil { 3868 rootAttr := []smithyxml.Attr{} 3869 root := smithyxml.StartElement{ 3870 Name: smithyxml.Name{ 3871 Local: "flattenedListWithMemberNamespace", 3872 }, 3873 Attr: rootAttr, 3874 } 3875 el := value.FlattenedElement(root) 3876 if err := awsRestxml_serializeDocumentListWithMemberNamespace(v.FlattenedListWithMemberNamespace, el); err != nil { 3877 return err 3878 } 3879 } 3880 if v.FlattenedListWithNamespace != nil { 3881 rootAttr := []smithyxml.Attr{} 3882 root := smithyxml.StartElement{ 3883 Name: smithyxml.Name{ 3884 Local: "flattenedListWithNamespace", 3885 }, 3886 Attr: rootAttr, 3887 } 3888 el := value.FlattenedElement(root) 3889 if err := awsRestxml_serializeDocumentListWithNamespace(v.FlattenedListWithNamespace, el); err != nil { 3890 return err 3891 } 3892 } 3893 if v.FlattenedStructureList != nil { 3894 rootAttr := []smithyxml.Attr{} 3895 root := smithyxml.StartElement{ 3896 Name: smithyxml.Name{ 3897 Local: "flattenedStructureList", 3898 }, 3899 Attr: rootAttr, 3900 } 3901 el := value.FlattenedElement(root) 3902 if err := awsRestxml_serializeDocumentStructureList(v.FlattenedStructureList, el); err != nil { 3903 return err 3904 } 3905 } 3906 if v.IntegerList != nil { 3907 rootAttr := []smithyxml.Attr{} 3908 root := smithyxml.StartElement{ 3909 Name: smithyxml.Name{ 3910 Local: "integerList", 3911 }, 3912 Attr: rootAttr, 3913 } 3914 el := value.MemberElement(root) 3915 if err := awsRestxml_serializeDocumentIntegerList(v.IntegerList, el); err != nil { 3916 return err 3917 } 3918 } 3919 if v.NestedStringList != nil { 3920 rootAttr := []smithyxml.Attr{} 3921 root := smithyxml.StartElement{ 3922 Name: smithyxml.Name{ 3923 Local: "nestedStringList", 3924 }, 3925 Attr: rootAttr, 3926 } 3927 el := value.MemberElement(root) 3928 if err := awsRestxml_serializeDocumentNestedStringList(v.NestedStringList, el); err != nil { 3929 return err 3930 } 3931 } 3932 if v.RenamedListMembers != nil { 3933 rootAttr := []smithyxml.Attr{} 3934 root := smithyxml.StartElement{ 3935 Name: smithyxml.Name{ 3936 Local: "renamed", 3937 }, 3938 Attr: rootAttr, 3939 } 3940 el := value.MemberElement(root) 3941 if err := awsRestxml_serializeDocumentRenamedListMembers(v.RenamedListMembers, el); err != nil { 3942 return err 3943 } 3944 } 3945 if v.StringList != nil { 3946 rootAttr := []smithyxml.Attr{} 3947 root := smithyxml.StartElement{ 3948 Name: smithyxml.Name{ 3949 Local: "stringList", 3950 }, 3951 Attr: rootAttr, 3952 } 3953 el := value.MemberElement(root) 3954 if err := awsRestxml_serializeDocumentStringList(v.StringList, el); err != nil { 3955 return err 3956 } 3957 } 3958 if v.StringSet != nil { 3959 rootAttr := []smithyxml.Attr{} 3960 root := smithyxml.StartElement{ 3961 Name: smithyxml.Name{ 3962 Local: "stringSet", 3963 }, 3964 Attr: rootAttr, 3965 } 3966 el := value.MemberElement(root) 3967 if err := awsRestxml_serializeDocumentStringSet(v.StringSet, el); err != nil { 3968 return err 3969 } 3970 } 3971 if v.StructureList != nil { 3972 rootAttr := []smithyxml.Attr{} 3973 root := smithyxml.StartElement{ 3974 Name: smithyxml.Name{ 3975 Local: "myStructureList", 3976 }, 3977 Attr: rootAttr, 3978 } 3979 el := value.MemberElement(root) 3980 if err := awsRestxml_serializeDocumentStructureList(v.StructureList, el); err != nil { 3981 return err 3982 } 3983 } 3984 if v.TimestampList != nil { 3985 rootAttr := []smithyxml.Attr{} 3986 root := smithyxml.StartElement{ 3987 Name: smithyxml.Name{ 3988 Local: "timestampList", 3989 }, 3990 Attr: rootAttr, 3991 } 3992 el := value.MemberElement(root) 3993 if err := awsRestxml_serializeDocumentTimestampList(v.TimestampList, el); err != nil { 3994 return err 3995 } 3996 } 3997 return nil 3998} 3999 4000type awsRestxml_serializeOpXmlMaps struct { 4001} 4002 4003func (*awsRestxml_serializeOpXmlMaps) ID() string { 4004 return "OperationSerializer" 4005} 4006 4007func (m *awsRestxml_serializeOpXmlMaps) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 4008 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 4009) { 4010 request, ok := in.Request.(*smithyhttp.Request) 4011 if !ok { 4012 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 4013 } 4014 4015 input, ok := in.Parameters.(*XmlMapsInput) 4016 _ = input 4017 if !ok { 4018 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 4019 } 4020 4021 opPath, opQuery := httpbinding.SplitURI("/XmlMaps") 4022 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 4023 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 4024 request.Method = "POST" 4025 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 4026 if err != nil { 4027 return out, metadata, &smithy.SerializationError{Err: err} 4028 } 4029 4030 restEncoder.SetHeader("Content-Type").String("application/xml") 4031 4032 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 4033 rootAttr := []smithyxml.Attr{} 4034 root := smithyxml.StartElement{ 4035 Name: smithyxml.Name{ 4036 Local: "XmlMapsInputOutput", 4037 }, 4038 Attr: rootAttr, 4039 } 4040 if err := awsRestxml_serializeOpDocumentXmlMapsInput(input, xmlEncoder.RootElement(root)); err != nil { 4041 return out, metadata, &smithy.SerializationError{Err: err} 4042 } 4043 if request, err = request.SetStream(bytes.NewReader(xmlEncoder.Bytes())); err != nil { 4044 return out, metadata, &smithy.SerializationError{Err: err} 4045 } 4046 4047 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 4048 return out, metadata, &smithy.SerializationError{Err: err} 4049 } 4050 in.Request = request 4051 4052 return next.HandleSerialize(ctx, in) 4053} 4054func awsRestxml_serializeOpHttpBindingsXmlMapsInput(v *XmlMapsInput, encoder *httpbinding.Encoder) error { 4055 if v == nil { 4056 return fmt.Errorf("unsupported serialization of nil %T", v) 4057 } 4058 4059 return nil 4060} 4061 4062func awsRestxml_serializeOpDocumentXmlMapsInput(v *XmlMapsInput, value smithyxml.Value) error { 4063 defer value.Close() 4064 if v.MyMap != nil { 4065 rootAttr := []smithyxml.Attr{} 4066 root := smithyxml.StartElement{ 4067 Name: smithyxml.Name{ 4068 Local: "myMap", 4069 }, 4070 Attr: rootAttr, 4071 } 4072 el := value.MemberElement(root) 4073 if err := awsRestxml_serializeDocumentXmlMapsInputOutputMap(v.MyMap, el); err != nil { 4074 return err 4075 } 4076 } 4077 return nil 4078} 4079 4080type awsRestxml_serializeOpXmlMapsXmlName struct { 4081} 4082 4083func (*awsRestxml_serializeOpXmlMapsXmlName) ID() string { 4084 return "OperationSerializer" 4085} 4086 4087func (m *awsRestxml_serializeOpXmlMapsXmlName) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 4088 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 4089) { 4090 request, ok := in.Request.(*smithyhttp.Request) 4091 if !ok { 4092 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 4093 } 4094 4095 input, ok := in.Parameters.(*XmlMapsXmlNameInput) 4096 _ = input 4097 if !ok { 4098 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 4099 } 4100 4101 opPath, opQuery := httpbinding.SplitURI("/XmlMapsXmlName") 4102 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 4103 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 4104 request.Method = "POST" 4105 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 4106 if err != nil { 4107 return out, metadata, &smithy.SerializationError{Err: err} 4108 } 4109 4110 restEncoder.SetHeader("Content-Type").String("application/xml") 4111 4112 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 4113 rootAttr := []smithyxml.Attr{} 4114 root := smithyxml.StartElement{ 4115 Name: smithyxml.Name{ 4116 Local: "XmlMapsXmlNameInputOutput", 4117 }, 4118 Attr: rootAttr, 4119 } 4120 if err := awsRestxml_serializeOpDocumentXmlMapsXmlNameInput(input, xmlEncoder.RootElement(root)); err != nil { 4121 return out, metadata, &smithy.SerializationError{Err: err} 4122 } 4123 if request, err = request.SetStream(bytes.NewReader(xmlEncoder.Bytes())); err != nil { 4124 return out, metadata, &smithy.SerializationError{Err: err} 4125 } 4126 4127 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 4128 return out, metadata, &smithy.SerializationError{Err: err} 4129 } 4130 in.Request = request 4131 4132 return next.HandleSerialize(ctx, in) 4133} 4134func awsRestxml_serializeOpHttpBindingsXmlMapsXmlNameInput(v *XmlMapsXmlNameInput, encoder *httpbinding.Encoder) error { 4135 if v == nil { 4136 return fmt.Errorf("unsupported serialization of nil %T", v) 4137 } 4138 4139 return nil 4140} 4141 4142func awsRestxml_serializeOpDocumentXmlMapsXmlNameInput(v *XmlMapsXmlNameInput, value smithyxml.Value) error { 4143 defer value.Close() 4144 if v.MyMap != nil { 4145 rootAttr := []smithyxml.Attr{} 4146 root := smithyxml.StartElement{ 4147 Name: smithyxml.Name{ 4148 Local: "myMap", 4149 }, 4150 Attr: rootAttr, 4151 } 4152 el := value.MemberElement(root) 4153 if err := awsRestxml_serializeDocumentXmlMapsXmlNameInputOutputMap(v.MyMap, el); err != nil { 4154 return err 4155 } 4156 } 4157 return nil 4158} 4159 4160type awsRestxml_serializeOpXmlNamespaces struct { 4161} 4162 4163func (*awsRestxml_serializeOpXmlNamespaces) ID() string { 4164 return "OperationSerializer" 4165} 4166 4167func (m *awsRestxml_serializeOpXmlNamespaces) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 4168 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 4169) { 4170 request, ok := in.Request.(*smithyhttp.Request) 4171 if !ok { 4172 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 4173 } 4174 4175 input, ok := in.Parameters.(*XmlNamespacesInput) 4176 _ = input 4177 if !ok { 4178 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 4179 } 4180 4181 opPath, opQuery := httpbinding.SplitURI("/XmlNamespaces") 4182 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 4183 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 4184 request.Method = "POST" 4185 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 4186 if err != nil { 4187 return out, metadata, &smithy.SerializationError{Err: err} 4188 } 4189 4190 restEncoder.SetHeader("Content-Type").String("application/xml") 4191 4192 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 4193 rootAttr := []smithyxml.Attr{} 4194 rootAttr = append(rootAttr, smithyxml.NewNamespaceAttribute("", "http://foo.com")) 4195 root := smithyxml.StartElement{ 4196 Name: smithyxml.Name{ 4197 Local: "XmlNamespacesInputOutput", 4198 }, 4199 Attr: rootAttr, 4200 } 4201 if err := awsRestxml_serializeOpDocumentXmlNamespacesInput(input, xmlEncoder.RootElement(root)); err != nil { 4202 return out, metadata, &smithy.SerializationError{Err: err} 4203 } 4204 if request, err = request.SetStream(bytes.NewReader(xmlEncoder.Bytes())); err != nil { 4205 return out, metadata, &smithy.SerializationError{Err: err} 4206 } 4207 4208 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 4209 return out, metadata, &smithy.SerializationError{Err: err} 4210 } 4211 in.Request = request 4212 4213 return next.HandleSerialize(ctx, in) 4214} 4215func awsRestxml_serializeOpHttpBindingsXmlNamespacesInput(v *XmlNamespacesInput, encoder *httpbinding.Encoder) error { 4216 if v == nil { 4217 return fmt.Errorf("unsupported serialization of nil %T", v) 4218 } 4219 4220 return nil 4221} 4222 4223func awsRestxml_serializeOpDocumentXmlNamespacesInput(v *XmlNamespacesInput, value smithyxml.Value) error { 4224 defer value.Close() 4225 if v.Nested != nil { 4226 rootAttr := []smithyxml.Attr{} 4227 root := smithyxml.StartElement{ 4228 Name: smithyxml.Name{ 4229 Local: "nested", 4230 }, 4231 Attr: rootAttr, 4232 } 4233 el := value.MemberElement(root) 4234 if err := awsRestxml_serializeDocumentXmlNamespaceNested(v.Nested, el); err != nil { 4235 return err 4236 } 4237 } 4238 return nil 4239} 4240 4241type awsRestxml_serializeOpXmlTimestamps struct { 4242} 4243 4244func (*awsRestxml_serializeOpXmlTimestamps) ID() string { 4245 return "OperationSerializer" 4246} 4247 4248func (m *awsRestxml_serializeOpXmlTimestamps) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 4249 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 4250) { 4251 request, ok := in.Request.(*smithyhttp.Request) 4252 if !ok { 4253 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 4254 } 4255 4256 input, ok := in.Parameters.(*XmlTimestampsInput) 4257 _ = input 4258 if !ok { 4259 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 4260 } 4261 4262 opPath, opQuery := httpbinding.SplitURI("/XmlTimestamps") 4263 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 4264 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 4265 request.Method = "POST" 4266 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 4267 if err != nil { 4268 return out, metadata, &smithy.SerializationError{Err: err} 4269 } 4270 4271 restEncoder.SetHeader("Content-Type").String("application/xml") 4272 4273 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 4274 rootAttr := []smithyxml.Attr{} 4275 root := smithyxml.StartElement{ 4276 Name: smithyxml.Name{ 4277 Local: "XmlTimestampsInputOutput", 4278 }, 4279 Attr: rootAttr, 4280 } 4281 if err := awsRestxml_serializeOpDocumentXmlTimestampsInput(input, xmlEncoder.RootElement(root)); err != nil { 4282 return out, metadata, &smithy.SerializationError{Err: err} 4283 } 4284 if request, err = request.SetStream(bytes.NewReader(xmlEncoder.Bytes())); err != nil { 4285 return out, metadata, &smithy.SerializationError{Err: err} 4286 } 4287 4288 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 4289 return out, metadata, &smithy.SerializationError{Err: err} 4290 } 4291 in.Request = request 4292 4293 return next.HandleSerialize(ctx, in) 4294} 4295func awsRestxml_serializeOpHttpBindingsXmlTimestampsInput(v *XmlTimestampsInput, encoder *httpbinding.Encoder) error { 4296 if v == nil { 4297 return fmt.Errorf("unsupported serialization of nil %T", v) 4298 } 4299 4300 return nil 4301} 4302 4303func awsRestxml_serializeOpDocumentXmlTimestampsInput(v *XmlTimestampsInput, value smithyxml.Value) error { 4304 defer value.Close() 4305 if v.DateTime != nil { 4306 rootAttr := []smithyxml.Attr{} 4307 root := smithyxml.StartElement{ 4308 Name: smithyxml.Name{ 4309 Local: "dateTime", 4310 }, 4311 Attr: rootAttr, 4312 } 4313 el := value.MemberElement(root) 4314 el.String(smithytime.FormatDateTime(*v.DateTime)) 4315 } 4316 if v.EpochSeconds != nil { 4317 rootAttr := []smithyxml.Attr{} 4318 root := smithyxml.StartElement{ 4319 Name: smithyxml.Name{ 4320 Local: "epochSeconds", 4321 }, 4322 Attr: rootAttr, 4323 } 4324 el := value.MemberElement(root) 4325 el.Double(smithytime.FormatEpochSeconds(*v.EpochSeconds)) 4326 } 4327 if v.HttpDate != nil { 4328 rootAttr := []smithyxml.Attr{} 4329 root := smithyxml.StartElement{ 4330 Name: smithyxml.Name{ 4331 Local: "httpDate", 4332 }, 4333 Attr: rootAttr, 4334 } 4335 el := value.MemberElement(root) 4336 el.String(smithytime.FormatHTTPDate(*v.HttpDate)) 4337 } 4338 if v.Normal != nil { 4339 rootAttr := []smithyxml.Attr{} 4340 root := smithyxml.StartElement{ 4341 Name: smithyxml.Name{ 4342 Local: "normal", 4343 }, 4344 Attr: rootAttr, 4345 } 4346 el := value.MemberElement(root) 4347 el.String(smithytime.FormatDateTime(*v.Normal)) 4348 } 4349 return nil 4350} 4351 4352type awsRestxml_serializeOpXmlUnions struct { 4353} 4354 4355func (*awsRestxml_serializeOpXmlUnions) ID() string { 4356 return "OperationSerializer" 4357} 4358 4359func (m *awsRestxml_serializeOpXmlUnions) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 4360 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 4361) { 4362 request, ok := in.Request.(*smithyhttp.Request) 4363 if !ok { 4364 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 4365 } 4366 4367 input, ok := in.Parameters.(*XmlUnionsInput) 4368 _ = input 4369 if !ok { 4370 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 4371 } 4372 4373 opPath, opQuery := httpbinding.SplitURI("/XmlUnions") 4374 request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) 4375 request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) 4376 request.Method = "PUT" 4377 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 4378 if err != nil { 4379 return out, metadata, &smithy.SerializationError{Err: err} 4380 } 4381 4382 restEncoder.SetHeader("Content-Type").String("application/xml") 4383 4384 xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) 4385 rootAttr := []smithyxml.Attr{} 4386 root := smithyxml.StartElement{ 4387 Name: smithyxml.Name{ 4388 Local: "XmlUnionsInputOutput", 4389 }, 4390 Attr: rootAttr, 4391 } 4392 if err := awsRestxml_serializeOpDocumentXmlUnionsInput(input, xmlEncoder.RootElement(root)); err != nil { 4393 return out, metadata, &smithy.SerializationError{Err: err} 4394 } 4395 if request, err = request.SetStream(bytes.NewReader(xmlEncoder.Bytes())); err != nil { 4396 return out, metadata, &smithy.SerializationError{Err: err} 4397 } 4398 4399 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 4400 return out, metadata, &smithy.SerializationError{Err: err} 4401 } 4402 in.Request = request 4403 4404 return next.HandleSerialize(ctx, in) 4405} 4406func awsRestxml_serializeOpHttpBindingsXmlUnionsInput(v *XmlUnionsInput, encoder *httpbinding.Encoder) error { 4407 if v == nil { 4408 return fmt.Errorf("unsupported serialization of nil %T", v) 4409 } 4410 4411 return nil 4412} 4413 4414func awsRestxml_serializeOpDocumentXmlUnionsInput(v *XmlUnionsInput, value smithyxml.Value) error { 4415 defer value.Close() 4416 if v.UnionValue != nil { 4417 rootAttr := []smithyxml.Attr{} 4418 root := smithyxml.StartElement{ 4419 Name: smithyxml.Name{ 4420 Local: "unionValue", 4421 }, 4422 Attr: rootAttr, 4423 } 4424 el := value.MemberElement(root) 4425 if err := awsRestxml_serializeDocumentXmlUnionShape(v.UnionValue, el); err != nil { 4426 return err 4427 } 4428 } 4429 return nil 4430} 4431 4432func awsRestxml_serializeDocumentFlattenedXmlMapWithXmlNameInputOutputMap(v map[string]string, value smithyxml.Value) error { 4433 if !value.IsFlattened() { 4434 defer value.Close() 4435 } 4436 m := value.Map() 4437 for key := range v { 4438 entry := m.Entry() 4439 keyElementAttr := []smithyxml.Attr{} 4440 keyElement := smithyxml.StartElement{ 4441 Name: smithyxml.Name{ 4442 Local: "K", 4443 }, 4444 Attr: keyElementAttr, 4445 } 4446 entry.MemberElement(keyElement).String(key) 4447 valueElementAttr := []smithyxml.Attr{} 4448 valueElement := smithyxml.StartElement{ 4449 Name: smithyxml.Name{ 4450 Local: "V", 4451 }, 4452 Attr: valueElementAttr, 4453 } 4454 entry.MemberElement(valueElement).String(v[key]) 4455 entry.Close() 4456 } 4457 return nil 4458} 4459 4460func awsRestxml_serializeDocumentListWithMemberNamespace(v []string, value smithyxml.Value) error { 4461 var array *smithyxml.Array 4462 if !value.IsFlattened() { 4463 defer value.Close() 4464 } 4465 customMemberNameAttr := []smithyxml.Attr{} 4466 customMemberNameAttr = append(customMemberNameAttr, smithyxml.NewNamespaceAttribute("", "https://xml-member.example.com")) 4467 customMemberName := smithyxml.StartElement{ 4468 Name: smithyxml.Name{ 4469 Local: "member", 4470 }, 4471 Attr: customMemberNameAttr, 4472 } 4473 array = value.ArrayWithCustomName(customMemberName) 4474 for i := range v { 4475 am := array.Member() 4476 am.String(v[i]) 4477 } 4478 return nil 4479} 4480 4481func awsRestxml_serializeDocumentListWithNamespace(v []string, value smithyxml.Value) error { 4482 var array *smithyxml.Array 4483 if !value.IsFlattened() { 4484 defer value.Close() 4485 } 4486 array = value.Array() 4487 for i := range v { 4488 am := array.Member() 4489 am.String(v[i]) 4490 } 4491 return nil 4492} 4493 4494func awsRestxml_serializeDocumentNestedMap(v map[string]map[string]types.FooEnum, value smithyxml.Value) error { 4495 if !value.IsFlattened() { 4496 defer value.Close() 4497 } 4498 m := value.Map() 4499 for key := range v { 4500 entry := m.Entry() 4501 if v[key] == nil { 4502 entry.Close() 4503 continue 4504 } 4505 keyElementAttr := []smithyxml.Attr{} 4506 keyElement := smithyxml.StartElement{ 4507 Name: smithyxml.Name{ 4508 Local: "key", 4509 }, 4510 Attr: keyElementAttr, 4511 } 4512 entry.MemberElement(keyElement).String(key) 4513 valueElementAttr := []smithyxml.Attr{} 4514 valueElement := smithyxml.StartElement{ 4515 Name: smithyxml.Name{ 4516 Local: "value", 4517 }, 4518 Attr: valueElementAttr, 4519 } 4520 if err := awsRestxml_serializeDocumentFooEnumMap(v[key], entry.MemberElement(valueElement)); err != nil { 4521 return err 4522 } 4523 entry.Close() 4524 } 4525 return nil 4526} 4527 4528func awsRestxml_serializeDocumentNestedPayload(v *types.NestedPayload, value smithyxml.Value) error { 4529 defer value.Close() 4530 if v.Greeting != nil { 4531 rootAttr := []smithyxml.Attr{} 4532 root := smithyxml.StartElement{ 4533 Name: smithyxml.Name{ 4534 Local: "greeting", 4535 }, 4536 Attr: rootAttr, 4537 } 4538 el := value.MemberElement(root) 4539 el.String(*v.Greeting) 4540 } 4541 if v.Name != nil { 4542 rootAttr := []smithyxml.Attr{} 4543 root := smithyxml.StartElement{ 4544 Name: smithyxml.Name{ 4545 Local: "name", 4546 }, 4547 Attr: rootAttr, 4548 } 4549 el := value.MemberElement(root) 4550 el.String(*v.Name) 4551 } 4552 return nil 4553} 4554 4555func awsRestxml_serializeDocumentPayloadWithXmlName(v *types.PayloadWithXmlName, value smithyxml.Value) error { 4556 defer value.Close() 4557 if v.Name != nil { 4558 rootAttr := []smithyxml.Attr{} 4559 root := smithyxml.StartElement{ 4560 Name: smithyxml.Name{ 4561 Local: "name", 4562 }, 4563 Attr: rootAttr, 4564 } 4565 el := value.MemberElement(root) 4566 el.String(*v.Name) 4567 } 4568 return nil 4569} 4570 4571func awsRestxml_serializeDocumentPayloadWithXmlNamespace(v *types.PayloadWithXmlNamespace, value smithyxml.Value) error { 4572 defer value.Close() 4573 if v.Name != nil { 4574 rootAttr := []smithyxml.Attr{} 4575 root := smithyxml.StartElement{ 4576 Name: smithyxml.Name{ 4577 Local: "name", 4578 }, 4579 Attr: rootAttr, 4580 } 4581 el := value.MemberElement(root) 4582 el.String(*v.Name) 4583 } 4584 return nil 4585} 4586 4587func awsRestxml_serializeDocumentPayloadWithXmlNamespaceAndPrefix(v *types.PayloadWithXmlNamespaceAndPrefix, value smithyxml.Value) error { 4588 defer value.Close() 4589 if v.Name != nil { 4590 rootAttr := []smithyxml.Attr{} 4591 root := smithyxml.StartElement{ 4592 Name: smithyxml.Name{ 4593 Local: "name", 4594 }, 4595 Attr: rootAttr, 4596 } 4597 el := value.MemberElement(root) 4598 el.String(*v.Name) 4599 } 4600 return nil 4601} 4602 4603func awsRestxml_serializeDocumentRecursiveShapesInputOutputNested1(v *types.RecursiveShapesInputOutputNested1, value smithyxml.Value) error { 4604 defer value.Close() 4605 if v.Foo != nil { 4606 rootAttr := []smithyxml.Attr{} 4607 root := smithyxml.StartElement{ 4608 Name: smithyxml.Name{ 4609 Local: "foo", 4610 }, 4611 Attr: rootAttr, 4612 } 4613 el := value.MemberElement(root) 4614 el.String(*v.Foo) 4615 } 4616 if v.Nested != nil { 4617 rootAttr := []smithyxml.Attr{} 4618 root := smithyxml.StartElement{ 4619 Name: smithyxml.Name{ 4620 Local: "nested", 4621 }, 4622 Attr: rootAttr, 4623 } 4624 el := value.MemberElement(root) 4625 if err := awsRestxml_serializeDocumentRecursiveShapesInputOutputNested2(v.Nested, el); err != nil { 4626 return err 4627 } 4628 } 4629 return nil 4630} 4631 4632func awsRestxml_serializeDocumentRecursiveShapesInputOutputNested2(v *types.RecursiveShapesInputOutputNested2, value smithyxml.Value) error { 4633 defer value.Close() 4634 if v.Bar != nil { 4635 rootAttr := []smithyxml.Attr{} 4636 root := smithyxml.StartElement{ 4637 Name: smithyxml.Name{ 4638 Local: "bar", 4639 }, 4640 Attr: rootAttr, 4641 } 4642 el := value.MemberElement(root) 4643 el.String(*v.Bar) 4644 } 4645 if v.RecursiveMember != nil { 4646 rootAttr := []smithyxml.Attr{} 4647 root := smithyxml.StartElement{ 4648 Name: smithyxml.Name{ 4649 Local: "recursiveMember", 4650 }, 4651 Attr: rootAttr, 4652 } 4653 el := value.MemberElement(root) 4654 if err := awsRestxml_serializeDocumentRecursiveShapesInputOutputNested1(v.RecursiveMember, el); err != nil { 4655 return err 4656 } 4657 } 4658 return nil 4659} 4660 4661func awsRestxml_serializeDocumentRenamedListMembers(v []string, value smithyxml.Value) error { 4662 var array *smithyxml.Array 4663 if !value.IsFlattened() { 4664 defer value.Close() 4665 } 4666 customMemberNameAttr := []smithyxml.Attr{} 4667 customMemberName := smithyxml.StartElement{ 4668 Name: smithyxml.Name{ 4669 Local: "item", 4670 }, 4671 Attr: customMemberNameAttr, 4672 } 4673 array = value.ArrayWithCustomName(customMemberName) 4674 for i := range v { 4675 am := array.Member() 4676 am.String(v[i]) 4677 } 4678 return nil 4679} 4680 4681func awsRestxml_serializeDocumentStructureList(v []types.StructureListMember, value smithyxml.Value) error { 4682 var array *smithyxml.Array 4683 if !value.IsFlattened() { 4684 defer value.Close() 4685 } 4686 customMemberNameAttr := []smithyxml.Attr{} 4687 customMemberName := smithyxml.StartElement{ 4688 Name: smithyxml.Name{ 4689 Local: "item", 4690 }, 4691 Attr: customMemberNameAttr, 4692 } 4693 array = value.ArrayWithCustomName(customMemberName) 4694 for i := range v { 4695 am := array.Member() 4696 if err := awsRestxml_serializeDocumentStructureListMember(&v[i], am); err != nil { 4697 return err 4698 } 4699 } 4700 return nil 4701} 4702 4703func awsRestxml_serializeDocumentStructureListMember(v *types.StructureListMember, value smithyxml.Value) error { 4704 defer value.Close() 4705 if v.A != nil { 4706 rootAttr := []smithyxml.Attr{} 4707 root := smithyxml.StartElement{ 4708 Name: smithyxml.Name{ 4709 Local: "value", 4710 }, 4711 Attr: rootAttr, 4712 } 4713 el := value.MemberElement(root) 4714 el.String(*v.A) 4715 } 4716 if v.B != nil { 4717 rootAttr := []smithyxml.Attr{} 4718 root := smithyxml.StartElement{ 4719 Name: smithyxml.Name{ 4720 Local: "other", 4721 }, 4722 Attr: rootAttr, 4723 } 4724 el := value.MemberElement(root) 4725 el.String(*v.B) 4726 } 4727 return nil 4728} 4729 4730func awsRestxml_serializeDocumentXmlAttributesInputOutput(v *types.XmlAttributesInputOutput, value smithyxml.Value) error { 4731 defer value.Close() 4732 if v.Foo != nil { 4733 rootAttr := []smithyxml.Attr{} 4734 root := smithyxml.StartElement{ 4735 Name: smithyxml.Name{ 4736 Local: "foo", 4737 }, 4738 Attr: rootAttr, 4739 } 4740 el := value.MemberElement(root) 4741 el.String(*v.Foo) 4742 } 4743 return nil 4744} 4745 4746func awsRestxml_serializeDocumentXmlMapsInputOutputMap(v map[string]types.GreetingStruct, value smithyxml.Value) error { 4747 if !value.IsFlattened() { 4748 defer value.Close() 4749 } 4750 m := value.Map() 4751 for key := range v { 4752 entry := m.Entry() 4753 keyElementAttr := []smithyxml.Attr{} 4754 keyElement := smithyxml.StartElement{ 4755 Name: smithyxml.Name{ 4756 Local: "key", 4757 }, 4758 Attr: keyElementAttr, 4759 } 4760 entry.MemberElement(keyElement).String(key) 4761 valueElementAttr := []smithyxml.Attr{} 4762 valueElement := smithyxml.StartElement{ 4763 Name: smithyxml.Name{ 4764 Local: "value", 4765 }, 4766 Attr: valueElementAttr, 4767 } 4768 mapVar := v[key] 4769 if err := awsRestxml_serializeDocumentGreetingStruct(&mapVar, entry.MemberElement(valueElement)); err != nil { 4770 return err 4771 } 4772 entry.Close() 4773 } 4774 return nil 4775} 4776 4777func awsRestxml_serializeDocumentXmlMapsXmlNameInputOutputMap(v map[string]types.GreetingStruct, value smithyxml.Value) error { 4778 if !value.IsFlattened() { 4779 defer value.Close() 4780 } 4781 m := value.Map() 4782 for key := range v { 4783 entry := m.Entry() 4784 keyElementAttr := []smithyxml.Attr{} 4785 keyElement := smithyxml.StartElement{ 4786 Name: smithyxml.Name{ 4787 Local: "Attribute", 4788 }, 4789 Attr: keyElementAttr, 4790 } 4791 entry.MemberElement(keyElement).String(key) 4792 valueElementAttr := []smithyxml.Attr{} 4793 valueElement := smithyxml.StartElement{ 4794 Name: smithyxml.Name{ 4795 Local: "Setting", 4796 }, 4797 Attr: valueElementAttr, 4798 } 4799 mapVar := v[key] 4800 if err := awsRestxml_serializeDocumentGreetingStruct(&mapVar, entry.MemberElement(valueElement)); err != nil { 4801 return err 4802 } 4803 entry.Close() 4804 } 4805 return nil 4806} 4807 4808func awsRestxml_serializeDocumentXmlNamespacedList(v []string, value smithyxml.Value) error { 4809 var array *smithyxml.Array 4810 if !value.IsFlattened() { 4811 defer value.Close() 4812 } 4813 customMemberNameAttr := []smithyxml.Attr{} 4814 customMemberNameAttr = append(customMemberNameAttr, smithyxml.NewNamespaceAttribute("", "http://bux.com")) 4815 customMemberName := smithyxml.StartElement{ 4816 Name: smithyxml.Name{ 4817 Local: "member", 4818 }, 4819 Attr: customMemberNameAttr, 4820 } 4821 array = value.ArrayWithCustomName(customMemberName) 4822 for i := range v { 4823 am := array.Member() 4824 am.String(v[i]) 4825 } 4826 return nil 4827} 4828 4829func awsRestxml_serializeDocumentXmlNamespaceNested(v *types.XmlNamespaceNested, value smithyxml.Value) error { 4830 defer value.Close() 4831 if v.Foo != nil { 4832 rootAttr := []smithyxml.Attr{} 4833 rootAttr = append(rootAttr, smithyxml.NewNamespaceAttribute("baz", "http://baz.com")) 4834 root := smithyxml.StartElement{ 4835 Name: smithyxml.Name{ 4836 Local: "foo", 4837 }, 4838 Attr: rootAttr, 4839 } 4840 el := value.MemberElement(root) 4841 el.String(*v.Foo) 4842 } 4843 if v.Values != nil { 4844 rootAttr := []smithyxml.Attr{} 4845 rootAttr = append(rootAttr, smithyxml.NewNamespaceAttribute("", "http://qux.com")) 4846 root := smithyxml.StartElement{ 4847 Name: smithyxml.Name{ 4848 Local: "values", 4849 }, 4850 Attr: rootAttr, 4851 } 4852 el := value.MemberElement(root) 4853 if err := awsRestxml_serializeDocumentXmlNamespacedList(v.Values, el); err != nil { 4854 return err 4855 } 4856 } 4857 return nil 4858} 4859 4860func awsRestxml_serializeDocumentXmlNestedUnionStruct(v *types.XmlNestedUnionStruct, value smithyxml.Value) error { 4861 defer value.Close() 4862 if v.BooleanValue != nil { 4863 rootAttr := []smithyxml.Attr{} 4864 root := smithyxml.StartElement{ 4865 Name: smithyxml.Name{ 4866 Local: "booleanValue", 4867 }, 4868 Attr: rootAttr, 4869 } 4870 el := value.MemberElement(root) 4871 el.Boolean(*v.BooleanValue) 4872 } 4873 if v.ByteValue != nil { 4874 rootAttr := []smithyxml.Attr{} 4875 root := smithyxml.StartElement{ 4876 Name: smithyxml.Name{ 4877 Local: "byteValue", 4878 }, 4879 Attr: rootAttr, 4880 } 4881 el := value.MemberElement(root) 4882 el.Byte(*v.ByteValue) 4883 } 4884 if v.DoubleValue != nil { 4885 rootAttr := []smithyxml.Attr{} 4886 root := smithyxml.StartElement{ 4887 Name: smithyxml.Name{ 4888 Local: "doubleValue", 4889 }, 4890 Attr: rootAttr, 4891 } 4892 el := value.MemberElement(root) 4893 switch { 4894 case math.IsNaN(*v.DoubleValue): 4895 el.String("NaN") 4896 4897 case math.IsInf(*v.DoubleValue, 1): 4898 el.String("Infinity") 4899 4900 case math.IsInf(*v.DoubleValue, -1): 4901 el.String("-Infinity") 4902 4903 default: 4904 el.Double(*v.DoubleValue) 4905 4906 } 4907 } 4908 if v.FloatValue != nil { 4909 rootAttr := []smithyxml.Attr{} 4910 root := smithyxml.StartElement{ 4911 Name: smithyxml.Name{ 4912 Local: "floatValue", 4913 }, 4914 Attr: rootAttr, 4915 } 4916 el := value.MemberElement(root) 4917 switch { 4918 case math.IsNaN(float64(*v.FloatValue)): 4919 el.String("NaN") 4920 4921 case math.IsInf(float64(*v.FloatValue), 1): 4922 el.String("Infinity") 4923 4924 case math.IsInf(float64(*v.FloatValue), -1): 4925 el.String("-Infinity") 4926 4927 default: 4928 el.Float(*v.FloatValue) 4929 4930 } 4931 } 4932 if v.IntegerValue != nil { 4933 rootAttr := []smithyxml.Attr{} 4934 root := smithyxml.StartElement{ 4935 Name: smithyxml.Name{ 4936 Local: "integerValue", 4937 }, 4938 Attr: rootAttr, 4939 } 4940 el := value.MemberElement(root) 4941 el.Integer(*v.IntegerValue) 4942 } 4943 if v.LongValue != nil { 4944 rootAttr := []smithyxml.Attr{} 4945 root := smithyxml.StartElement{ 4946 Name: smithyxml.Name{ 4947 Local: "longValue", 4948 }, 4949 Attr: rootAttr, 4950 } 4951 el := value.MemberElement(root) 4952 el.Long(*v.LongValue) 4953 } 4954 if v.ShortValue != nil { 4955 rootAttr := []smithyxml.Attr{} 4956 root := smithyxml.StartElement{ 4957 Name: smithyxml.Name{ 4958 Local: "shortValue", 4959 }, 4960 Attr: rootAttr, 4961 } 4962 el := value.MemberElement(root) 4963 el.Short(*v.ShortValue) 4964 } 4965 if v.StringValue != nil { 4966 rootAttr := []smithyxml.Attr{} 4967 root := smithyxml.StartElement{ 4968 Name: smithyxml.Name{ 4969 Local: "stringValue", 4970 }, 4971 Attr: rootAttr, 4972 } 4973 el := value.MemberElement(root) 4974 el.String(*v.StringValue) 4975 } 4976 return nil 4977} 4978 4979func awsRestxml_serializeDocumentXmlUnionShape(v types.XmlUnionShape, value smithyxml.Value) error { 4980 defer value.Close() 4981 switch uv := v.(type) { 4982 case *types.XmlUnionShapeMemberBooleanValue: 4983 customMemberNameAttr := []smithyxml.Attr{} 4984 customMemberName := smithyxml.StartElement{ 4985 Name: smithyxml.Name{ 4986 Local: "booleanValue", 4987 }, 4988 Attr: customMemberNameAttr, 4989 } 4990 av := value.MemberElement(customMemberName) 4991 av.Boolean(uv.Value) 4992 4993 case *types.XmlUnionShapeMemberByteValue: 4994 customMemberNameAttr := []smithyxml.Attr{} 4995 customMemberName := smithyxml.StartElement{ 4996 Name: smithyxml.Name{ 4997 Local: "byteValue", 4998 }, 4999 Attr: customMemberNameAttr, 5000 } 5001 av := value.MemberElement(customMemberName) 5002 av.Byte(uv.Value) 5003 5004 case *types.XmlUnionShapeMemberDoubleValue: 5005 customMemberNameAttr := []smithyxml.Attr{} 5006 customMemberName := smithyxml.StartElement{ 5007 Name: smithyxml.Name{ 5008 Local: "doubleValue", 5009 }, 5010 Attr: customMemberNameAttr, 5011 } 5012 av := value.MemberElement(customMemberName) 5013 switch { 5014 case math.IsNaN(uv.Value): 5015 av.String("NaN") 5016 5017 case math.IsInf(uv.Value, 1): 5018 av.String("Infinity") 5019 5020 case math.IsInf(uv.Value, -1): 5021 av.String("-Infinity") 5022 5023 default: 5024 av.Double(uv.Value) 5025 5026 } 5027 5028 case *types.XmlUnionShapeMemberFloatValue: 5029 customMemberNameAttr := []smithyxml.Attr{} 5030 customMemberName := smithyxml.StartElement{ 5031 Name: smithyxml.Name{ 5032 Local: "floatValue", 5033 }, 5034 Attr: customMemberNameAttr, 5035 } 5036 av := value.MemberElement(customMemberName) 5037 switch { 5038 case math.IsNaN(float64(uv.Value)): 5039 av.String("NaN") 5040 5041 case math.IsInf(float64(uv.Value), 1): 5042 av.String("Infinity") 5043 5044 case math.IsInf(float64(uv.Value), -1): 5045 av.String("-Infinity") 5046 5047 default: 5048 av.Float(uv.Value) 5049 5050 } 5051 5052 case *types.XmlUnionShapeMemberIntegerValue: 5053 customMemberNameAttr := []smithyxml.Attr{} 5054 customMemberName := smithyxml.StartElement{ 5055 Name: smithyxml.Name{ 5056 Local: "integerValue", 5057 }, 5058 Attr: customMemberNameAttr, 5059 } 5060 av := value.MemberElement(customMemberName) 5061 av.Integer(uv.Value) 5062 5063 case *types.XmlUnionShapeMemberLongValue: 5064 customMemberNameAttr := []smithyxml.Attr{} 5065 customMemberName := smithyxml.StartElement{ 5066 Name: smithyxml.Name{ 5067 Local: "longValue", 5068 }, 5069 Attr: customMemberNameAttr, 5070 } 5071 av := value.MemberElement(customMemberName) 5072 av.Long(uv.Value) 5073 5074 case *types.XmlUnionShapeMemberShortValue: 5075 customMemberNameAttr := []smithyxml.Attr{} 5076 customMemberName := smithyxml.StartElement{ 5077 Name: smithyxml.Name{ 5078 Local: "shortValue", 5079 }, 5080 Attr: customMemberNameAttr, 5081 } 5082 av := value.MemberElement(customMemberName) 5083 av.Short(uv.Value) 5084 5085 case *types.XmlUnionShapeMemberStringValue: 5086 customMemberNameAttr := []smithyxml.Attr{} 5087 customMemberName := smithyxml.StartElement{ 5088 Name: smithyxml.Name{ 5089 Local: "stringValue", 5090 }, 5091 Attr: customMemberNameAttr, 5092 } 5093 av := value.MemberElement(customMemberName) 5094 av.String(uv.Value) 5095 5096 case *types.XmlUnionShapeMemberStructValue: 5097 customMemberNameAttr := []smithyxml.Attr{} 5098 customMemberName := smithyxml.StartElement{ 5099 Name: smithyxml.Name{ 5100 Local: "structValue", 5101 }, 5102 Attr: customMemberNameAttr, 5103 } 5104 av := value.MemberElement(customMemberName) 5105 if err := awsRestxml_serializeDocumentXmlNestedUnionStruct(&uv.Value, av); err != nil { 5106 return err 5107 } 5108 5109 case *types.XmlUnionShapeMemberUnionValue: 5110 customMemberNameAttr := []smithyxml.Attr{} 5111 customMemberName := smithyxml.StartElement{ 5112 Name: smithyxml.Name{ 5113 Local: "unionValue", 5114 }, 5115 Attr: customMemberNameAttr, 5116 } 5117 av := value.MemberElement(customMemberName) 5118 if err := awsRestxml_serializeDocumentXmlUnionShape(uv.Value, av); err != nil { 5119 return err 5120 } 5121 5122 default: 5123 return fmt.Errorf("attempted to serialize unknown member type %T for union %T", uv, v) 5124 5125 } 5126 return nil 5127} 5128 5129func awsRestxml_serializeDocumentBooleanList(v []bool, value smithyxml.Value) error { 5130 var array *smithyxml.Array 5131 if !value.IsFlattened() { 5132 defer value.Close() 5133 } 5134 array = value.Array() 5135 for i := range v { 5136 am := array.Member() 5137 am.Boolean(v[i]) 5138 } 5139 return nil 5140} 5141 5142func awsRestxml_serializeDocumentFooEnumList(v []types.FooEnum, value smithyxml.Value) error { 5143 var array *smithyxml.Array 5144 if !value.IsFlattened() { 5145 defer value.Close() 5146 } 5147 array = value.Array() 5148 for i := range v { 5149 am := array.Member() 5150 am.String(string(v[i])) 5151 } 5152 return nil 5153} 5154 5155func awsRestxml_serializeDocumentFooEnumMap(v map[string]types.FooEnum, value smithyxml.Value) error { 5156 if !value.IsFlattened() { 5157 defer value.Close() 5158 } 5159 m := value.Map() 5160 for key := range v { 5161 entry := m.Entry() 5162 keyElementAttr := []smithyxml.Attr{} 5163 keyElement := smithyxml.StartElement{ 5164 Name: smithyxml.Name{ 5165 Local: "key", 5166 }, 5167 Attr: keyElementAttr, 5168 } 5169 entry.MemberElement(keyElement).String(key) 5170 valueElementAttr := []smithyxml.Attr{} 5171 valueElement := smithyxml.StartElement{ 5172 Name: smithyxml.Name{ 5173 Local: "value", 5174 }, 5175 Attr: valueElementAttr, 5176 } 5177 entry.MemberElement(valueElement).String(string(v[key])) 5178 entry.Close() 5179 } 5180 return nil 5181} 5182 5183func awsRestxml_serializeDocumentFooEnumSet(v []types.FooEnum, value smithyxml.Value) error { 5184 var array *smithyxml.Array 5185 if !value.IsFlattened() { 5186 defer value.Close() 5187 } 5188 array = value.Array() 5189 for i := range v { 5190 am := array.Member() 5191 am.String(string(v[i])) 5192 } 5193 return nil 5194} 5195 5196func awsRestxml_serializeDocumentGreetingStruct(v *types.GreetingStruct, value smithyxml.Value) error { 5197 defer value.Close() 5198 if v.Hi != nil { 5199 rootAttr := []smithyxml.Attr{} 5200 root := smithyxml.StartElement{ 5201 Name: smithyxml.Name{ 5202 Local: "hi", 5203 }, 5204 Attr: rootAttr, 5205 } 5206 el := value.MemberElement(root) 5207 el.String(*v.Hi) 5208 } 5209 return nil 5210} 5211 5212func awsRestxml_serializeDocumentIntegerList(v []int32, value smithyxml.Value) error { 5213 var array *smithyxml.Array 5214 if !value.IsFlattened() { 5215 defer value.Close() 5216 } 5217 array = value.Array() 5218 for i := range v { 5219 am := array.Member() 5220 am.Integer(v[i]) 5221 } 5222 return nil 5223} 5224 5225func awsRestxml_serializeDocumentNestedStringList(v [][]string, value smithyxml.Value) error { 5226 var array *smithyxml.Array 5227 if !value.IsFlattened() { 5228 defer value.Close() 5229 } 5230 array = value.Array() 5231 for i := range v { 5232 if v[i] == nil { 5233 am := array.Member() 5234 am.Close() 5235 continue 5236 } 5237 am := array.Member() 5238 if err := awsRestxml_serializeDocumentStringList(v[i], am); err != nil { 5239 return err 5240 } 5241 } 5242 return nil 5243} 5244 5245func awsRestxml_serializeDocumentStringList(v []string, value smithyxml.Value) error { 5246 var array *smithyxml.Array 5247 if !value.IsFlattened() { 5248 defer value.Close() 5249 } 5250 array = value.Array() 5251 for i := range v { 5252 am := array.Member() 5253 am.String(v[i]) 5254 } 5255 return nil 5256} 5257 5258func awsRestxml_serializeDocumentStringSet(v []string, value smithyxml.Value) error { 5259 var array *smithyxml.Array 5260 if !value.IsFlattened() { 5261 defer value.Close() 5262 } 5263 array = value.Array() 5264 for i := range v { 5265 am := array.Member() 5266 am.String(v[i]) 5267 } 5268 return nil 5269} 5270 5271func awsRestxml_serializeDocumentTimestampList(v []time.Time, value smithyxml.Value) error { 5272 var array *smithyxml.Array 5273 if !value.IsFlattened() { 5274 defer value.Close() 5275 } 5276 array = value.Array() 5277 for i := range v { 5278 am := array.Member() 5279 am.String(smithytime.FormatDateTime(v[i])) 5280 } 5281 return nil 5282} 5283