waiters.go 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package ecs
  3. import (
  4. "github.com/aws/aws-sdk-go/private/waiter"
  5. )
  6. // WaitUntilServicesInactive uses the Amazon ECS API operation
  7. // DescribeServices 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 *ECS) WaitUntilServicesInactive(input *DescribeServicesInput) error {
  11. waiterCfg := waiter.Config{
  12. Operation: "DescribeServices",
  13. Delay: 15,
  14. MaxAttempts: 40,
  15. Acceptors: []waiter.WaitAcceptor{
  16. {
  17. State: "failure",
  18. Matcher: "pathAny",
  19. Argument: "failures[].reason",
  20. Expected: "MISSING",
  21. },
  22. {
  23. State: "success",
  24. Matcher: "pathAny",
  25. Argument: "services[].status",
  26. Expected: "INACTIVE",
  27. },
  28. },
  29. }
  30. w := waiter.Waiter{
  31. Client: c,
  32. Input: input,
  33. Config: waiterCfg,
  34. }
  35. return w.Wait()
  36. }
  37. // WaitUntilServicesStable uses the Amazon ECS API operation
  38. // DescribeServices to wait for a condition to be met before returning.
  39. // If the condition is not meet within the max attempt window an error will
  40. // be returned.
  41. func (c *ECS) WaitUntilServicesStable(input *DescribeServicesInput) error {
  42. waiterCfg := waiter.Config{
  43. Operation: "DescribeServices",
  44. Delay: 15,
  45. MaxAttempts: 40,
  46. Acceptors: []waiter.WaitAcceptor{
  47. {
  48. State: "failure",
  49. Matcher: "pathAny",
  50. Argument: "failures[].reason",
  51. Expected: "MISSING",
  52. },
  53. {
  54. State: "failure",
  55. Matcher: "pathAny",
  56. Argument: "services[].status",
  57. Expected: "DRAINING",
  58. },
  59. {
  60. State: "failure",
  61. Matcher: "pathAny",
  62. Argument: "services[].status",
  63. Expected: "INACTIVE",
  64. },
  65. {
  66. State: "success",
  67. Matcher: "path",
  68. Argument: "length(services[?!(length(deployments) == `1` && runningCount == desiredCount)]) == `0`",
  69. Expected: true,
  70. },
  71. },
  72. }
  73. w := waiter.Waiter{
  74. Client: c,
  75. Input: input,
  76. Config: waiterCfg,
  77. }
  78. return w.Wait()
  79. }
  80. // WaitUntilTasksRunning uses the Amazon ECS API operation
  81. // DescribeTasks 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 *ECS) WaitUntilTasksRunning(input *DescribeTasksInput) error {
  85. waiterCfg := waiter.Config{
  86. Operation: "DescribeTasks",
  87. Delay: 6,
  88. MaxAttempts: 100,
  89. Acceptors: []waiter.WaitAcceptor{
  90. {
  91. State: "failure",
  92. Matcher: "pathAny",
  93. Argument: "tasks[].lastStatus",
  94. Expected: "STOPPED",
  95. },
  96. {
  97. State: "failure",
  98. Matcher: "pathAny",
  99. Argument: "failures[].reason",
  100. Expected: "MISSING",
  101. },
  102. {
  103. State: "success",
  104. Matcher: "pathAll",
  105. Argument: "tasks[].lastStatus",
  106. Expected: "RUNNING",
  107. },
  108. },
  109. }
  110. w := waiter.Waiter{
  111. Client: c,
  112. Input: input,
  113. Config: waiterCfg,
  114. }
  115. return w.Wait()
  116. }
  117. // WaitUntilTasksStopped uses the Amazon ECS API operation
  118. // DescribeTasks to wait for a condition to be met before returning.
  119. // If the condition is not meet within the max attempt window an error will
  120. // be returned.
  121. func (c *ECS) WaitUntilTasksStopped(input *DescribeTasksInput) error {
  122. waiterCfg := waiter.Config{
  123. Operation: "DescribeTasks",
  124. Delay: 6,
  125. MaxAttempts: 100,
  126. Acceptors: []waiter.WaitAcceptor{
  127. {
  128. State: "success",
  129. Matcher: "pathAll",
  130. Argument: "tasks[].lastStatus",
  131. Expected: "STOPPED",
  132. },
  133. },
  134. }
  135. w := waiter.Waiter{
  136. Client: c,
  137. Input: input,
  138. Config: waiterCfg,
  139. }
  140. return w.Wait()
  141. }