waiters.go 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
  2. package elbv2
  3. import (
  4. "time"
  5. "github.com/aws/aws-sdk-go/aws"
  6. "github.com/aws/aws-sdk-go/aws/request"
  7. )
  8. // WaitUntilLoadBalancerAvailable uses the Elastic Load Balancing v2 API operation
  9. // DescribeLoadBalancers 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 *ELBV2) WaitUntilLoadBalancerAvailable(input *DescribeLoadBalancersInput) error {
  13. return c.WaitUntilLoadBalancerAvailableWithContext(aws.BackgroundContext(), input)
  14. }
  15. // WaitUntilLoadBalancerAvailableWithContext is an extended version of WaitUntilLoadBalancerAvailable.
  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 *ELBV2) WaitUntilLoadBalancerAvailableWithContext(ctx aws.Context, input *DescribeLoadBalancersInput, opts ...request.WaiterOption) error {
  24. w := request.Waiter{
  25. Name: "WaitUntilLoadBalancerAvailable",
  26. MaxAttempts: 40,
  27. Delay: request.ConstantWaiterDelay(15 * time.Second),
  28. Acceptors: []request.WaiterAcceptor{
  29. {
  30. State: request.SuccessWaiterState,
  31. Matcher: request.PathAllWaiterMatch, Argument: "LoadBalancers[].State.Code",
  32. Expected: "active",
  33. },
  34. {
  35. State: request.RetryWaiterState,
  36. Matcher: request.PathAnyWaiterMatch, Argument: "LoadBalancers[].State.Code",
  37. Expected: "provisioning",
  38. },
  39. {
  40. State: request.RetryWaiterState,
  41. Matcher: request.ErrorWaiterMatch,
  42. Expected: "LoadBalancerNotFound",
  43. },
  44. },
  45. Logger: c.Config.Logger,
  46. NewRequest: func(opts []request.Option) (*request.Request, error) {
  47. var inCpy *DescribeLoadBalancersInput
  48. if input != nil {
  49. tmp := *input
  50. inCpy = &tmp
  51. }
  52. req, _ := c.DescribeLoadBalancersRequest(inCpy)
  53. req.SetContext(ctx)
  54. req.ApplyOptions(opts...)
  55. return req, nil
  56. },
  57. }
  58. w.ApplyOptions(opts...)
  59. return w.WaitWithContext(ctx)
  60. }
  61. // WaitUntilLoadBalancerExists uses the Elastic Load Balancing v2 API operation
  62. // DescribeLoadBalancers to wait for a condition to be met before returning.
  63. // If the condition is not met within the max attempt window, an error will
  64. // be returned.
  65. func (c *ELBV2) WaitUntilLoadBalancerExists(input *DescribeLoadBalancersInput) error {
  66. return c.WaitUntilLoadBalancerExistsWithContext(aws.BackgroundContext(), input)
  67. }
  68. // WaitUntilLoadBalancerExistsWithContext is an extended version of WaitUntilLoadBalancerExists.
  69. // With the support for passing in a context and options to configure the
  70. // Waiter and the underlying request options.
  71. //
  72. // The context must be non-nil and will be used for request cancellation. If
  73. // the context is nil a panic will occur. In the future the SDK may create
  74. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  75. // for more information on using Contexts.
  76. func (c *ELBV2) WaitUntilLoadBalancerExistsWithContext(ctx aws.Context, input *DescribeLoadBalancersInput, opts ...request.WaiterOption) error {
  77. w := request.Waiter{
  78. Name: "WaitUntilLoadBalancerExists",
  79. MaxAttempts: 40,
  80. Delay: request.ConstantWaiterDelay(15 * time.Second),
  81. Acceptors: []request.WaiterAcceptor{
  82. {
  83. State: request.SuccessWaiterState,
  84. Matcher: request.StatusWaiterMatch,
  85. Expected: 200,
  86. },
  87. {
  88. State: request.RetryWaiterState,
  89. Matcher: request.ErrorWaiterMatch,
  90. Expected: "LoadBalancerNotFound",
  91. },
  92. },
  93. Logger: c.Config.Logger,
  94. NewRequest: func(opts []request.Option) (*request.Request, error) {
  95. var inCpy *DescribeLoadBalancersInput
  96. if input != nil {
  97. tmp := *input
  98. inCpy = &tmp
  99. }
  100. req, _ := c.DescribeLoadBalancersRequest(inCpy)
  101. req.SetContext(ctx)
  102. req.ApplyOptions(opts...)
  103. return req, nil
  104. },
  105. }
  106. w.ApplyOptions(opts...)
  107. return w.WaitWithContext(ctx)
  108. }
  109. // WaitUntilLoadBalancersDeleted uses the Elastic Load Balancing v2 API operation
  110. // DescribeLoadBalancers to wait for a condition to be met before returning.
  111. // If the condition is not met within the max attempt window, an error will
  112. // be returned.
  113. func (c *ELBV2) WaitUntilLoadBalancersDeleted(input *DescribeLoadBalancersInput) error {
  114. return c.WaitUntilLoadBalancersDeletedWithContext(aws.BackgroundContext(), input)
  115. }
  116. // WaitUntilLoadBalancersDeletedWithContext is an extended version of WaitUntilLoadBalancersDeleted.
  117. // With the support for passing in a context and options to configure the
  118. // Waiter and the underlying request options.
  119. //
  120. // The context must be non-nil and will be used for request cancellation. If
  121. // the context is nil a panic will occur. In the future the SDK may create
  122. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  123. // for more information on using Contexts.
  124. func (c *ELBV2) WaitUntilLoadBalancersDeletedWithContext(ctx aws.Context, input *DescribeLoadBalancersInput, opts ...request.WaiterOption) error {
  125. w := request.Waiter{
  126. Name: "WaitUntilLoadBalancersDeleted",
  127. MaxAttempts: 40,
  128. Delay: request.ConstantWaiterDelay(15 * time.Second),
  129. Acceptors: []request.WaiterAcceptor{
  130. {
  131. State: request.RetryWaiterState,
  132. Matcher: request.PathAllWaiterMatch, Argument: "LoadBalancers[].State.Code",
  133. Expected: "active",
  134. },
  135. {
  136. State: request.SuccessWaiterState,
  137. Matcher: request.ErrorWaiterMatch,
  138. Expected: "LoadBalancerNotFound",
  139. },
  140. },
  141. Logger: c.Config.Logger,
  142. NewRequest: func(opts []request.Option) (*request.Request, error) {
  143. var inCpy *DescribeLoadBalancersInput
  144. if input != nil {
  145. tmp := *input
  146. inCpy = &tmp
  147. }
  148. req, _ := c.DescribeLoadBalancersRequest(inCpy)
  149. req.SetContext(ctx)
  150. req.ApplyOptions(opts...)
  151. return req, nil
  152. },
  153. }
  154. w.ApplyOptions(opts...)
  155. return w.WaitWithContext(ctx)
  156. }
  157. // WaitUntilTargetDeregistered uses the Elastic Load Balancing v2 API operation
  158. // DescribeTargetHealth to wait for a condition to be met before returning.
  159. // If the condition is not met within the max attempt window, an error will
  160. // be returned.
  161. func (c *ELBV2) WaitUntilTargetDeregistered(input *DescribeTargetHealthInput) error {
  162. return c.WaitUntilTargetDeregisteredWithContext(aws.BackgroundContext(), input)
  163. }
  164. // WaitUntilTargetDeregisteredWithContext is an extended version of WaitUntilTargetDeregistered.
  165. // With the support for passing in a context and options to configure the
  166. // Waiter and the underlying request options.
  167. //
  168. // The context must be non-nil and will be used for request cancellation. If
  169. // the context is nil a panic will occur. In the future the SDK may create
  170. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  171. // for more information on using Contexts.
  172. func (c *ELBV2) WaitUntilTargetDeregisteredWithContext(ctx aws.Context, input *DescribeTargetHealthInput, opts ...request.WaiterOption) error {
  173. w := request.Waiter{
  174. Name: "WaitUntilTargetDeregistered",
  175. MaxAttempts: 40,
  176. Delay: request.ConstantWaiterDelay(15 * time.Second),
  177. Acceptors: []request.WaiterAcceptor{
  178. {
  179. State: request.SuccessWaiterState,
  180. Matcher: request.ErrorWaiterMatch,
  181. Expected: "InvalidTarget",
  182. },
  183. {
  184. State: request.SuccessWaiterState,
  185. Matcher: request.PathAllWaiterMatch, Argument: "TargetHealthDescriptions[].TargetHealth.State",
  186. Expected: "unused",
  187. },
  188. },
  189. Logger: c.Config.Logger,
  190. NewRequest: func(opts []request.Option) (*request.Request, error) {
  191. var inCpy *DescribeTargetHealthInput
  192. if input != nil {
  193. tmp := *input
  194. inCpy = &tmp
  195. }
  196. req, _ := c.DescribeTargetHealthRequest(inCpy)
  197. req.SetContext(ctx)
  198. req.ApplyOptions(opts...)
  199. return req, nil
  200. },
  201. }
  202. w.ApplyOptions(opts...)
  203. return w.WaitWithContext(ctx)
  204. }
  205. // WaitUntilTargetInService uses the Elastic Load Balancing v2 API operation
  206. // DescribeTargetHealth to wait for a condition to be met before returning.
  207. // If the condition is not met within the max attempt window, an error will
  208. // be returned.
  209. func (c *ELBV2) WaitUntilTargetInService(input *DescribeTargetHealthInput) error {
  210. return c.WaitUntilTargetInServiceWithContext(aws.BackgroundContext(), input)
  211. }
  212. // WaitUntilTargetInServiceWithContext is an extended version of WaitUntilTargetInService.
  213. // With the support for passing in a context and options to configure the
  214. // Waiter and the underlying request options.
  215. //
  216. // The context must be non-nil and will be used for request cancellation. If
  217. // the context is nil a panic will occur. In the future the SDK may create
  218. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  219. // for more information on using Contexts.
  220. func (c *ELBV2) WaitUntilTargetInServiceWithContext(ctx aws.Context, input *DescribeTargetHealthInput, opts ...request.WaiterOption) error {
  221. w := request.Waiter{
  222. Name: "WaitUntilTargetInService",
  223. MaxAttempts: 40,
  224. Delay: request.ConstantWaiterDelay(15 * time.Second),
  225. Acceptors: []request.WaiterAcceptor{
  226. {
  227. State: request.SuccessWaiterState,
  228. Matcher: request.PathAllWaiterMatch, Argument: "TargetHealthDescriptions[].TargetHealth.State",
  229. Expected: "healthy",
  230. },
  231. {
  232. State: request.RetryWaiterState,
  233. Matcher: request.ErrorWaiterMatch,
  234. Expected: "InvalidInstance",
  235. },
  236. },
  237. Logger: c.Config.Logger,
  238. NewRequest: func(opts []request.Option) (*request.Request, error) {
  239. var inCpy *DescribeTargetHealthInput
  240. if input != nil {
  241. tmp := *input
  242. inCpy = &tmp
  243. }
  244. req, _ := c.DescribeTargetHealthRequest(inCpy)
  245. req.SetContext(ctx)
  246. req.ApplyOptions(opts...)
  247. return req, nil
  248. },
  249. }
  250. w.ApplyOptions(opts...)
  251. return w.WaitWithContext(ctx)
  252. }