github.com/aavshr/aws-sdk-go@v1.41.3/service/codedeploy/waiters.go (about) 1 // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 3 package codedeploy 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 // WaitUntilDeploymentSuccessful uses the CodeDeploy API operation 13 // GetDeployment 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 *CodeDeploy) WaitUntilDeploymentSuccessful(input *GetDeploymentInput) error { 17 return c.WaitUntilDeploymentSuccessfulWithContext(aws.BackgroundContext(), input) 18 } 19 20 // WaitUntilDeploymentSuccessfulWithContext is an extended version of WaitUntilDeploymentSuccessful. 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 *CodeDeploy) WaitUntilDeploymentSuccessfulWithContext(ctx aws.Context, input *GetDeploymentInput, opts ...request.WaiterOption) error { 29 w := request.Waiter{ 30 Name: "WaitUntilDeploymentSuccessful", 31 MaxAttempts: 120, 32 Delay: request.ConstantWaiterDelay(15 * time.Second), 33 Acceptors: []request.WaiterAcceptor{ 34 { 35 State: request.SuccessWaiterState, 36 Matcher: request.PathWaiterMatch, Argument: "deploymentInfo.status", 37 Expected: "Succeeded", 38 }, 39 { 40 State: request.FailureWaiterState, 41 Matcher: request.PathWaiterMatch, Argument: "deploymentInfo.status", 42 Expected: "Failed", 43 }, 44 { 45 State: request.FailureWaiterState, 46 Matcher: request.PathWaiterMatch, Argument: "deploymentInfo.status", 47 Expected: "Stopped", 48 }, 49 }, 50 Logger: c.Config.Logger, 51 NewRequest: func(opts []request.Option) (*request.Request, error) { 52 var inCpy *GetDeploymentInput 53 if input != nil { 54 tmp := *input 55 inCpy = &tmp 56 } 57 req, _ := c.GetDeploymentRequest(inCpy) 58 req.SetContext(ctx) 59 req.ApplyOptions(opts...) 60 return req, nil 61 }, 62 } 63 w.ApplyOptions(opts...) 64 65 return w.WaitWithContext(ctx) 66 }