waiters.go 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
  2. package cloudfront
  3. import (
  4. "time"
  5. "github.com/aws/aws-sdk-go/aws"
  6. "github.com/aws/aws-sdk-go/aws/request"
  7. )
  8. // WaitUntilDistributionDeployed uses the CloudFront API operation
  9. // GetDistribution 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 *CloudFront) WaitUntilDistributionDeployed(input *GetDistributionInput) error {
  13. return c.WaitUntilDistributionDeployedWithContext(aws.BackgroundContext(), input)
  14. }
  15. // WaitUntilDistributionDeployedWithContext is an extended version of WaitUntilDistributionDeployed.
  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 *CloudFront) WaitUntilDistributionDeployedWithContext(ctx aws.Context, input *GetDistributionInput, opts ...request.WaiterOption) error {
  24. w := request.Waiter{
  25. Name: "WaitUntilDistributionDeployed",
  26. MaxAttempts: 25,
  27. Delay: request.ConstantWaiterDelay(60 * time.Second),
  28. Acceptors: []request.WaiterAcceptor{
  29. {
  30. State: request.SuccessWaiterState,
  31. Matcher: request.PathWaiterMatch, Argument: "Distribution.Status",
  32. Expected: "Deployed",
  33. },
  34. },
  35. Logger: c.Config.Logger,
  36. NewRequest: func(opts []request.Option) (*request.Request, error) {
  37. var inCpy *GetDistributionInput
  38. if input != nil {
  39. tmp := *input
  40. inCpy = &tmp
  41. }
  42. req, _ := c.GetDistributionRequest(inCpy)
  43. req.SetContext(ctx)
  44. req.ApplyOptions(opts...)
  45. return req, nil
  46. },
  47. }
  48. w.ApplyOptions(opts...)
  49. return w.WaitWithContext(ctx)
  50. }
  51. // WaitUntilInvalidationCompleted uses the CloudFront API operation
  52. // GetInvalidation to wait for a condition to be met before returning.
  53. // If the condition is not met within the max attempt window, an error will
  54. // be returned.
  55. func (c *CloudFront) WaitUntilInvalidationCompleted(input *GetInvalidationInput) error {
  56. return c.WaitUntilInvalidationCompletedWithContext(aws.BackgroundContext(), input)
  57. }
  58. // WaitUntilInvalidationCompletedWithContext is an extended version of WaitUntilInvalidationCompleted.
  59. // With the support for passing in a context and options to configure the
  60. // Waiter and the underlying request options.
  61. //
  62. // The context must be non-nil and will be used for request cancellation. If
  63. // the context is nil a panic will occur. In the future the SDK may create
  64. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  65. // for more information on using Contexts.
  66. func (c *CloudFront) WaitUntilInvalidationCompletedWithContext(ctx aws.Context, input *GetInvalidationInput, opts ...request.WaiterOption) error {
  67. w := request.Waiter{
  68. Name: "WaitUntilInvalidationCompleted",
  69. MaxAttempts: 30,
  70. Delay: request.ConstantWaiterDelay(20 * time.Second),
  71. Acceptors: []request.WaiterAcceptor{
  72. {
  73. State: request.SuccessWaiterState,
  74. Matcher: request.PathWaiterMatch, Argument: "Invalidation.Status",
  75. Expected: "Completed",
  76. },
  77. },
  78. Logger: c.Config.Logger,
  79. NewRequest: func(opts []request.Option) (*request.Request, error) {
  80. var inCpy *GetInvalidationInput
  81. if input != nil {
  82. tmp := *input
  83. inCpy = &tmp
  84. }
  85. req, _ := c.GetInvalidationRequest(inCpy)
  86. req.SetContext(ctx)
  87. req.ApplyOptions(opts...)
  88. return req, nil
  89. },
  90. }
  91. w.ApplyOptions(opts...)
  92. return w.WaitWithContext(ctx)
  93. }
  94. // WaitUntilStreamingDistributionDeployed uses the CloudFront API operation
  95. // GetStreamingDistribution to wait for a condition to be met before returning.
  96. // If the condition is not met within the max attempt window, an error will
  97. // be returned.
  98. func (c *CloudFront) WaitUntilStreamingDistributionDeployed(input *GetStreamingDistributionInput) error {
  99. return c.WaitUntilStreamingDistributionDeployedWithContext(aws.BackgroundContext(), input)
  100. }
  101. // WaitUntilStreamingDistributionDeployedWithContext is an extended version of WaitUntilStreamingDistributionDeployed.
  102. // With the support for passing in a context and options to configure the
  103. // Waiter and the underlying request options.
  104. //
  105. // The context must be non-nil and will be used for request cancellation. If
  106. // the context is nil a panic will occur. In the future the SDK may create
  107. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  108. // for more information on using Contexts.
  109. func (c *CloudFront) WaitUntilStreamingDistributionDeployedWithContext(ctx aws.Context, input *GetStreamingDistributionInput, opts ...request.WaiterOption) error {
  110. w := request.Waiter{
  111. Name: "WaitUntilStreamingDistributionDeployed",
  112. MaxAttempts: 25,
  113. Delay: request.ConstantWaiterDelay(60 * time.Second),
  114. Acceptors: []request.WaiterAcceptor{
  115. {
  116. State: request.SuccessWaiterState,
  117. Matcher: request.PathWaiterMatch, Argument: "StreamingDistribution.Status",
  118. Expected: "Deployed",
  119. },
  120. },
  121. Logger: c.Config.Logger,
  122. NewRequest: func(opts []request.Option) (*request.Request, error) {
  123. var inCpy *GetStreamingDistributionInput
  124. if input != nil {
  125. tmp := *input
  126. inCpy = &tmp
  127. }
  128. req, _ := c.GetStreamingDistributionRequest(inCpy)
  129. req.SetContext(ctx)
  130. req.ApplyOptions(opts...)
  131. return req, nil
  132. },
  133. }
  134. w.ApplyOptions(opts...)
  135. return w.WaitWithContext(ctx)
  136. }