waiters.go 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
  2. package elb
  3. import (
  4. "time"
  5. "github.com/aws/aws-sdk-go/aws"
  6. "github.com/aws/aws-sdk-go/aws/request"
  7. )
  8. // WaitUntilAnyInstanceInService uses the Elastic Load Balancing API operation
  9. // DescribeInstanceHealth 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 *ELB) WaitUntilAnyInstanceInService(input *DescribeInstanceHealthInput) error {
  13. return c.WaitUntilAnyInstanceInServiceWithContext(aws.BackgroundContext(), input)
  14. }
  15. // WaitUntilAnyInstanceInServiceWithContext is an extended version of WaitUntilAnyInstanceInService.
  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 *ELB) WaitUntilAnyInstanceInServiceWithContext(ctx aws.Context, input *DescribeInstanceHealthInput, opts ...request.WaiterOption) error {
  24. w := request.Waiter{
  25. Name: "WaitUntilAnyInstanceInService",
  26. MaxAttempts: 40,
  27. Delay: request.ConstantWaiterDelay(15 * time.Second),
  28. Acceptors: []request.WaiterAcceptor{
  29. {
  30. State: request.SuccessWaiterState,
  31. Matcher: request.PathAnyWaiterMatch, Argument: "InstanceStates[].State",
  32. Expected: "InService",
  33. },
  34. },
  35. Logger: c.Config.Logger,
  36. NewRequest: func(opts []request.Option) (*request.Request, error) {
  37. var inCpy *DescribeInstanceHealthInput
  38. if input != nil {
  39. tmp := *input
  40. inCpy = &tmp
  41. }
  42. req, _ := c.DescribeInstanceHealthRequest(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. // WaitUntilInstanceDeregistered uses the Elastic Load Balancing API operation
  52. // DescribeInstanceHealth 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 *ELB) WaitUntilInstanceDeregistered(input *DescribeInstanceHealthInput) error {
  56. return c.WaitUntilInstanceDeregisteredWithContext(aws.BackgroundContext(), input)
  57. }
  58. // WaitUntilInstanceDeregisteredWithContext is an extended version of WaitUntilInstanceDeregistered.
  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 *ELB) WaitUntilInstanceDeregisteredWithContext(ctx aws.Context, input *DescribeInstanceHealthInput, opts ...request.WaiterOption) error {
  67. w := request.Waiter{
  68. Name: "WaitUntilInstanceDeregistered",
  69. MaxAttempts: 40,
  70. Delay: request.ConstantWaiterDelay(15 * time.Second),
  71. Acceptors: []request.WaiterAcceptor{
  72. {
  73. State: request.SuccessWaiterState,
  74. Matcher: request.PathAllWaiterMatch, Argument: "InstanceStates[].State",
  75. Expected: "OutOfService",
  76. },
  77. {
  78. State: request.SuccessWaiterState,
  79. Matcher: request.ErrorWaiterMatch,
  80. Expected: "InvalidInstance",
  81. },
  82. },
  83. Logger: c.Config.Logger,
  84. NewRequest: func(opts []request.Option) (*request.Request, error) {
  85. var inCpy *DescribeInstanceHealthInput
  86. if input != nil {
  87. tmp := *input
  88. inCpy = &tmp
  89. }
  90. req, _ := c.DescribeInstanceHealthRequest(inCpy)
  91. req.SetContext(ctx)
  92. req.ApplyOptions(opts...)
  93. return req, nil
  94. },
  95. }
  96. w.ApplyOptions(opts...)
  97. return w.WaitWithContext(ctx)
  98. }
  99. // WaitUntilInstanceInService uses the Elastic Load Balancing API operation
  100. // DescribeInstanceHealth to wait for a condition to be met before returning.
  101. // If the condition is not met within the max attempt window, an error will
  102. // be returned.
  103. func (c *ELB) WaitUntilInstanceInService(input *DescribeInstanceHealthInput) error {
  104. return c.WaitUntilInstanceInServiceWithContext(aws.BackgroundContext(), input)
  105. }
  106. // WaitUntilInstanceInServiceWithContext is an extended version of WaitUntilInstanceInService.
  107. // With the support for passing in a context and options to configure the
  108. // Waiter and the underlying request options.
  109. //
  110. // The context must be non-nil and will be used for request cancellation. If
  111. // the context is nil a panic will occur. In the future the SDK may create
  112. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  113. // for more information on using Contexts.
  114. func (c *ELB) WaitUntilInstanceInServiceWithContext(ctx aws.Context, input *DescribeInstanceHealthInput, opts ...request.WaiterOption) error {
  115. w := request.Waiter{
  116. Name: "WaitUntilInstanceInService",
  117. MaxAttempts: 40,
  118. Delay: request.ConstantWaiterDelay(15 * time.Second),
  119. Acceptors: []request.WaiterAcceptor{
  120. {
  121. State: request.SuccessWaiterState,
  122. Matcher: request.PathAllWaiterMatch, Argument: "InstanceStates[].State",
  123. Expected: "InService",
  124. },
  125. {
  126. State: request.RetryWaiterState,
  127. Matcher: request.ErrorWaiterMatch,
  128. Expected: "InvalidInstance",
  129. },
  130. },
  131. Logger: c.Config.Logger,
  132. NewRequest: func(opts []request.Option) (*request.Request, error) {
  133. var inCpy *DescribeInstanceHealthInput
  134. if input != nil {
  135. tmp := *input
  136. inCpy = &tmp
  137. }
  138. req, _ := c.DescribeInstanceHealthRequest(inCpy)
  139. req.SetContext(ctx)
  140. req.ApplyOptions(opts...)
  141. return req, nil
  142. },
  143. }
  144. w.ApplyOptions(opts...)
  145. return w.WaitWithContext(ctx)
  146. }