github.com/aavshr/aws-sdk-go@v1.41.3/service/ssm/waiters.go (about) 1 // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 3 package ssm 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 // WaitUntilCommandExecuted uses the Amazon SSM API operation 13 // GetCommandInvocation 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 *SSM) WaitUntilCommandExecuted(input *GetCommandInvocationInput) error { 17 return c.WaitUntilCommandExecutedWithContext(aws.BackgroundContext(), input) 18 } 19 20 // WaitUntilCommandExecutedWithContext is an extended version of WaitUntilCommandExecuted. 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 *SSM) WaitUntilCommandExecutedWithContext(ctx aws.Context, input *GetCommandInvocationInput, opts ...request.WaiterOption) error { 29 w := request.Waiter{ 30 Name: "WaitUntilCommandExecuted", 31 MaxAttempts: 20, 32 Delay: request.ConstantWaiterDelay(5 * time.Second), 33 Acceptors: []request.WaiterAcceptor{ 34 { 35 State: request.RetryWaiterState, 36 Matcher: request.PathWaiterMatch, Argument: "Status", 37 Expected: "Pending", 38 }, 39 { 40 State: request.RetryWaiterState, 41 Matcher: request.PathWaiterMatch, Argument: "Status", 42 Expected: "InProgress", 43 }, 44 { 45 State: request.RetryWaiterState, 46 Matcher: request.PathWaiterMatch, Argument: "Status", 47 Expected: "Delayed", 48 }, 49 { 50 State: request.SuccessWaiterState, 51 Matcher: request.PathWaiterMatch, Argument: "Status", 52 Expected: "Success", 53 }, 54 { 55 State: request.FailureWaiterState, 56 Matcher: request.PathWaiterMatch, Argument: "Status", 57 Expected: "Cancelled", 58 }, 59 { 60 State: request.FailureWaiterState, 61 Matcher: request.PathWaiterMatch, Argument: "Status", 62 Expected: "TimedOut", 63 }, 64 { 65 State: request.FailureWaiterState, 66 Matcher: request.PathWaiterMatch, Argument: "Status", 67 Expected: "Failed", 68 }, 69 { 70 State: request.FailureWaiterState, 71 Matcher: request.PathWaiterMatch, Argument: "Status", 72 Expected: "Cancelling", 73 }, 74 { 75 State: request.RetryWaiterState, 76 Matcher: request.ErrorWaiterMatch, 77 Expected: "InvocationDoesNotExist", 78 }, 79 }, 80 Logger: c.Config.Logger, 81 NewRequest: func(opts []request.Option) (*request.Request, error) { 82 var inCpy *GetCommandInvocationInput 83 if input != nil { 84 tmp := *input 85 inCpy = &tmp 86 } 87 req, _ := c.GetCommandInvocationRequest(inCpy) 88 req.SetContext(ctx) 89 req.ApplyOptions(opts...) 90 return req, nil 91 }, 92 } 93 w.ApplyOptions(opts...) 94 95 return w.WaitWithContext(ctx) 96 }