waiters.go 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
  2. package machinelearning
  3. import (
  4. "time"
  5. "github.com/aws/aws-sdk-go/aws"
  6. "github.com/aws/aws-sdk-go/aws/request"
  7. )
  8. // WaitUntilBatchPredictionAvailable uses the Amazon Machine Learning API operation
  9. // DescribeBatchPredictions 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 *MachineLearning) WaitUntilBatchPredictionAvailable(input *DescribeBatchPredictionsInput) error {
  13. return c.WaitUntilBatchPredictionAvailableWithContext(aws.BackgroundContext(), input)
  14. }
  15. // WaitUntilBatchPredictionAvailableWithContext is an extended version of WaitUntilBatchPredictionAvailable.
  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 *MachineLearning) WaitUntilBatchPredictionAvailableWithContext(ctx aws.Context, input *DescribeBatchPredictionsInput, opts ...request.WaiterOption) error {
  24. w := request.Waiter{
  25. Name: "WaitUntilBatchPredictionAvailable",
  26. MaxAttempts: 60,
  27. Delay: request.ConstantWaiterDelay(30 * time.Second),
  28. Acceptors: []request.WaiterAcceptor{
  29. {
  30. State: request.SuccessWaiterState,
  31. Matcher: request.PathAllWaiterMatch, Argument: "Results[].Status",
  32. Expected: "COMPLETED",
  33. },
  34. {
  35. State: request.FailureWaiterState,
  36. Matcher: request.PathAnyWaiterMatch, Argument: "Results[].Status",
  37. Expected: "FAILED",
  38. },
  39. },
  40. Logger: c.Config.Logger,
  41. NewRequest: func(opts []request.Option) (*request.Request, error) {
  42. var inCpy *DescribeBatchPredictionsInput
  43. if input != nil {
  44. tmp := *input
  45. inCpy = &tmp
  46. }
  47. req, _ := c.DescribeBatchPredictionsRequest(inCpy)
  48. req.SetContext(ctx)
  49. req.ApplyOptions(opts...)
  50. return req, nil
  51. },
  52. }
  53. w.ApplyOptions(opts...)
  54. return w.WaitWithContext(ctx)
  55. }
  56. // WaitUntilDataSourceAvailable uses the Amazon Machine Learning API operation
  57. // DescribeDataSources to wait for a condition to be met before returning.
  58. // If the condition is not met within the max attempt window, an error will
  59. // be returned.
  60. func (c *MachineLearning) WaitUntilDataSourceAvailable(input *DescribeDataSourcesInput) error {
  61. return c.WaitUntilDataSourceAvailableWithContext(aws.BackgroundContext(), input)
  62. }
  63. // WaitUntilDataSourceAvailableWithContext is an extended version of WaitUntilDataSourceAvailable.
  64. // With the support for passing in a context and options to configure the
  65. // Waiter and the underlying request options.
  66. //
  67. // The context must be non-nil and will be used for request cancellation. If
  68. // the context is nil a panic will occur. In the future the SDK may create
  69. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  70. // for more information on using Contexts.
  71. func (c *MachineLearning) WaitUntilDataSourceAvailableWithContext(ctx aws.Context, input *DescribeDataSourcesInput, opts ...request.WaiterOption) error {
  72. w := request.Waiter{
  73. Name: "WaitUntilDataSourceAvailable",
  74. MaxAttempts: 60,
  75. Delay: request.ConstantWaiterDelay(30 * time.Second),
  76. Acceptors: []request.WaiterAcceptor{
  77. {
  78. State: request.SuccessWaiterState,
  79. Matcher: request.PathAllWaiterMatch, Argument: "Results[].Status",
  80. Expected: "COMPLETED",
  81. },
  82. {
  83. State: request.FailureWaiterState,
  84. Matcher: request.PathAnyWaiterMatch, Argument: "Results[].Status",
  85. Expected: "FAILED",
  86. },
  87. },
  88. Logger: c.Config.Logger,
  89. NewRequest: func(opts []request.Option) (*request.Request, error) {
  90. var inCpy *DescribeDataSourcesInput
  91. if input != nil {
  92. tmp := *input
  93. inCpy = &tmp
  94. }
  95. req, _ := c.DescribeDataSourcesRequest(inCpy)
  96. req.SetContext(ctx)
  97. req.ApplyOptions(opts...)
  98. return req, nil
  99. },
  100. }
  101. w.ApplyOptions(opts...)
  102. return w.WaitWithContext(ctx)
  103. }
  104. // WaitUntilEvaluationAvailable uses the Amazon Machine Learning API operation
  105. // DescribeEvaluations to wait for a condition to be met before returning.
  106. // If the condition is not met within the max attempt window, an error will
  107. // be returned.
  108. func (c *MachineLearning) WaitUntilEvaluationAvailable(input *DescribeEvaluationsInput) error {
  109. return c.WaitUntilEvaluationAvailableWithContext(aws.BackgroundContext(), input)
  110. }
  111. // WaitUntilEvaluationAvailableWithContext is an extended version of WaitUntilEvaluationAvailable.
  112. // With the support for passing in a context and options to configure the
  113. // Waiter and the underlying request options.
  114. //
  115. // The context must be non-nil and will be used for request cancellation. If
  116. // the context is nil a panic will occur. In the future the SDK may create
  117. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  118. // for more information on using Contexts.
  119. func (c *MachineLearning) WaitUntilEvaluationAvailableWithContext(ctx aws.Context, input *DescribeEvaluationsInput, opts ...request.WaiterOption) error {
  120. w := request.Waiter{
  121. Name: "WaitUntilEvaluationAvailable",
  122. MaxAttempts: 60,
  123. Delay: request.ConstantWaiterDelay(30 * time.Second),
  124. Acceptors: []request.WaiterAcceptor{
  125. {
  126. State: request.SuccessWaiterState,
  127. Matcher: request.PathAllWaiterMatch, Argument: "Results[].Status",
  128. Expected: "COMPLETED",
  129. },
  130. {
  131. State: request.FailureWaiterState,
  132. Matcher: request.PathAnyWaiterMatch, Argument: "Results[].Status",
  133. Expected: "FAILED",
  134. },
  135. },
  136. Logger: c.Config.Logger,
  137. NewRequest: func(opts []request.Option) (*request.Request, error) {
  138. var inCpy *DescribeEvaluationsInput
  139. if input != nil {
  140. tmp := *input
  141. inCpy = &tmp
  142. }
  143. req, _ := c.DescribeEvaluationsRequest(inCpy)
  144. req.SetContext(ctx)
  145. req.ApplyOptions(opts...)
  146. return req, nil
  147. },
  148. }
  149. w.ApplyOptions(opts...)
  150. return w.WaitWithContext(ctx)
  151. }
  152. // WaitUntilMLModelAvailable uses the Amazon Machine Learning API operation
  153. // DescribeMLModels to wait for a condition to be met before returning.
  154. // If the condition is not met within the max attempt window, an error will
  155. // be returned.
  156. func (c *MachineLearning) WaitUntilMLModelAvailable(input *DescribeMLModelsInput) error {
  157. return c.WaitUntilMLModelAvailableWithContext(aws.BackgroundContext(), input)
  158. }
  159. // WaitUntilMLModelAvailableWithContext is an extended version of WaitUntilMLModelAvailable.
  160. // With the support for passing in a context and options to configure the
  161. // Waiter and the underlying request options.
  162. //
  163. // The context must be non-nil and will be used for request cancellation. If
  164. // the context is nil a panic will occur. In the future the SDK may create
  165. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  166. // for more information on using Contexts.
  167. func (c *MachineLearning) WaitUntilMLModelAvailableWithContext(ctx aws.Context, input *DescribeMLModelsInput, opts ...request.WaiterOption) error {
  168. w := request.Waiter{
  169. Name: "WaitUntilMLModelAvailable",
  170. MaxAttempts: 60,
  171. Delay: request.ConstantWaiterDelay(30 * time.Second),
  172. Acceptors: []request.WaiterAcceptor{
  173. {
  174. State: request.SuccessWaiterState,
  175. Matcher: request.PathAllWaiterMatch, Argument: "Results[].Status",
  176. Expected: "COMPLETED",
  177. },
  178. {
  179. State: request.FailureWaiterState,
  180. Matcher: request.PathAnyWaiterMatch, Argument: "Results[].Status",
  181. Expected: "FAILED",
  182. },
  183. },
  184. Logger: c.Config.Logger,
  185. NewRequest: func(opts []request.Option) (*request.Request, error) {
  186. var inCpy *DescribeMLModelsInput
  187. if input != nil {
  188. tmp := *input
  189. inCpy = &tmp
  190. }
  191. req, _ := c.DescribeMLModelsRequest(inCpy)
  192. req.SetContext(ctx)
  193. req.ApplyOptions(opts...)
  194. return req, nil
  195. },
  196. }
  197. w.ApplyOptions(opts...)
  198. return w.WaitWithContext(ctx)
  199. }