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