1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package codegurureviewer 4 5import ( 6 "context" 7 "fmt" 8 "github.com/aws/aws-sdk-go-v2/service/codegurureviewer/types" 9 smithy "github.com/aws/smithy-go" 10 "github.com/aws/smithy-go/middleware" 11) 12 13type validateOpAssociateRepository struct { 14} 15 16func (*validateOpAssociateRepository) ID() string { 17 return "OperationInputValidation" 18} 19 20func (m *validateOpAssociateRepository) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( 21 out middleware.InitializeOutput, metadata middleware.Metadata, err error, 22) { 23 input, ok := in.Parameters.(*AssociateRepositoryInput) 24 if !ok { 25 return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) 26 } 27 if err := validateOpAssociateRepositoryInput(input); err != nil { 28 return out, metadata, err 29 } 30 return next.HandleInitialize(ctx, in) 31} 32 33type validateOpCreateCodeReview struct { 34} 35 36func (*validateOpCreateCodeReview) ID() string { 37 return "OperationInputValidation" 38} 39 40func (m *validateOpCreateCodeReview) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( 41 out middleware.InitializeOutput, metadata middleware.Metadata, err error, 42) { 43 input, ok := in.Parameters.(*CreateCodeReviewInput) 44 if !ok { 45 return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) 46 } 47 if err := validateOpCreateCodeReviewInput(input); err != nil { 48 return out, metadata, err 49 } 50 return next.HandleInitialize(ctx, in) 51} 52 53type validateOpDescribeCodeReview struct { 54} 55 56func (*validateOpDescribeCodeReview) ID() string { 57 return "OperationInputValidation" 58} 59 60func (m *validateOpDescribeCodeReview) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( 61 out middleware.InitializeOutput, metadata middleware.Metadata, err error, 62) { 63 input, ok := in.Parameters.(*DescribeCodeReviewInput) 64 if !ok { 65 return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) 66 } 67 if err := validateOpDescribeCodeReviewInput(input); err != nil { 68 return out, metadata, err 69 } 70 return next.HandleInitialize(ctx, in) 71} 72 73type validateOpDescribeRecommendationFeedback struct { 74} 75 76func (*validateOpDescribeRecommendationFeedback) ID() string { 77 return "OperationInputValidation" 78} 79 80func (m *validateOpDescribeRecommendationFeedback) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( 81 out middleware.InitializeOutput, metadata middleware.Metadata, err error, 82) { 83 input, ok := in.Parameters.(*DescribeRecommendationFeedbackInput) 84 if !ok { 85 return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) 86 } 87 if err := validateOpDescribeRecommendationFeedbackInput(input); err != nil { 88 return out, metadata, err 89 } 90 return next.HandleInitialize(ctx, in) 91} 92 93type validateOpDescribeRepositoryAssociation struct { 94} 95 96func (*validateOpDescribeRepositoryAssociation) ID() string { 97 return "OperationInputValidation" 98} 99 100func (m *validateOpDescribeRepositoryAssociation) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( 101 out middleware.InitializeOutput, metadata middleware.Metadata, err error, 102) { 103 input, ok := in.Parameters.(*DescribeRepositoryAssociationInput) 104 if !ok { 105 return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) 106 } 107 if err := validateOpDescribeRepositoryAssociationInput(input); err != nil { 108 return out, metadata, err 109 } 110 return next.HandleInitialize(ctx, in) 111} 112 113type validateOpDisassociateRepository struct { 114} 115 116func (*validateOpDisassociateRepository) ID() string { 117 return "OperationInputValidation" 118} 119 120func (m *validateOpDisassociateRepository) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( 121 out middleware.InitializeOutput, metadata middleware.Metadata, err error, 122) { 123 input, ok := in.Parameters.(*DisassociateRepositoryInput) 124 if !ok { 125 return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) 126 } 127 if err := validateOpDisassociateRepositoryInput(input); err != nil { 128 return out, metadata, err 129 } 130 return next.HandleInitialize(ctx, in) 131} 132 133type validateOpListCodeReviews struct { 134} 135 136func (*validateOpListCodeReviews) ID() string { 137 return "OperationInputValidation" 138} 139 140func (m *validateOpListCodeReviews) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( 141 out middleware.InitializeOutput, metadata middleware.Metadata, err error, 142) { 143 input, ok := in.Parameters.(*ListCodeReviewsInput) 144 if !ok { 145 return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) 146 } 147 if err := validateOpListCodeReviewsInput(input); err != nil { 148 return out, metadata, err 149 } 150 return next.HandleInitialize(ctx, in) 151} 152 153type validateOpListRecommendationFeedback struct { 154} 155 156func (*validateOpListRecommendationFeedback) ID() string { 157 return "OperationInputValidation" 158} 159 160func (m *validateOpListRecommendationFeedback) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( 161 out middleware.InitializeOutput, metadata middleware.Metadata, err error, 162) { 163 input, ok := in.Parameters.(*ListRecommendationFeedbackInput) 164 if !ok { 165 return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) 166 } 167 if err := validateOpListRecommendationFeedbackInput(input); err != nil { 168 return out, metadata, err 169 } 170 return next.HandleInitialize(ctx, in) 171} 172 173type validateOpListRecommendations struct { 174} 175 176func (*validateOpListRecommendations) ID() string { 177 return "OperationInputValidation" 178} 179 180func (m *validateOpListRecommendations) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( 181 out middleware.InitializeOutput, metadata middleware.Metadata, err error, 182) { 183 input, ok := in.Parameters.(*ListRecommendationsInput) 184 if !ok { 185 return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) 186 } 187 if err := validateOpListRecommendationsInput(input); err != nil { 188 return out, metadata, err 189 } 190 return next.HandleInitialize(ctx, in) 191} 192 193type validateOpListTagsForResource struct { 194} 195 196func (*validateOpListTagsForResource) ID() string { 197 return "OperationInputValidation" 198} 199 200func (m *validateOpListTagsForResource) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( 201 out middleware.InitializeOutput, metadata middleware.Metadata, err error, 202) { 203 input, ok := in.Parameters.(*ListTagsForResourceInput) 204 if !ok { 205 return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) 206 } 207 if err := validateOpListTagsForResourceInput(input); err != nil { 208 return out, metadata, err 209 } 210 return next.HandleInitialize(ctx, in) 211} 212 213type validateOpPutRecommendationFeedback struct { 214} 215 216func (*validateOpPutRecommendationFeedback) ID() string { 217 return "OperationInputValidation" 218} 219 220func (m *validateOpPutRecommendationFeedback) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( 221 out middleware.InitializeOutput, metadata middleware.Metadata, err error, 222) { 223 input, ok := in.Parameters.(*PutRecommendationFeedbackInput) 224 if !ok { 225 return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) 226 } 227 if err := validateOpPutRecommendationFeedbackInput(input); err != nil { 228 return out, metadata, err 229 } 230 return next.HandleInitialize(ctx, in) 231} 232 233type validateOpTagResource struct { 234} 235 236func (*validateOpTagResource) ID() string { 237 return "OperationInputValidation" 238} 239 240func (m *validateOpTagResource) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( 241 out middleware.InitializeOutput, metadata middleware.Metadata, err error, 242) { 243 input, ok := in.Parameters.(*TagResourceInput) 244 if !ok { 245 return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) 246 } 247 if err := validateOpTagResourceInput(input); err != nil { 248 return out, metadata, err 249 } 250 return next.HandleInitialize(ctx, in) 251} 252 253type validateOpUntagResource struct { 254} 255 256func (*validateOpUntagResource) ID() string { 257 return "OperationInputValidation" 258} 259 260func (m *validateOpUntagResource) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( 261 out middleware.InitializeOutput, metadata middleware.Metadata, err error, 262) { 263 input, ok := in.Parameters.(*UntagResourceInput) 264 if !ok { 265 return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) 266 } 267 if err := validateOpUntagResourceInput(input); err != nil { 268 return out, metadata, err 269 } 270 return next.HandleInitialize(ctx, in) 271} 272 273func addOpAssociateRepositoryValidationMiddleware(stack *middleware.Stack) error { 274 return stack.Initialize.Add(&validateOpAssociateRepository{}, middleware.After) 275} 276 277func addOpCreateCodeReviewValidationMiddleware(stack *middleware.Stack) error { 278 return stack.Initialize.Add(&validateOpCreateCodeReview{}, middleware.After) 279} 280 281func addOpDescribeCodeReviewValidationMiddleware(stack *middleware.Stack) error { 282 return stack.Initialize.Add(&validateOpDescribeCodeReview{}, middleware.After) 283} 284 285func addOpDescribeRecommendationFeedbackValidationMiddleware(stack *middleware.Stack) error { 286 return stack.Initialize.Add(&validateOpDescribeRecommendationFeedback{}, middleware.After) 287} 288 289func addOpDescribeRepositoryAssociationValidationMiddleware(stack *middleware.Stack) error { 290 return stack.Initialize.Add(&validateOpDescribeRepositoryAssociation{}, middleware.After) 291} 292 293func addOpDisassociateRepositoryValidationMiddleware(stack *middleware.Stack) error { 294 return stack.Initialize.Add(&validateOpDisassociateRepository{}, middleware.After) 295} 296 297func addOpListCodeReviewsValidationMiddleware(stack *middleware.Stack) error { 298 return stack.Initialize.Add(&validateOpListCodeReviews{}, middleware.After) 299} 300 301func addOpListRecommendationFeedbackValidationMiddleware(stack *middleware.Stack) error { 302 return stack.Initialize.Add(&validateOpListRecommendationFeedback{}, middleware.After) 303} 304 305func addOpListRecommendationsValidationMiddleware(stack *middleware.Stack) error { 306 return stack.Initialize.Add(&validateOpListRecommendations{}, middleware.After) 307} 308 309func addOpListTagsForResourceValidationMiddleware(stack *middleware.Stack) error { 310 return stack.Initialize.Add(&validateOpListTagsForResource{}, middleware.After) 311} 312 313func addOpPutRecommendationFeedbackValidationMiddleware(stack *middleware.Stack) error { 314 return stack.Initialize.Add(&validateOpPutRecommendationFeedback{}, middleware.After) 315} 316 317func addOpTagResourceValidationMiddleware(stack *middleware.Stack) error { 318 return stack.Initialize.Add(&validateOpTagResource{}, middleware.After) 319} 320 321func addOpUntagResourceValidationMiddleware(stack *middleware.Stack) error { 322 return stack.Initialize.Add(&validateOpUntagResource{}, middleware.After) 323} 324 325func validateCodeCommitRepository(v *types.CodeCommitRepository) error { 326 if v == nil { 327 return nil 328 } 329 invalidParams := smithy.InvalidParamsError{Context: "CodeCommitRepository"} 330 if v.Name == nil { 331 invalidParams.Add(smithy.NewErrParamRequired("Name")) 332 } 333 if invalidParams.Len() > 0 { 334 return invalidParams 335 } else { 336 return nil 337 } 338} 339 340func validateCodeReviewType(v *types.CodeReviewType) error { 341 if v == nil { 342 return nil 343 } 344 invalidParams := smithy.InvalidParamsError{Context: "CodeReviewType"} 345 if v.RepositoryAnalysis == nil { 346 invalidParams.Add(smithy.NewErrParamRequired("RepositoryAnalysis")) 347 } else if v.RepositoryAnalysis != nil { 348 if err := validateRepositoryAnalysis(v.RepositoryAnalysis); err != nil { 349 invalidParams.AddNested("RepositoryAnalysis", err.(smithy.InvalidParamsError)) 350 } 351 } 352 if invalidParams.Len() > 0 { 353 return invalidParams 354 } else { 355 return nil 356 } 357} 358 359func validateRepository(v *types.Repository) error { 360 if v == nil { 361 return nil 362 } 363 invalidParams := smithy.InvalidParamsError{Context: "Repository"} 364 if v.CodeCommit != nil { 365 if err := validateCodeCommitRepository(v.CodeCommit); err != nil { 366 invalidParams.AddNested("CodeCommit", err.(smithy.InvalidParamsError)) 367 } 368 } 369 if v.Bitbucket != nil { 370 if err := validateThirdPartySourceRepository(v.Bitbucket); err != nil { 371 invalidParams.AddNested("Bitbucket", err.(smithy.InvalidParamsError)) 372 } 373 } 374 if v.GitHubEnterpriseServer != nil { 375 if err := validateThirdPartySourceRepository(v.GitHubEnterpriseServer); err != nil { 376 invalidParams.AddNested("GitHubEnterpriseServer", err.(smithy.InvalidParamsError)) 377 } 378 } 379 if invalidParams.Len() > 0 { 380 return invalidParams 381 } else { 382 return nil 383 } 384} 385 386func validateRepositoryAnalysis(v *types.RepositoryAnalysis) error { 387 if v == nil { 388 return nil 389 } 390 invalidParams := smithy.InvalidParamsError{Context: "RepositoryAnalysis"} 391 if v.RepositoryHead == nil { 392 invalidParams.Add(smithy.NewErrParamRequired("RepositoryHead")) 393 } else if v.RepositoryHead != nil { 394 if err := validateRepositoryHeadSourceCodeType(v.RepositoryHead); err != nil { 395 invalidParams.AddNested("RepositoryHead", err.(smithy.InvalidParamsError)) 396 } 397 } 398 if invalidParams.Len() > 0 { 399 return invalidParams 400 } else { 401 return nil 402 } 403} 404 405func validateRepositoryHeadSourceCodeType(v *types.RepositoryHeadSourceCodeType) error { 406 if v == nil { 407 return nil 408 } 409 invalidParams := smithy.InvalidParamsError{Context: "RepositoryHeadSourceCodeType"} 410 if v.BranchName == nil { 411 invalidParams.Add(smithy.NewErrParamRequired("BranchName")) 412 } 413 if invalidParams.Len() > 0 { 414 return invalidParams 415 } else { 416 return nil 417 } 418} 419 420func validateThirdPartySourceRepository(v *types.ThirdPartySourceRepository) error { 421 if v == nil { 422 return nil 423 } 424 invalidParams := smithy.InvalidParamsError{Context: "ThirdPartySourceRepository"} 425 if v.Name == nil { 426 invalidParams.Add(smithy.NewErrParamRequired("Name")) 427 } 428 if v.ConnectionArn == nil { 429 invalidParams.Add(smithy.NewErrParamRequired("ConnectionArn")) 430 } 431 if v.Owner == nil { 432 invalidParams.Add(smithy.NewErrParamRequired("Owner")) 433 } 434 if invalidParams.Len() > 0 { 435 return invalidParams 436 } else { 437 return nil 438 } 439} 440 441func validateOpAssociateRepositoryInput(v *AssociateRepositoryInput) error { 442 if v == nil { 443 return nil 444 } 445 invalidParams := smithy.InvalidParamsError{Context: "AssociateRepositoryInput"} 446 if v.Repository == nil { 447 invalidParams.Add(smithy.NewErrParamRequired("Repository")) 448 } else if v.Repository != nil { 449 if err := validateRepository(v.Repository); err != nil { 450 invalidParams.AddNested("Repository", err.(smithy.InvalidParamsError)) 451 } 452 } 453 if invalidParams.Len() > 0 { 454 return invalidParams 455 } else { 456 return nil 457 } 458} 459 460func validateOpCreateCodeReviewInput(v *CreateCodeReviewInput) error { 461 if v == nil { 462 return nil 463 } 464 invalidParams := smithy.InvalidParamsError{Context: "CreateCodeReviewInput"} 465 if v.Name == nil { 466 invalidParams.Add(smithy.NewErrParamRequired("Name")) 467 } 468 if v.RepositoryAssociationArn == nil { 469 invalidParams.Add(smithy.NewErrParamRequired("RepositoryAssociationArn")) 470 } 471 if v.Type == nil { 472 invalidParams.Add(smithy.NewErrParamRequired("Type")) 473 } else if v.Type != nil { 474 if err := validateCodeReviewType(v.Type); err != nil { 475 invalidParams.AddNested("Type", err.(smithy.InvalidParamsError)) 476 } 477 } 478 if invalidParams.Len() > 0 { 479 return invalidParams 480 } else { 481 return nil 482 } 483} 484 485func validateOpDescribeCodeReviewInput(v *DescribeCodeReviewInput) error { 486 if v == nil { 487 return nil 488 } 489 invalidParams := smithy.InvalidParamsError{Context: "DescribeCodeReviewInput"} 490 if v.CodeReviewArn == nil { 491 invalidParams.Add(smithy.NewErrParamRequired("CodeReviewArn")) 492 } 493 if invalidParams.Len() > 0 { 494 return invalidParams 495 } else { 496 return nil 497 } 498} 499 500func validateOpDescribeRecommendationFeedbackInput(v *DescribeRecommendationFeedbackInput) error { 501 if v == nil { 502 return nil 503 } 504 invalidParams := smithy.InvalidParamsError{Context: "DescribeRecommendationFeedbackInput"} 505 if v.CodeReviewArn == nil { 506 invalidParams.Add(smithy.NewErrParamRequired("CodeReviewArn")) 507 } 508 if v.RecommendationId == nil { 509 invalidParams.Add(smithy.NewErrParamRequired("RecommendationId")) 510 } 511 if invalidParams.Len() > 0 { 512 return invalidParams 513 } else { 514 return nil 515 } 516} 517 518func validateOpDescribeRepositoryAssociationInput(v *DescribeRepositoryAssociationInput) error { 519 if v == nil { 520 return nil 521 } 522 invalidParams := smithy.InvalidParamsError{Context: "DescribeRepositoryAssociationInput"} 523 if v.AssociationArn == nil { 524 invalidParams.Add(smithy.NewErrParamRequired("AssociationArn")) 525 } 526 if invalidParams.Len() > 0 { 527 return invalidParams 528 } else { 529 return nil 530 } 531} 532 533func validateOpDisassociateRepositoryInput(v *DisassociateRepositoryInput) error { 534 if v == nil { 535 return nil 536 } 537 invalidParams := smithy.InvalidParamsError{Context: "DisassociateRepositoryInput"} 538 if v.AssociationArn == nil { 539 invalidParams.Add(smithy.NewErrParamRequired("AssociationArn")) 540 } 541 if invalidParams.Len() > 0 { 542 return invalidParams 543 } else { 544 return nil 545 } 546} 547 548func validateOpListCodeReviewsInput(v *ListCodeReviewsInput) error { 549 if v == nil { 550 return nil 551 } 552 invalidParams := smithy.InvalidParamsError{Context: "ListCodeReviewsInput"} 553 if len(v.Type) == 0 { 554 invalidParams.Add(smithy.NewErrParamRequired("Type")) 555 } 556 if invalidParams.Len() > 0 { 557 return invalidParams 558 } else { 559 return nil 560 } 561} 562 563func validateOpListRecommendationFeedbackInput(v *ListRecommendationFeedbackInput) error { 564 if v == nil { 565 return nil 566 } 567 invalidParams := smithy.InvalidParamsError{Context: "ListRecommendationFeedbackInput"} 568 if v.CodeReviewArn == nil { 569 invalidParams.Add(smithy.NewErrParamRequired("CodeReviewArn")) 570 } 571 if invalidParams.Len() > 0 { 572 return invalidParams 573 } else { 574 return nil 575 } 576} 577 578func validateOpListRecommendationsInput(v *ListRecommendationsInput) error { 579 if v == nil { 580 return nil 581 } 582 invalidParams := smithy.InvalidParamsError{Context: "ListRecommendationsInput"} 583 if v.CodeReviewArn == nil { 584 invalidParams.Add(smithy.NewErrParamRequired("CodeReviewArn")) 585 } 586 if invalidParams.Len() > 0 { 587 return invalidParams 588 } else { 589 return nil 590 } 591} 592 593func validateOpListTagsForResourceInput(v *ListTagsForResourceInput) error { 594 if v == nil { 595 return nil 596 } 597 invalidParams := smithy.InvalidParamsError{Context: "ListTagsForResourceInput"} 598 if v.ResourceArn == nil { 599 invalidParams.Add(smithy.NewErrParamRequired("ResourceArn")) 600 } 601 if invalidParams.Len() > 0 { 602 return invalidParams 603 } else { 604 return nil 605 } 606} 607 608func validateOpPutRecommendationFeedbackInput(v *PutRecommendationFeedbackInput) error { 609 if v == nil { 610 return nil 611 } 612 invalidParams := smithy.InvalidParamsError{Context: "PutRecommendationFeedbackInput"} 613 if v.CodeReviewArn == nil { 614 invalidParams.Add(smithy.NewErrParamRequired("CodeReviewArn")) 615 } 616 if v.RecommendationId == nil { 617 invalidParams.Add(smithy.NewErrParamRequired("RecommendationId")) 618 } 619 if v.Reactions == nil { 620 invalidParams.Add(smithy.NewErrParamRequired("Reactions")) 621 } 622 if invalidParams.Len() > 0 { 623 return invalidParams 624 } else { 625 return nil 626 } 627} 628 629func validateOpTagResourceInput(v *TagResourceInput) error { 630 if v == nil { 631 return nil 632 } 633 invalidParams := smithy.InvalidParamsError{Context: "TagResourceInput"} 634 if v.ResourceArn == nil { 635 invalidParams.Add(smithy.NewErrParamRequired("ResourceArn")) 636 } 637 if v.Tags == nil { 638 invalidParams.Add(smithy.NewErrParamRequired("Tags")) 639 } 640 if invalidParams.Len() > 0 { 641 return invalidParams 642 } else { 643 return nil 644 } 645} 646 647func validateOpUntagResourceInput(v *UntagResourceInput) error { 648 if v == nil { 649 return nil 650 } 651 invalidParams := smithy.InvalidParamsError{Context: "UntagResourceInput"} 652 if v.ResourceArn == nil { 653 invalidParams.Add(smithy.NewErrParamRequired("ResourceArn")) 654 } 655 if v.TagKeys == nil { 656 invalidParams.Add(smithy.NewErrParamRequired("TagKeys")) 657 } 658 if invalidParams.Len() > 0 { 659 return invalidParams 660 } else { 661 return nil 662 } 663} 664