waiters.go 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package redshift
  3. import (
  4. "github.com/aws/aws-sdk-go/private/waiter"
  5. )
  6. // WaitUntilClusterAvailable uses the Amazon Redshift API operation
  7. // DescribeClusters to wait for a condition to be met before returning.
  8. // If the condition is not meet within the max attempt window an error will
  9. // be returned.
  10. func (c *Redshift) WaitUntilClusterAvailable(input *DescribeClustersInput) error {
  11. waiterCfg := waiter.Config{
  12. Operation: "DescribeClusters",
  13. Delay: 60,
  14. MaxAttempts: 30,
  15. Acceptors: []waiter.WaitAcceptor{
  16. {
  17. State: "success",
  18. Matcher: "pathAll",
  19. Argument: "Clusters[].ClusterStatus",
  20. Expected: "available",
  21. },
  22. {
  23. State: "failure",
  24. Matcher: "pathAny",
  25. Argument: "Clusters[].ClusterStatus",
  26. Expected: "deleting",
  27. },
  28. {
  29. State: "retry",
  30. Matcher: "error",
  31. Argument: "",
  32. Expected: "ClusterNotFound",
  33. },
  34. },
  35. }
  36. w := waiter.Waiter{
  37. Client: c,
  38. Input: input,
  39. Config: waiterCfg,
  40. }
  41. return w.Wait()
  42. }
  43. // WaitUntilClusterDeleted uses the Amazon Redshift API operation
  44. // DescribeClusters to wait for a condition to be met before returning.
  45. // If the condition is not meet within the max attempt window an error will
  46. // be returned.
  47. func (c *Redshift) WaitUntilClusterDeleted(input *DescribeClustersInput) error {
  48. waiterCfg := waiter.Config{
  49. Operation: "DescribeClusters",
  50. Delay: 60,
  51. MaxAttempts: 30,
  52. Acceptors: []waiter.WaitAcceptor{
  53. {
  54. State: "success",
  55. Matcher: "error",
  56. Argument: "",
  57. Expected: "ClusterNotFound",
  58. },
  59. {
  60. State: "failure",
  61. Matcher: "pathAny",
  62. Argument: "Clusters[].ClusterStatus",
  63. Expected: "creating",
  64. },
  65. {
  66. State: "failure",
  67. Matcher: "pathAny",
  68. Argument: "Clusters[].ClusterStatus",
  69. Expected: "modifying",
  70. },
  71. },
  72. }
  73. w := waiter.Waiter{
  74. Client: c,
  75. Input: input,
  76. Config: waiterCfg,
  77. }
  78. return w.Wait()
  79. }
  80. // WaitUntilClusterRestored uses the Amazon Redshift API operation
  81. // DescribeClusters to wait for a condition to be met before returning.
  82. // If the condition is not meet within the max attempt window an error will
  83. // be returned.
  84. func (c *Redshift) WaitUntilClusterRestored(input *DescribeClustersInput) error {
  85. waiterCfg := waiter.Config{
  86. Operation: "DescribeClusters",
  87. Delay: 60,
  88. MaxAttempts: 30,
  89. Acceptors: []waiter.WaitAcceptor{
  90. {
  91. State: "success",
  92. Matcher: "pathAll",
  93. Argument: "Clusters[].RestoreStatus.Status",
  94. Expected: "completed",
  95. },
  96. {
  97. State: "failure",
  98. Matcher: "pathAny",
  99. Argument: "Clusters[].ClusterStatus",
  100. Expected: "deleting",
  101. },
  102. },
  103. }
  104. w := waiter.Waiter{
  105. Client: c,
  106. Input: input,
  107. Config: waiterCfg,
  108. }
  109. return w.Wait()
  110. }
  111. // WaitUntilSnapshotAvailable uses the Amazon Redshift API operation
  112. // DescribeClusterSnapshots to wait for a condition to be met before returning.
  113. // If the condition is not meet within the max attempt window an error will
  114. // be returned.
  115. func (c *Redshift) WaitUntilSnapshotAvailable(input *DescribeClusterSnapshotsInput) error {
  116. waiterCfg := waiter.Config{
  117. Operation: "DescribeClusterSnapshots",
  118. Delay: 15,
  119. MaxAttempts: 20,
  120. Acceptors: []waiter.WaitAcceptor{
  121. {
  122. State: "success",
  123. Matcher: "pathAll",
  124. Argument: "Snapshots[].Status",
  125. Expected: "available",
  126. },
  127. {
  128. State: "failure",
  129. Matcher: "pathAny",
  130. Argument: "Snapshots[].Status",
  131. Expected: "failed",
  132. },
  133. {
  134. State: "failure",
  135. Matcher: "pathAny",
  136. Argument: "Snapshots[].Status",
  137. Expected: "deleted",
  138. },
  139. },
  140. }
  141. w := waiter.Waiter{
  142. Client: c,
  143. Input: input,
  144. Config: waiterCfg,
  145. }
  146. return w.Wait()
  147. }