waiters.go 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
  2. package ecr
  3. import (
  4. "time"
  5. "github.com/aws/aws-sdk-go/aws"
  6. "github.com/aws/aws-sdk-go/aws/request"
  7. )
  8. // WaitUntilImageScanComplete uses the Amazon ECR API operation
  9. // DescribeImageScanFindings to wait for a condition to be met before returning.
  10. // If the condition is not met within the max attempt window, an error will
  11. // be returned.
  12. func (c *ECR) WaitUntilImageScanComplete(input *DescribeImageScanFindingsInput) error {
  13. return c.WaitUntilImageScanCompleteWithContext(aws.BackgroundContext(), input)
  14. }
  15. // WaitUntilImageScanCompleteWithContext is an extended version of WaitUntilImageScanComplete.
  16. // With the support for passing in a context and options to configure the
  17. // Waiter and the underlying request options.
  18. //
  19. // The context must be non-nil and will be used for request cancellation. If
  20. // the context is nil a panic will occur. In the future the SDK may create
  21. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  22. // for more information on using Contexts.
  23. func (c *ECR) WaitUntilImageScanCompleteWithContext(ctx aws.Context, input *DescribeImageScanFindingsInput, opts ...request.WaiterOption) error {
  24. w := request.Waiter{
  25. Name: "WaitUntilImageScanComplete",
  26. MaxAttempts: 60,
  27. Delay: request.ConstantWaiterDelay(5 * time.Second),
  28. Acceptors: []request.WaiterAcceptor{
  29. {
  30. State: request.SuccessWaiterState,
  31. Matcher: request.PathWaiterMatch, Argument: "imageScanStatus.status",
  32. Expected: "COMPLETE",
  33. },
  34. {
  35. State: request.FailureWaiterState,
  36. Matcher: request.PathWaiterMatch, Argument: "imageScanStatus.status",
  37. Expected: "FAILED",
  38. },
  39. },
  40. Logger: c.Config.Logger,
  41. NewRequest: func(opts []request.Option) (*request.Request, error) {
  42. var inCpy *DescribeImageScanFindingsInput
  43. if input != nil {
  44. tmp := *input
  45. inCpy = &tmp
  46. }
  47. req, _ := c.DescribeImageScanFindingsRequest(inCpy)
  48. req.SetContext(ctx)
  49. req.ApplyOptions(opts...)
  50. return req, nil
  51. },
  52. }
  53. w.ApplyOptions(opts...)
  54. return w.WaitWithContext(ctx)
  55. }
  56. // WaitUntilLifecyclePolicyPreviewComplete uses the Amazon ECR API operation
  57. // GetLifecyclePolicyPreview to wait for a condition to be met before returning.
  58. // If the condition is not met within the max attempt window, an error will
  59. // be returned.
  60. func (c *ECR) WaitUntilLifecyclePolicyPreviewComplete(input *GetLifecyclePolicyPreviewInput) error {
  61. return c.WaitUntilLifecyclePolicyPreviewCompleteWithContext(aws.BackgroundContext(), input)
  62. }
  63. // WaitUntilLifecyclePolicyPreviewCompleteWithContext is an extended version of WaitUntilLifecyclePolicyPreviewComplete.
  64. // With the support for passing in a context and options to configure the
  65. // Waiter and the underlying request options.
  66. //
  67. // The context must be non-nil and will be used for request cancellation. If
  68. // the context is nil a panic will occur. In the future the SDK may create
  69. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  70. // for more information on using Contexts.
  71. func (c *ECR) WaitUntilLifecyclePolicyPreviewCompleteWithContext(ctx aws.Context, input *GetLifecyclePolicyPreviewInput, opts ...request.WaiterOption) error {
  72. w := request.Waiter{
  73. Name: "WaitUntilLifecyclePolicyPreviewComplete",
  74. MaxAttempts: 20,
  75. Delay: request.ConstantWaiterDelay(5 * time.Second),
  76. Acceptors: []request.WaiterAcceptor{
  77. {
  78. State: request.SuccessWaiterState,
  79. Matcher: request.PathWaiterMatch, Argument: "status",
  80. Expected: "COMPLETE",
  81. },
  82. {
  83. State: request.FailureWaiterState,
  84. Matcher: request.PathWaiterMatch, Argument: "status",
  85. Expected: "FAILED",
  86. },
  87. },
  88. Logger: c.Config.Logger,
  89. NewRequest: func(opts []request.Option) (*request.Request, error) {
  90. var inCpy *GetLifecyclePolicyPreviewInput
  91. if input != nil {
  92. tmp := *input
  93. inCpy = &tmp
  94. }
  95. req, _ := c.GetLifecyclePolicyPreviewRequest(inCpy)
  96. req.SetContext(ctx)
  97. req.ApplyOptions(opts...)
  98. return req, nil
  99. },
  100. }
  101. w.ApplyOptions(opts...)
  102. return w.WaitWithContext(ctx)
  103. }