github.com/aavshr/aws-sdk-go@v1.41.3/service/ssmincidents/waiters.go (about) 1 // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 3 package ssmincidents 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 // WaitUntilWaitForReplicationSetActive uses the SSM Incidents API operation 13 // GetReplicationSet 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 *SSMIncidents) WaitUntilWaitForReplicationSetActive(input *GetReplicationSetInput) error { 17 return c.WaitUntilWaitForReplicationSetActiveWithContext(aws.BackgroundContext(), input) 18 } 19 20 // WaitUntilWaitForReplicationSetActiveWithContext is an extended version of WaitUntilWaitForReplicationSetActive. 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 *SSMIncidents) WaitUntilWaitForReplicationSetActiveWithContext(ctx aws.Context, input *GetReplicationSetInput, opts ...request.WaiterOption) error { 29 w := request.Waiter{ 30 Name: "WaitUntilWaitForReplicationSetActive", 31 MaxAttempts: 5, 32 Delay: request.ConstantWaiterDelay(30 * time.Second), 33 Acceptors: []request.WaiterAcceptor{ 34 { 35 State: request.SuccessWaiterState, 36 Matcher: request.PathWaiterMatch, Argument: "replicationSet.status", 37 Expected: "ACTIVE", 38 }, 39 { 40 State: request.RetryWaiterState, 41 Matcher: request.PathWaiterMatch, Argument: "replicationSet.status", 42 Expected: "CREATING", 43 }, 44 { 45 State: request.RetryWaiterState, 46 Matcher: request.PathWaiterMatch, Argument: "replicationSet.status", 47 Expected: "UPDATING", 48 }, 49 { 50 State: request.FailureWaiterState, 51 Matcher: request.PathWaiterMatch, Argument: "replicationSet.status", 52 Expected: "FAILED", 53 }, 54 }, 55 Logger: c.Config.Logger, 56 NewRequest: func(opts []request.Option) (*request.Request, error) { 57 var inCpy *GetReplicationSetInput 58 if input != nil { 59 tmp := *input 60 inCpy = &tmp 61 } 62 req, _ := c.GetReplicationSetRequest(inCpy) 63 req.SetContext(ctx) 64 req.ApplyOptions(opts...) 65 return req, nil 66 }, 67 } 68 w.ApplyOptions(opts...) 69 70 return w.WaitWithContext(ctx) 71 } 72 73 // WaitUntilWaitForReplicationSetDeleted uses the SSM Incidents API operation 74 // GetReplicationSet to wait for a condition to be met before returning. 75 // If the condition is not met within the max attempt window, an error will 76 // be returned. 77 func (c *SSMIncidents) WaitUntilWaitForReplicationSetDeleted(input *GetReplicationSetInput) error { 78 return c.WaitUntilWaitForReplicationSetDeletedWithContext(aws.BackgroundContext(), input) 79 } 80 81 // WaitUntilWaitForReplicationSetDeletedWithContext is an extended version of WaitUntilWaitForReplicationSetDeleted. 82 // With the support for passing in a context and options to configure the 83 // Waiter and the underlying request options. 84 // 85 // The context must be non-nil and will be used for request cancellation. If 86 // the context is nil a panic will occur. In the future the SDK may create 87 // sub-contexts for http.Requests. See https://golang.org/pkg/context/ 88 // for more information on using Contexts. 89 func (c *SSMIncidents) WaitUntilWaitForReplicationSetDeletedWithContext(ctx aws.Context, input *GetReplicationSetInput, opts ...request.WaiterOption) error { 90 w := request.Waiter{ 91 Name: "WaitUntilWaitForReplicationSetDeleted", 92 MaxAttempts: 5, 93 Delay: request.ConstantWaiterDelay(30 * time.Second), 94 Acceptors: []request.WaiterAcceptor{ 95 { 96 State: request.SuccessWaiterState, 97 Matcher: request.ErrorWaiterMatch, 98 Expected: "ResourceNotFoundException", 99 }, 100 { 101 State: request.RetryWaiterState, 102 Matcher: request.PathWaiterMatch, Argument: "replicationSet.status", 103 Expected: "DELETING", 104 }, 105 { 106 State: request.FailureWaiterState, 107 Matcher: request.PathWaiterMatch, Argument: "replicationSet.status", 108 Expected: "FAILED", 109 }, 110 }, 111 Logger: c.Config.Logger, 112 NewRequest: func(opts []request.Option) (*request.Request, error) { 113 var inCpy *GetReplicationSetInput 114 if input != nil { 115 tmp := *input 116 inCpy = &tmp 117 } 118 req, _ := c.GetReplicationSetRequest(inCpy) 119 req.SetContext(ctx) 120 req.ApplyOptions(opts...) 121 return req, nil 122 }, 123 } 124 w.ApplyOptions(opts...) 125 126 return w.WaitWithContext(ctx) 127 }