1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package cognitosync 4 5import ( 6 "bytes" 7 "context" 8 "fmt" 9 "github.com/aws/aws-sdk-go-v2/service/cognitosync/types" 10 smithy "github.com/aws/smithy-go" 11 "github.com/aws/smithy-go/encoding/httpbinding" 12 smithyjson "github.com/aws/smithy-go/encoding/json" 13 "github.com/aws/smithy-go/middleware" 14 smithytime "github.com/aws/smithy-go/time" 15 smithyhttp "github.com/aws/smithy-go/transport/http" 16) 17 18type awsRestjson1_serializeOpBulkPublish struct { 19} 20 21func (*awsRestjson1_serializeOpBulkPublish) ID() string { 22 return "OperationSerializer" 23} 24 25func (m *awsRestjson1_serializeOpBulkPublish) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 26 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 27) { 28 request, ok := in.Request.(*smithyhttp.Request) 29 if !ok { 30 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 31 } 32 33 input, ok := in.Parameters.(*BulkPublishInput) 34 _ = input 35 if !ok { 36 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 37 } 38 39 opPath, opQuery := httpbinding.SplitURI("/identitypools/{IdentityPoolId}/bulkpublish") 40 request.URL.Path = opPath 41 if len(request.URL.RawQuery) > 0 { 42 request.URL.RawQuery = "&" + opQuery 43 } else { 44 request.URL.RawQuery = opQuery 45 } 46 47 request.Method = "POST" 48 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 49 if err != nil { 50 return out, metadata, &smithy.SerializationError{Err: err} 51 } 52 53 if err := awsRestjson1_serializeOpHttpBindingsBulkPublishInput(input, restEncoder); err != nil { 54 return out, metadata, &smithy.SerializationError{Err: err} 55 } 56 57 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 58 return out, metadata, &smithy.SerializationError{Err: err} 59 } 60 in.Request = request 61 62 return next.HandleSerialize(ctx, in) 63} 64func awsRestjson1_serializeOpHttpBindingsBulkPublishInput(v *BulkPublishInput, encoder *httpbinding.Encoder) error { 65 if v == nil { 66 return fmt.Errorf("unsupported serialization of nil %T", v) 67 } 68 69 if v.IdentityPoolId == nil || len(*v.IdentityPoolId) == 0 { 70 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityPoolId must not be empty")} 71 } 72 if v.IdentityPoolId != nil { 73 if err := encoder.SetURI("IdentityPoolId").String(*v.IdentityPoolId); err != nil { 74 return err 75 } 76 } 77 78 return nil 79} 80 81type awsRestjson1_serializeOpDeleteDataset struct { 82} 83 84func (*awsRestjson1_serializeOpDeleteDataset) ID() string { 85 return "OperationSerializer" 86} 87 88func (m *awsRestjson1_serializeOpDeleteDataset) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 89 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 90) { 91 request, ok := in.Request.(*smithyhttp.Request) 92 if !ok { 93 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 94 } 95 96 input, ok := in.Parameters.(*DeleteDatasetInput) 97 _ = input 98 if !ok { 99 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 100 } 101 102 opPath, opQuery := httpbinding.SplitURI("/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}") 103 request.URL.Path = opPath 104 if len(request.URL.RawQuery) > 0 { 105 request.URL.RawQuery = "&" + opQuery 106 } else { 107 request.URL.RawQuery = opQuery 108 } 109 110 request.Method = "DELETE" 111 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 112 if err != nil { 113 return out, metadata, &smithy.SerializationError{Err: err} 114 } 115 116 if err := awsRestjson1_serializeOpHttpBindingsDeleteDatasetInput(input, restEncoder); err != nil { 117 return out, metadata, &smithy.SerializationError{Err: err} 118 } 119 120 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 121 return out, metadata, &smithy.SerializationError{Err: err} 122 } 123 in.Request = request 124 125 return next.HandleSerialize(ctx, in) 126} 127func awsRestjson1_serializeOpHttpBindingsDeleteDatasetInput(v *DeleteDatasetInput, encoder *httpbinding.Encoder) error { 128 if v == nil { 129 return fmt.Errorf("unsupported serialization of nil %T", v) 130 } 131 132 if v.DatasetName == nil || len(*v.DatasetName) == 0 { 133 return &smithy.SerializationError{Err: fmt.Errorf("input member DatasetName must not be empty")} 134 } 135 if v.DatasetName != nil { 136 if err := encoder.SetURI("DatasetName").String(*v.DatasetName); err != nil { 137 return err 138 } 139 } 140 141 if v.IdentityId == nil || len(*v.IdentityId) == 0 { 142 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityId must not be empty")} 143 } 144 if v.IdentityId != nil { 145 if err := encoder.SetURI("IdentityId").String(*v.IdentityId); err != nil { 146 return err 147 } 148 } 149 150 if v.IdentityPoolId == nil || len(*v.IdentityPoolId) == 0 { 151 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityPoolId must not be empty")} 152 } 153 if v.IdentityPoolId != nil { 154 if err := encoder.SetURI("IdentityPoolId").String(*v.IdentityPoolId); err != nil { 155 return err 156 } 157 } 158 159 return nil 160} 161 162type awsRestjson1_serializeOpDescribeDataset struct { 163} 164 165func (*awsRestjson1_serializeOpDescribeDataset) ID() string { 166 return "OperationSerializer" 167} 168 169func (m *awsRestjson1_serializeOpDescribeDataset) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 170 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 171) { 172 request, ok := in.Request.(*smithyhttp.Request) 173 if !ok { 174 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 175 } 176 177 input, ok := in.Parameters.(*DescribeDatasetInput) 178 _ = input 179 if !ok { 180 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 181 } 182 183 opPath, opQuery := httpbinding.SplitURI("/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}") 184 request.URL.Path = opPath 185 if len(request.URL.RawQuery) > 0 { 186 request.URL.RawQuery = "&" + opQuery 187 } else { 188 request.URL.RawQuery = opQuery 189 } 190 191 request.Method = "GET" 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 if err := awsRestjson1_serializeOpHttpBindingsDescribeDatasetInput(input, restEncoder); err != nil { 198 return out, metadata, &smithy.SerializationError{Err: err} 199 } 200 201 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 202 return out, metadata, &smithy.SerializationError{Err: err} 203 } 204 in.Request = request 205 206 return next.HandleSerialize(ctx, in) 207} 208func awsRestjson1_serializeOpHttpBindingsDescribeDatasetInput(v *DescribeDatasetInput, encoder *httpbinding.Encoder) error { 209 if v == nil { 210 return fmt.Errorf("unsupported serialization of nil %T", v) 211 } 212 213 if v.DatasetName == nil || len(*v.DatasetName) == 0 { 214 return &smithy.SerializationError{Err: fmt.Errorf("input member DatasetName must not be empty")} 215 } 216 if v.DatasetName != nil { 217 if err := encoder.SetURI("DatasetName").String(*v.DatasetName); err != nil { 218 return err 219 } 220 } 221 222 if v.IdentityId == nil || len(*v.IdentityId) == 0 { 223 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityId must not be empty")} 224 } 225 if v.IdentityId != nil { 226 if err := encoder.SetURI("IdentityId").String(*v.IdentityId); err != nil { 227 return err 228 } 229 } 230 231 if v.IdentityPoolId == nil || len(*v.IdentityPoolId) == 0 { 232 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityPoolId must not be empty")} 233 } 234 if v.IdentityPoolId != nil { 235 if err := encoder.SetURI("IdentityPoolId").String(*v.IdentityPoolId); err != nil { 236 return err 237 } 238 } 239 240 return nil 241} 242 243type awsRestjson1_serializeOpDescribeIdentityPoolUsage struct { 244} 245 246func (*awsRestjson1_serializeOpDescribeIdentityPoolUsage) ID() string { 247 return "OperationSerializer" 248} 249 250func (m *awsRestjson1_serializeOpDescribeIdentityPoolUsage) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 251 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 252) { 253 request, ok := in.Request.(*smithyhttp.Request) 254 if !ok { 255 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 256 } 257 258 input, ok := in.Parameters.(*DescribeIdentityPoolUsageInput) 259 _ = input 260 if !ok { 261 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 262 } 263 264 opPath, opQuery := httpbinding.SplitURI("/identitypools/{IdentityPoolId}") 265 request.URL.Path = opPath 266 if len(request.URL.RawQuery) > 0 { 267 request.URL.RawQuery = "&" + opQuery 268 } else { 269 request.URL.RawQuery = opQuery 270 } 271 272 request.Method = "GET" 273 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 274 if err != nil { 275 return out, metadata, &smithy.SerializationError{Err: err} 276 } 277 278 if err := awsRestjson1_serializeOpHttpBindingsDescribeIdentityPoolUsageInput(input, restEncoder); err != nil { 279 return out, metadata, &smithy.SerializationError{Err: err} 280 } 281 282 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 283 return out, metadata, &smithy.SerializationError{Err: err} 284 } 285 in.Request = request 286 287 return next.HandleSerialize(ctx, in) 288} 289func awsRestjson1_serializeOpHttpBindingsDescribeIdentityPoolUsageInput(v *DescribeIdentityPoolUsageInput, encoder *httpbinding.Encoder) error { 290 if v == nil { 291 return fmt.Errorf("unsupported serialization of nil %T", v) 292 } 293 294 if v.IdentityPoolId == nil || len(*v.IdentityPoolId) == 0 { 295 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityPoolId must not be empty")} 296 } 297 if v.IdentityPoolId != nil { 298 if err := encoder.SetURI("IdentityPoolId").String(*v.IdentityPoolId); err != nil { 299 return err 300 } 301 } 302 303 return nil 304} 305 306type awsRestjson1_serializeOpDescribeIdentityUsage struct { 307} 308 309func (*awsRestjson1_serializeOpDescribeIdentityUsage) ID() string { 310 return "OperationSerializer" 311} 312 313func (m *awsRestjson1_serializeOpDescribeIdentityUsage) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 314 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 315) { 316 request, ok := in.Request.(*smithyhttp.Request) 317 if !ok { 318 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 319 } 320 321 input, ok := in.Parameters.(*DescribeIdentityUsageInput) 322 _ = input 323 if !ok { 324 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 325 } 326 327 opPath, opQuery := httpbinding.SplitURI("/identitypools/{IdentityPoolId}/identities/{IdentityId}") 328 request.URL.Path = opPath 329 if len(request.URL.RawQuery) > 0 { 330 request.URL.RawQuery = "&" + opQuery 331 } else { 332 request.URL.RawQuery = opQuery 333 } 334 335 request.Method = "GET" 336 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 337 if err != nil { 338 return out, metadata, &smithy.SerializationError{Err: err} 339 } 340 341 if err := awsRestjson1_serializeOpHttpBindingsDescribeIdentityUsageInput(input, restEncoder); err != nil { 342 return out, metadata, &smithy.SerializationError{Err: err} 343 } 344 345 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 346 return out, metadata, &smithy.SerializationError{Err: err} 347 } 348 in.Request = request 349 350 return next.HandleSerialize(ctx, in) 351} 352func awsRestjson1_serializeOpHttpBindingsDescribeIdentityUsageInput(v *DescribeIdentityUsageInput, encoder *httpbinding.Encoder) error { 353 if v == nil { 354 return fmt.Errorf("unsupported serialization of nil %T", v) 355 } 356 357 if v.IdentityId == nil || len(*v.IdentityId) == 0 { 358 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityId must not be empty")} 359 } 360 if v.IdentityId != nil { 361 if err := encoder.SetURI("IdentityId").String(*v.IdentityId); err != nil { 362 return err 363 } 364 } 365 366 if v.IdentityPoolId == nil || len(*v.IdentityPoolId) == 0 { 367 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityPoolId must not be empty")} 368 } 369 if v.IdentityPoolId != nil { 370 if err := encoder.SetURI("IdentityPoolId").String(*v.IdentityPoolId); err != nil { 371 return err 372 } 373 } 374 375 return nil 376} 377 378type awsRestjson1_serializeOpGetBulkPublishDetails struct { 379} 380 381func (*awsRestjson1_serializeOpGetBulkPublishDetails) ID() string { 382 return "OperationSerializer" 383} 384 385func (m *awsRestjson1_serializeOpGetBulkPublishDetails) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 386 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 387) { 388 request, ok := in.Request.(*smithyhttp.Request) 389 if !ok { 390 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 391 } 392 393 input, ok := in.Parameters.(*GetBulkPublishDetailsInput) 394 _ = input 395 if !ok { 396 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 397 } 398 399 opPath, opQuery := httpbinding.SplitURI("/identitypools/{IdentityPoolId}/getBulkPublishDetails") 400 request.URL.Path = opPath 401 if len(request.URL.RawQuery) > 0 { 402 request.URL.RawQuery = "&" + opQuery 403 } else { 404 request.URL.RawQuery = opQuery 405 } 406 407 request.Method = "POST" 408 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 409 if err != nil { 410 return out, metadata, &smithy.SerializationError{Err: err} 411 } 412 413 if err := awsRestjson1_serializeOpHttpBindingsGetBulkPublishDetailsInput(input, restEncoder); err != nil { 414 return out, metadata, &smithy.SerializationError{Err: err} 415 } 416 417 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 418 return out, metadata, &smithy.SerializationError{Err: err} 419 } 420 in.Request = request 421 422 return next.HandleSerialize(ctx, in) 423} 424func awsRestjson1_serializeOpHttpBindingsGetBulkPublishDetailsInput(v *GetBulkPublishDetailsInput, encoder *httpbinding.Encoder) error { 425 if v == nil { 426 return fmt.Errorf("unsupported serialization of nil %T", v) 427 } 428 429 if v.IdentityPoolId == nil || len(*v.IdentityPoolId) == 0 { 430 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityPoolId must not be empty")} 431 } 432 if v.IdentityPoolId != nil { 433 if err := encoder.SetURI("IdentityPoolId").String(*v.IdentityPoolId); err != nil { 434 return err 435 } 436 } 437 438 return nil 439} 440 441type awsRestjson1_serializeOpGetCognitoEvents struct { 442} 443 444func (*awsRestjson1_serializeOpGetCognitoEvents) ID() string { 445 return "OperationSerializer" 446} 447 448func (m *awsRestjson1_serializeOpGetCognitoEvents) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 449 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 450) { 451 request, ok := in.Request.(*smithyhttp.Request) 452 if !ok { 453 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 454 } 455 456 input, ok := in.Parameters.(*GetCognitoEventsInput) 457 _ = input 458 if !ok { 459 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 460 } 461 462 opPath, opQuery := httpbinding.SplitURI("/identitypools/{IdentityPoolId}/events") 463 request.URL.Path = opPath 464 if len(request.URL.RawQuery) > 0 { 465 request.URL.RawQuery = "&" + opQuery 466 } else { 467 request.URL.RawQuery = opQuery 468 } 469 470 request.Method = "GET" 471 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 472 if err != nil { 473 return out, metadata, &smithy.SerializationError{Err: err} 474 } 475 476 if err := awsRestjson1_serializeOpHttpBindingsGetCognitoEventsInput(input, restEncoder); err != nil { 477 return out, metadata, &smithy.SerializationError{Err: err} 478 } 479 480 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 481 return out, metadata, &smithy.SerializationError{Err: err} 482 } 483 in.Request = request 484 485 return next.HandleSerialize(ctx, in) 486} 487func awsRestjson1_serializeOpHttpBindingsGetCognitoEventsInput(v *GetCognitoEventsInput, encoder *httpbinding.Encoder) error { 488 if v == nil { 489 return fmt.Errorf("unsupported serialization of nil %T", v) 490 } 491 492 if v.IdentityPoolId == nil || len(*v.IdentityPoolId) == 0 { 493 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityPoolId must not be empty")} 494 } 495 if v.IdentityPoolId != nil { 496 if err := encoder.SetURI("IdentityPoolId").String(*v.IdentityPoolId); err != nil { 497 return err 498 } 499 } 500 501 return nil 502} 503 504type awsRestjson1_serializeOpGetIdentityPoolConfiguration struct { 505} 506 507func (*awsRestjson1_serializeOpGetIdentityPoolConfiguration) ID() string { 508 return "OperationSerializer" 509} 510 511func (m *awsRestjson1_serializeOpGetIdentityPoolConfiguration) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 512 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 513) { 514 request, ok := in.Request.(*smithyhttp.Request) 515 if !ok { 516 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 517 } 518 519 input, ok := in.Parameters.(*GetIdentityPoolConfigurationInput) 520 _ = input 521 if !ok { 522 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 523 } 524 525 opPath, opQuery := httpbinding.SplitURI("/identitypools/{IdentityPoolId}/configuration") 526 request.URL.Path = opPath 527 if len(request.URL.RawQuery) > 0 { 528 request.URL.RawQuery = "&" + opQuery 529 } else { 530 request.URL.RawQuery = opQuery 531 } 532 533 request.Method = "GET" 534 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 535 if err != nil { 536 return out, metadata, &smithy.SerializationError{Err: err} 537 } 538 539 if err := awsRestjson1_serializeOpHttpBindingsGetIdentityPoolConfigurationInput(input, restEncoder); err != nil { 540 return out, metadata, &smithy.SerializationError{Err: err} 541 } 542 543 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 544 return out, metadata, &smithy.SerializationError{Err: err} 545 } 546 in.Request = request 547 548 return next.HandleSerialize(ctx, in) 549} 550func awsRestjson1_serializeOpHttpBindingsGetIdentityPoolConfigurationInput(v *GetIdentityPoolConfigurationInput, encoder *httpbinding.Encoder) error { 551 if v == nil { 552 return fmt.Errorf("unsupported serialization of nil %T", v) 553 } 554 555 if v.IdentityPoolId == nil || len(*v.IdentityPoolId) == 0 { 556 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityPoolId must not be empty")} 557 } 558 if v.IdentityPoolId != nil { 559 if err := encoder.SetURI("IdentityPoolId").String(*v.IdentityPoolId); err != nil { 560 return err 561 } 562 } 563 564 return nil 565} 566 567type awsRestjson1_serializeOpListDatasets struct { 568} 569 570func (*awsRestjson1_serializeOpListDatasets) ID() string { 571 return "OperationSerializer" 572} 573 574func (m *awsRestjson1_serializeOpListDatasets) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 575 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 576) { 577 request, ok := in.Request.(*smithyhttp.Request) 578 if !ok { 579 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 580 } 581 582 input, ok := in.Parameters.(*ListDatasetsInput) 583 _ = input 584 if !ok { 585 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 586 } 587 588 opPath, opQuery := httpbinding.SplitURI("/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets") 589 request.URL.Path = opPath 590 if len(request.URL.RawQuery) > 0 { 591 request.URL.RawQuery = "&" + opQuery 592 } else { 593 request.URL.RawQuery = opQuery 594 } 595 596 request.Method = "GET" 597 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 598 if err != nil { 599 return out, metadata, &smithy.SerializationError{Err: err} 600 } 601 602 if err := awsRestjson1_serializeOpHttpBindingsListDatasetsInput(input, restEncoder); err != nil { 603 return out, metadata, &smithy.SerializationError{Err: err} 604 } 605 606 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 607 return out, metadata, &smithy.SerializationError{Err: err} 608 } 609 in.Request = request 610 611 return next.HandleSerialize(ctx, in) 612} 613func awsRestjson1_serializeOpHttpBindingsListDatasetsInput(v *ListDatasetsInput, encoder *httpbinding.Encoder) error { 614 if v == nil { 615 return fmt.Errorf("unsupported serialization of nil %T", v) 616 } 617 618 if v.IdentityId == nil || len(*v.IdentityId) == 0 { 619 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityId must not be empty")} 620 } 621 if v.IdentityId != nil { 622 if err := encoder.SetURI("IdentityId").String(*v.IdentityId); err != nil { 623 return err 624 } 625 } 626 627 if v.IdentityPoolId == nil || len(*v.IdentityPoolId) == 0 { 628 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityPoolId must not be empty")} 629 } 630 if v.IdentityPoolId != nil { 631 if err := encoder.SetURI("IdentityPoolId").String(*v.IdentityPoolId); err != nil { 632 return err 633 } 634 } 635 636 if v.MaxResults != nil { 637 encoder.SetQuery("maxResults").String(*v.MaxResults) 638 } 639 640 if v.NextToken != nil { 641 encoder.SetQuery("nextToken").String(*v.NextToken) 642 } 643 644 return nil 645} 646 647type awsRestjson1_serializeOpListIdentityPoolUsage struct { 648} 649 650func (*awsRestjson1_serializeOpListIdentityPoolUsage) ID() string { 651 return "OperationSerializer" 652} 653 654func (m *awsRestjson1_serializeOpListIdentityPoolUsage) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 655 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 656) { 657 request, ok := in.Request.(*smithyhttp.Request) 658 if !ok { 659 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 660 } 661 662 input, ok := in.Parameters.(*ListIdentityPoolUsageInput) 663 _ = input 664 if !ok { 665 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 666 } 667 668 opPath, opQuery := httpbinding.SplitURI("/identitypools") 669 request.URL.Path = opPath 670 if len(request.URL.RawQuery) > 0 { 671 request.URL.RawQuery = "&" + opQuery 672 } else { 673 request.URL.RawQuery = opQuery 674 } 675 676 request.Method = "GET" 677 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 678 if err != nil { 679 return out, metadata, &smithy.SerializationError{Err: err} 680 } 681 682 if err := awsRestjson1_serializeOpHttpBindingsListIdentityPoolUsageInput(input, restEncoder); err != nil { 683 return out, metadata, &smithy.SerializationError{Err: err} 684 } 685 686 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 687 return out, metadata, &smithy.SerializationError{Err: err} 688 } 689 in.Request = request 690 691 return next.HandleSerialize(ctx, in) 692} 693func awsRestjson1_serializeOpHttpBindingsListIdentityPoolUsageInput(v *ListIdentityPoolUsageInput, encoder *httpbinding.Encoder) error { 694 if v == nil { 695 return fmt.Errorf("unsupported serialization of nil %T", v) 696 } 697 698 if v.MaxResults != 0 { 699 encoder.SetQuery("maxResults").Integer(v.MaxResults) 700 } 701 702 if v.NextToken != nil { 703 encoder.SetQuery("nextToken").String(*v.NextToken) 704 } 705 706 return nil 707} 708 709type awsRestjson1_serializeOpListRecords struct { 710} 711 712func (*awsRestjson1_serializeOpListRecords) ID() string { 713 return "OperationSerializer" 714} 715 716func (m *awsRestjson1_serializeOpListRecords) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 717 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 718) { 719 request, ok := in.Request.(*smithyhttp.Request) 720 if !ok { 721 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 722 } 723 724 input, ok := in.Parameters.(*ListRecordsInput) 725 _ = input 726 if !ok { 727 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 728 } 729 730 opPath, opQuery := httpbinding.SplitURI("/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}/records") 731 request.URL.Path = opPath 732 if len(request.URL.RawQuery) > 0 { 733 request.URL.RawQuery = "&" + opQuery 734 } else { 735 request.URL.RawQuery = opQuery 736 } 737 738 request.Method = "GET" 739 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 740 if err != nil { 741 return out, metadata, &smithy.SerializationError{Err: err} 742 } 743 744 if err := awsRestjson1_serializeOpHttpBindingsListRecordsInput(input, restEncoder); err != nil { 745 return out, metadata, &smithy.SerializationError{Err: err} 746 } 747 748 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 749 return out, metadata, &smithy.SerializationError{Err: err} 750 } 751 in.Request = request 752 753 return next.HandleSerialize(ctx, in) 754} 755func awsRestjson1_serializeOpHttpBindingsListRecordsInput(v *ListRecordsInput, encoder *httpbinding.Encoder) error { 756 if v == nil { 757 return fmt.Errorf("unsupported serialization of nil %T", v) 758 } 759 760 if v.DatasetName == nil || len(*v.DatasetName) == 0 { 761 return &smithy.SerializationError{Err: fmt.Errorf("input member DatasetName must not be empty")} 762 } 763 if v.DatasetName != nil { 764 if err := encoder.SetURI("DatasetName").String(*v.DatasetName); err != nil { 765 return err 766 } 767 } 768 769 if v.IdentityId == nil || len(*v.IdentityId) == 0 { 770 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityId must not be empty")} 771 } 772 if v.IdentityId != nil { 773 if err := encoder.SetURI("IdentityId").String(*v.IdentityId); err != nil { 774 return err 775 } 776 } 777 778 if v.IdentityPoolId == nil || len(*v.IdentityPoolId) == 0 { 779 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityPoolId must not be empty")} 780 } 781 if v.IdentityPoolId != nil { 782 if err := encoder.SetURI("IdentityPoolId").String(*v.IdentityPoolId); err != nil { 783 return err 784 } 785 } 786 787 if v.LastSyncCount != nil { 788 encoder.SetQuery("lastSyncCount").Long(*v.LastSyncCount) 789 } 790 791 if v.MaxResults != 0 { 792 encoder.SetQuery("maxResults").Integer(v.MaxResults) 793 } 794 795 if v.NextToken != nil { 796 encoder.SetQuery("nextToken").String(*v.NextToken) 797 } 798 799 if v.SyncSessionToken != nil { 800 encoder.SetQuery("syncSessionToken").String(*v.SyncSessionToken) 801 } 802 803 return nil 804} 805 806type awsRestjson1_serializeOpRegisterDevice struct { 807} 808 809func (*awsRestjson1_serializeOpRegisterDevice) ID() string { 810 return "OperationSerializer" 811} 812 813func (m *awsRestjson1_serializeOpRegisterDevice) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 814 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 815) { 816 request, ok := in.Request.(*smithyhttp.Request) 817 if !ok { 818 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 819 } 820 821 input, ok := in.Parameters.(*RegisterDeviceInput) 822 _ = input 823 if !ok { 824 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 825 } 826 827 opPath, opQuery := httpbinding.SplitURI("/identitypools/{IdentityPoolId}/identity/{IdentityId}/device") 828 request.URL.Path = opPath 829 if len(request.URL.RawQuery) > 0 { 830 request.URL.RawQuery = "&" + opQuery 831 } else { 832 request.URL.RawQuery = opQuery 833 } 834 835 request.Method = "POST" 836 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 837 if err != nil { 838 return out, metadata, &smithy.SerializationError{Err: err} 839 } 840 841 if err := awsRestjson1_serializeOpHttpBindingsRegisterDeviceInput(input, restEncoder); err != nil { 842 return out, metadata, &smithy.SerializationError{Err: err} 843 } 844 845 restEncoder.SetHeader("Content-Type").String("application/json") 846 847 jsonEncoder := smithyjson.NewEncoder() 848 if err := awsRestjson1_serializeOpDocumentRegisterDeviceInput(input, jsonEncoder.Value); err != nil { 849 return out, metadata, &smithy.SerializationError{Err: err} 850 } 851 852 if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { 853 return out, metadata, &smithy.SerializationError{Err: err} 854 } 855 856 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 857 return out, metadata, &smithy.SerializationError{Err: err} 858 } 859 in.Request = request 860 861 return next.HandleSerialize(ctx, in) 862} 863func awsRestjson1_serializeOpHttpBindingsRegisterDeviceInput(v *RegisterDeviceInput, encoder *httpbinding.Encoder) error { 864 if v == nil { 865 return fmt.Errorf("unsupported serialization of nil %T", v) 866 } 867 868 if v.IdentityId == nil || len(*v.IdentityId) == 0 { 869 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityId must not be empty")} 870 } 871 if v.IdentityId != nil { 872 if err := encoder.SetURI("IdentityId").String(*v.IdentityId); err != nil { 873 return err 874 } 875 } 876 877 if v.IdentityPoolId == nil || len(*v.IdentityPoolId) == 0 { 878 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityPoolId must not be empty")} 879 } 880 if v.IdentityPoolId != nil { 881 if err := encoder.SetURI("IdentityPoolId").String(*v.IdentityPoolId); err != nil { 882 return err 883 } 884 } 885 886 return nil 887} 888 889func awsRestjson1_serializeOpDocumentRegisterDeviceInput(v *RegisterDeviceInput, value smithyjson.Value) error { 890 object := value.Object() 891 defer object.Close() 892 893 if len(v.Platform) > 0 { 894 ok := object.Key("Platform") 895 ok.String(string(v.Platform)) 896 } 897 898 if v.Token != nil { 899 ok := object.Key("Token") 900 ok.String(*v.Token) 901 } 902 903 return nil 904} 905 906type awsRestjson1_serializeOpSetCognitoEvents struct { 907} 908 909func (*awsRestjson1_serializeOpSetCognitoEvents) ID() string { 910 return "OperationSerializer" 911} 912 913func (m *awsRestjson1_serializeOpSetCognitoEvents) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 914 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 915) { 916 request, ok := in.Request.(*smithyhttp.Request) 917 if !ok { 918 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 919 } 920 921 input, ok := in.Parameters.(*SetCognitoEventsInput) 922 _ = input 923 if !ok { 924 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 925 } 926 927 opPath, opQuery := httpbinding.SplitURI("/identitypools/{IdentityPoolId}/events") 928 request.URL.Path = opPath 929 if len(request.URL.RawQuery) > 0 { 930 request.URL.RawQuery = "&" + opQuery 931 } else { 932 request.URL.RawQuery = opQuery 933 } 934 935 request.Method = "POST" 936 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 937 if err != nil { 938 return out, metadata, &smithy.SerializationError{Err: err} 939 } 940 941 if err := awsRestjson1_serializeOpHttpBindingsSetCognitoEventsInput(input, restEncoder); err != nil { 942 return out, metadata, &smithy.SerializationError{Err: err} 943 } 944 945 restEncoder.SetHeader("Content-Type").String("application/json") 946 947 jsonEncoder := smithyjson.NewEncoder() 948 if err := awsRestjson1_serializeOpDocumentSetCognitoEventsInput(input, jsonEncoder.Value); err != nil { 949 return out, metadata, &smithy.SerializationError{Err: err} 950 } 951 952 if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { 953 return out, metadata, &smithy.SerializationError{Err: err} 954 } 955 956 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 957 return out, metadata, &smithy.SerializationError{Err: err} 958 } 959 in.Request = request 960 961 return next.HandleSerialize(ctx, in) 962} 963func awsRestjson1_serializeOpHttpBindingsSetCognitoEventsInput(v *SetCognitoEventsInput, encoder *httpbinding.Encoder) error { 964 if v == nil { 965 return fmt.Errorf("unsupported serialization of nil %T", v) 966 } 967 968 if v.IdentityPoolId == nil || len(*v.IdentityPoolId) == 0 { 969 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityPoolId must not be empty")} 970 } 971 if v.IdentityPoolId != nil { 972 if err := encoder.SetURI("IdentityPoolId").String(*v.IdentityPoolId); err != nil { 973 return err 974 } 975 } 976 977 return nil 978} 979 980func awsRestjson1_serializeOpDocumentSetCognitoEventsInput(v *SetCognitoEventsInput, value smithyjson.Value) error { 981 object := value.Object() 982 defer object.Close() 983 984 if v.Events != nil { 985 ok := object.Key("Events") 986 if err := awsRestjson1_serializeDocumentEvents(v.Events, ok); err != nil { 987 return err 988 } 989 } 990 991 return nil 992} 993 994type awsRestjson1_serializeOpSetIdentityPoolConfiguration struct { 995} 996 997func (*awsRestjson1_serializeOpSetIdentityPoolConfiguration) ID() string { 998 return "OperationSerializer" 999} 1000 1001func (m *awsRestjson1_serializeOpSetIdentityPoolConfiguration) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 1002 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 1003) { 1004 request, ok := in.Request.(*smithyhttp.Request) 1005 if !ok { 1006 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 1007 } 1008 1009 input, ok := in.Parameters.(*SetIdentityPoolConfigurationInput) 1010 _ = input 1011 if !ok { 1012 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 1013 } 1014 1015 opPath, opQuery := httpbinding.SplitURI("/identitypools/{IdentityPoolId}/configuration") 1016 request.URL.Path = opPath 1017 if len(request.URL.RawQuery) > 0 { 1018 request.URL.RawQuery = "&" + opQuery 1019 } else { 1020 request.URL.RawQuery = opQuery 1021 } 1022 1023 request.Method = "POST" 1024 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 1025 if err != nil { 1026 return out, metadata, &smithy.SerializationError{Err: err} 1027 } 1028 1029 if err := awsRestjson1_serializeOpHttpBindingsSetIdentityPoolConfigurationInput(input, restEncoder); err != nil { 1030 return out, metadata, &smithy.SerializationError{Err: err} 1031 } 1032 1033 restEncoder.SetHeader("Content-Type").String("application/json") 1034 1035 jsonEncoder := smithyjson.NewEncoder() 1036 if err := awsRestjson1_serializeOpDocumentSetIdentityPoolConfigurationInput(input, jsonEncoder.Value); err != nil { 1037 return out, metadata, &smithy.SerializationError{Err: err} 1038 } 1039 1040 if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { 1041 return out, metadata, &smithy.SerializationError{Err: err} 1042 } 1043 1044 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 1045 return out, metadata, &smithy.SerializationError{Err: err} 1046 } 1047 in.Request = request 1048 1049 return next.HandleSerialize(ctx, in) 1050} 1051func awsRestjson1_serializeOpHttpBindingsSetIdentityPoolConfigurationInput(v *SetIdentityPoolConfigurationInput, encoder *httpbinding.Encoder) error { 1052 if v == nil { 1053 return fmt.Errorf("unsupported serialization of nil %T", v) 1054 } 1055 1056 if v.IdentityPoolId == nil || len(*v.IdentityPoolId) == 0 { 1057 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityPoolId must not be empty")} 1058 } 1059 if v.IdentityPoolId != nil { 1060 if err := encoder.SetURI("IdentityPoolId").String(*v.IdentityPoolId); err != nil { 1061 return err 1062 } 1063 } 1064 1065 return nil 1066} 1067 1068func awsRestjson1_serializeOpDocumentSetIdentityPoolConfigurationInput(v *SetIdentityPoolConfigurationInput, value smithyjson.Value) error { 1069 object := value.Object() 1070 defer object.Close() 1071 1072 if v.CognitoStreams != nil { 1073 ok := object.Key("CognitoStreams") 1074 if err := awsRestjson1_serializeDocumentCognitoStreams(v.CognitoStreams, ok); err != nil { 1075 return err 1076 } 1077 } 1078 1079 if v.PushSync != nil { 1080 ok := object.Key("PushSync") 1081 if err := awsRestjson1_serializeDocumentPushSync(v.PushSync, ok); err != nil { 1082 return err 1083 } 1084 } 1085 1086 return nil 1087} 1088 1089type awsRestjson1_serializeOpSubscribeToDataset struct { 1090} 1091 1092func (*awsRestjson1_serializeOpSubscribeToDataset) ID() string { 1093 return "OperationSerializer" 1094} 1095 1096func (m *awsRestjson1_serializeOpSubscribeToDataset) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 1097 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 1098) { 1099 request, ok := in.Request.(*smithyhttp.Request) 1100 if !ok { 1101 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 1102 } 1103 1104 input, ok := in.Parameters.(*SubscribeToDatasetInput) 1105 _ = input 1106 if !ok { 1107 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 1108 } 1109 1110 opPath, opQuery := httpbinding.SplitURI("/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}/subscriptions/{DeviceId}") 1111 request.URL.Path = opPath 1112 if len(request.URL.RawQuery) > 0 { 1113 request.URL.RawQuery = "&" + opQuery 1114 } else { 1115 request.URL.RawQuery = opQuery 1116 } 1117 1118 request.Method = "POST" 1119 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 1120 if err != nil { 1121 return out, metadata, &smithy.SerializationError{Err: err} 1122 } 1123 1124 if err := awsRestjson1_serializeOpHttpBindingsSubscribeToDatasetInput(input, restEncoder); err != nil { 1125 return out, metadata, &smithy.SerializationError{Err: err} 1126 } 1127 1128 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 1129 return out, metadata, &smithy.SerializationError{Err: err} 1130 } 1131 in.Request = request 1132 1133 return next.HandleSerialize(ctx, in) 1134} 1135func awsRestjson1_serializeOpHttpBindingsSubscribeToDatasetInput(v *SubscribeToDatasetInput, encoder *httpbinding.Encoder) error { 1136 if v == nil { 1137 return fmt.Errorf("unsupported serialization of nil %T", v) 1138 } 1139 1140 if v.DatasetName == nil || len(*v.DatasetName) == 0 { 1141 return &smithy.SerializationError{Err: fmt.Errorf("input member DatasetName must not be empty")} 1142 } 1143 if v.DatasetName != nil { 1144 if err := encoder.SetURI("DatasetName").String(*v.DatasetName); err != nil { 1145 return err 1146 } 1147 } 1148 1149 if v.DeviceId == nil || len(*v.DeviceId) == 0 { 1150 return &smithy.SerializationError{Err: fmt.Errorf("input member DeviceId must not be empty")} 1151 } 1152 if v.DeviceId != nil { 1153 if err := encoder.SetURI("DeviceId").String(*v.DeviceId); err != nil { 1154 return err 1155 } 1156 } 1157 1158 if v.IdentityId == nil || len(*v.IdentityId) == 0 { 1159 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityId must not be empty")} 1160 } 1161 if v.IdentityId != nil { 1162 if err := encoder.SetURI("IdentityId").String(*v.IdentityId); err != nil { 1163 return err 1164 } 1165 } 1166 1167 if v.IdentityPoolId == nil || len(*v.IdentityPoolId) == 0 { 1168 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityPoolId must not be empty")} 1169 } 1170 if v.IdentityPoolId != nil { 1171 if err := encoder.SetURI("IdentityPoolId").String(*v.IdentityPoolId); err != nil { 1172 return err 1173 } 1174 } 1175 1176 return nil 1177} 1178 1179type awsRestjson1_serializeOpUnsubscribeFromDataset struct { 1180} 1181 1182func (*awsRestjson1_serializeOpUnsubscribeFromDataset) ID() string { 1183 return "OperationSerializer" 1184} 1185 1186func (m *awsRestjson1_serializeOpUnsubscribeFromDataset) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 1187 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 1188) { 1189 request, ok := in.Request.(*smithyhttp.Request) 1190 if !ok { 1191 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 1192 } 1193 1194 input, ok := in.Parameters.(*UnsubscribeFromDatasetInput) 1195 _ = input 1196 if !ok { 1197 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 1198 } 1199 1200 opPath, opQuery := httpbinding.SplitURI("/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}/subscriptions/{DeviceId}") 1201 request.URL.Path = opPath 1202 if len(request.URL.RawQuery) > 0 { 1203 request.URL.RawQuery = "&" + opQuery 1204 } else { 1205 request.URL.RawQuery = opQuery 1206 } 1207 1208 request.Method = "DELETE" 1209 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 1210 if err != nil { 1211 return out, metadata, &smithy.SerializationError{Err: err} 1212 } 1213 1214 if err := awsRestjson1_serializeOpHttpBindingsUnsubscribeFromDatasetInput(input, restEncoder); err != nil { 1215 return out, metadata, &smithy.SerializationError{Err: err} 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 awsRestjson1_serializeOpHttpBindingsUnsubscribeFromDatasetInput(v *UnsubscribeFromDatasetInput, encoder *httpbinding.Encoder) error { 1226 if v == nil { 1227 return fmt.Errorf("unsupported serialization of nil %T", v) 1228 } 1229 1230 if v.DatasetName == nil || len(*v.DatasetName) == 0 { 1231 return &smithy.SerializationError{Err: fmt.Errorf("input member DatasetName must not be empty")} 1232 } 1233 if v.DatasetName != nil { 1234 if err := encoder.SetURI("DatasetName").String(*v.DatasetName); err != nil { 1235 return err 1236 } 1237 } 1238 1239 if v.DeviceId == nil || len(*v.DeviceId) == 0 { 1240 return &smithy.SerializationError{Err: fmt.Errorf("input member DeviceId must not be empty")} 1241 } 1242 if v.DeviceId != nil { 1243 if err := encoder.SetURI("DeviceId").String(*v.DeviceId); err != nil { 1244 return err 1245 } 1246 } 1247 1248 if v.IdentityId == nil || len(*v.IdentityId) == 0 { 1249 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityId must not be empty")} 1250 } 1251 if v.IdentityId != nil { 1252 if err := encoder.SetURI("IdentityId").String(*v.IdentityId); err != nil { 1253 return err 1254 } 1255 } 1256 1257 if v.IdentityPoolId == nil || len(*v.IdentityPoolId) == 0 { 1258 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityPoolId must not be empty")} 1259 } 1260 if v.IdentityPoolId != nil { 1261 if err := encoder.SetURI("IdentityPoolId").String(*v.IdentityPoolId); err != nil { 1262 return err 1263 } 1264 } 1265 1266 return nil 1267} 1268 1269type awsRestjson1_serializeOpUpdateRecords struct { 1270} 1271 1272func (*awsRestjson1_serializeOpUpdateRecords) ID() string { 1273 return "OperationSerializer" 1274} 1275 1276func (m *awsRestjson1_serializeOpUpdateRecords) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 1277 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 1278) { 1279 request, ok := in.Request.(*smithyhttp.Request) 1280 if !ok { 1281 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} 1282 } 1283 1284 input, ok := in.Parameters.(*UpdateRecordsInput) 1285 _ = input 1286 if !ok { 1287 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} 1288 } 1289 1290 opPath, opQuery := httpbinding.SplitURI("/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}") 1291 request.URL.Path = opPath 1292 if len(request.URL.RawQuery) > 0 { 1293 request.URL.RawQuery = "&" + opQuery 1294 } else { 1295 request.URL.RawQuery = opQuery 1296 } 1297 1298 request.Method = "POST" 1299 restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) 1300 if err != nil { 1301 return out, metadata, &smithy.SerializationError{Err: err} 1302 } 1303 1304 if err := awsRestjson1_serializeOpHttpBindingsUpdateRecordsInput(input, restEncoder); err != nil { 1305 return out, metadata, &smithy.SerializationError{Err: err} 1306 } 1307 1308 restEncoder.SetHeader("Content-Type").String("application/json") 1309 1310 jsonEncoder := smithyjson.NewEncoder() 1311 if err := awsRestjson1_serializeOpDocumentUpdateRecordsInput(input, jsonEncoder.Value); err != nil { 1312 return out, metadata, &smithy.SerializationError{Err: err} 1313 } 1314 1315 if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { 1316 return out, metadata, &smithy.SerializationError{Err: err} 1317 } 1318 1319 if request.Request, err = restEncoder.Encode(request.Request); err != nil { 1320 return out, metadata, &smithy.SerializationError{Err: err} 1321 } 1322 in.Request = request 1323 1324 return next.HandleSerialize(ctx, in) 1325} 1326func awsRestjson1_serializeOpHttpBindingsUpdateRecordsInput(v *UpdateRecordsInput, encoder *httpbinding.Encoder) error { 1327 if v == nil { 1328 return fmt.Errorf("unsupported serialization of nil %T", v) 1329 } 1330 1331 if v.ClientContext != nil && len(*v.ClientContext) > 0 { 1332 locationName := "X-Amz-Client-Context" 1333 encoder.SetHeader(locationName).String(*v.ClientContext) 1334 } 1335 1336 if v.DatasetName == nil || len(*v.DatasetName) == 0 { 1337 return &smithy.SerializationError{Err: fmt.Errorf("input member DatasetName must not be empty")} 1338 } 1339 if v.DatasetName != nil { 1340 if err := encoder.SetURI("DatasetName").String(*v.DatasetName); err != nil { 1341 return err 1342 } 1343 } 1344 1345 if v.IdentityId == nil || len(*v.IdentityId) == 0 { 1346 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityId must not be empty")} 1347 } 1348 if v.IdentityId != nil { 1349 if err := encoder.SetURI("IdentityId").String(*v.IdentityId); err != nil { 1350 return err 1351 } 1352 } 1353 1354 if v.IdentityPoolId == nil || len(*v.IdentityPoolId) == 0 { 1355 return &smithy.SerializationError{Err: fmt.Errorf("input member IdentityPoolId must not be empty")} 1356 } 1357 if v.IdentityPoolId != nil { 1358 if err := encoder.SetURI("IdentityPoolId").String(*v.IdentityPoolId); err != nil { 1359 return err 1360 } 1361 } 1362 1363 return nil 1364} 1365 1366func awsRestjson1_serializeOpDocumentUpdateRecordsInput(v *UpdateRecordsInput, value smithyjson.Value) error { 1367 object := value.Object() 1368 defer object.Close() 1369 1370 if v.DeviceId != nil { 1371 ok := object.Key("DeviceId") 1372 ok.String(*v.DeviceId) 1373 } 1374 1375 if v.RecordPatches != nil { 1376 ok := object.Key("RecordPatches") 1377 if err := awsRestjson1_serializeDocumentRecordPatchList(v.RecordPatches, ok); err != nil { 1378 return err 1379 } 1380 } 1381 1382 if v.SyncSessionToken != nil { 1383 ok := object.Key("SyncSessionToken") 1384 ok.String(*v.SyncSessionToken) 1385 } 1386 1387 return nil 1388} 1389 1390func awsRestjson1_serializeDocumentApplicationArnList(v []string, value smithyjson.Value) error { 1391 array := value.Array() 1392 defer array.Close() 1393 1394 for i := range v { 1395 av := array.Value() 1396 av.String(v[i]) 1397 } 1398 return nil 1399} 1400 1401func awsRestjson1_serializeDocumentCognitoStreams(v *types.CognitoStreams, value smithyjson.Value) error { 1402 object := value.Object() 1403 defer object.Close() 1404 1405 if v.DisabledReason != nil { 1406 ok := object.Key("DisabledReason") 1407 ok.String(*v.DisabledReason) 1408 } 1409 1410 if v.RoleArn != nil { 1411 ok := object.Key("RoleArn") 1412 ok.String(*v.RoleArn) 1413 } 1414 1415 if len(v.StreamingStatus) > 0 { 1416 ok := object.Key("StreamingStatus") 1417 ok.String(string(v.StreamingStatus)) 1418 } 1419 1420 if v.StreamName != nil { 1421 ok := object.Key("StreamName") 1422 ok.String(*v.StreamName) 1423 } 1424 1425 return nil 1426} 1427 1428func awsRestjson1_serializeDocumentEvents(v map[string]string, value smithyjson.Value) error { 1429 object := value.Object() 1430 defer object.Close() 1431 1432 for key := range v { 1433 om := object.Key(key) 1434 om.String(v[key]) 1435 } 1436 return nil 1437} 1438 1439func awsRestjson1_serializeDocumentPushSync(v *types.PushSync, value smithyjson.Value) error { 1440 object := value.Object() 1441 defer object.Close() 1442 1443 if v.ApplicationArns != nil { 1444 ok := object.Key("ApplicationArns") 1445 if err := awsRestjson1_serializeDocumentApplicationArnList(v.ApplicationArns, ok); err != nil { 1446 return err 1447 } 1448 } 1449 1450 if v.RoleArn != nil { 1451 ok := object.Key("RoleArn") 1452 ok.String(*v.RoleArn) 1453 } 1454 1455 return nil 1456} 1457 1458func awsRestjson1_serializeDocumentRecordPatch(v *types.RecordPatch, value smithyjson.Value) error { 1459 object := value.Object() 1460 defer object.Close() 1461 1462 if v.DeviceLastModifiedDate != nil { 1463 ok := object.Key("DeviceLastModifiedDate") 1464 ok.Double(smithytime.FormatEpochSeconds(*v.DeviceLastModifiedDate)) 1465 } 1466 1467 if v.Key != nil { 1468 ok := object.Key("Key") 1469 ok.String(*v.Key) 1470 } 1471 1472 if len(v.Op) > 0 { 1473 ok := object.Key("Op") 1474 ok.String(string(v.Op)) 1475 } 1476 1477 if v.SyncCount != nil { 1478 ok := object.Key("SyncCount") 1479 ok.Long(*v.SyncCount) 1480 } 1481 1482 if v.Value != nil { 1483 ok := object.Key("Value") 1484 ok.String(*v.Value) 1485 } 1486 1487 return nil 1488} 1489 1490func awsRestjson1_serializeDocumentRecordPatchList(v []types.RecordPatch, value smithyjson.Value) error { 1491 array := value.Array() 1492 defer array.Close() 1493 1494 for i := range v { 1495 av := array.Value() 1496 if err := awsRestjson1_serializeDocumentRecordPatch(&v[i], av); err != nil { 1497 return err 1498 } 1499 } 1500 return nil 1501} 1502