github.com/aavshr/aws-sdk-go@v1.41.3/service/elasticache/waiters.go (about) 1 // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 3 package elasticache 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 // WaitUntilCacheClusterAvailable uses the Amazon ElastiCache API operation 13 // DescribeCacheClusters 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 *ElastiCache) WaitUntilCacheClusterAvailable(input *DescribeCacheClustersInput) error { 17 return c.WaitUntilCacheClusterAvailableWithContext(aws.BackgroundContext(), input) 18 } 19 20 // WaitUntilCacheClusterAvailableWithContext is an extended version of WaitUntilCacheClusterAvailable. 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 *ElastiCache) WaitUntilCacheClusterAvailableWithContext(ctx aws.Context, input *DescribeCacheClustersInput, opts ...request.WaiterOption) error { 29 w := request.Waiter{ 30 Name: "WaitUntilCacheClusterAvailable", 31 MaxAttempts: 40, 32 Delay: request.ConstantWaiterDelay(15 * time.Second), 33 Acceptors: []request.WaiterAcceptor{ 34 { 35 State: request.SuccessWaiterState, 36 Matcher: request.PathAllWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", 37 Expected: "available", 38 }, 39 { 40 State: request.FailureWaiterState, 41 Matcher: request.PathAnyWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", 42 Expected: "deleted", 43 }, 44 { 45 State: request.FailureWaiterState, 46 Matcher: request.PathAnyWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", 47 Expected: "deleting", 48 }, 49 { 50 State: request.FailureWaiterState, 51 Matcher: request.PathAnyWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", 52 Expected: "incompatible-network", 53 }, 54 { 55 State: request.FailureWaiterState, 56 Matcher: request.PathAnyWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", 57 Expected: "restore-failed", 58 }, 59 }, 60 Logger: c.Config.Logger, 61 NewRequest: func(opts []request.Option) (*request.Request, error) { 62 var inCpy *DescribeCacheClustersInput 63 if input != nil { 64 tmp := *input 65 inCpy = &tmp 66 } 67 req, _ := c.DescribeCacheClustersRequest(inCpy) 68 req.SetContext(ctx) 69 req.ApplyOptions(opts...) 70 return req, nil 71 }, 72 } 73 w.ApplyOptions(opts...) 74 75 return w.WaitWithContext(ctx) 76 } 77 78 // WaitUntilCacheClusterDeleted uses the Amazon ElastiCache API operation 79 // DescribeCacheClusters to wait for a condition to be met before returning. 80 // If the condition is not met within the max attempt window, an error will 81 // be returned. 82 func (c *ElastiCache) WaitUntilCacheClusterDeleted(input *DescribeCacheClustersInput) error { 83 return c.WaitUntilCacheClusterDeletedWithContext(aws.BackgroundContext(), input) 84 } 85 86 // WaitUntilCacheClusterDeletedWithContext is an extended version of WaitUntilCacheClusterDeleted. 87 // With the support for passing in a context and options to configure the 88 // Waiter and the underlying request options. 89 // 90 // The context must be non-nil and will be used for request cancellation. If 91 // the context is nil a panic will occur. In the future the SDK may create 92 // sub-contexts for http.Requests. See https://golang.org/pkg/context/ 93 // for more information on using Contexts. 94 func (c *ElastiCache) WaitUntilCacheClusterDeletedWithContext(ctx aws.Context, input *DescribeCacheClustersInput, opts ...request.WaiterOption) error { 95 w := request.Waiter{ 96 Name: "WaitUntilCacheClusterDeleted", 97 MaxAttempts: 40, 98 Delay: request.ConstantWaiterDelay(15 * time.Second), 99 Acceptors: []request.WaiterAcceptor{ 100 { 101 State: request.SuccessWaiterState, 102 Matcher: request.PathAllWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", 103 Expected: "deleted", 104 }, 105 { 106 State: request.SuccessWaiterState, 107 Matcher: request.ErrorWaiterMatch, 108 Expected: "CacheClusterNotFound", 109 }, 110 { 111 State: request.FailureWaiterState, 112 Matcher: request.PathAnyWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", 113 Expected: "available", 114 }, 115 { 116 State: request.FailureWaiterState, 117 Matcher: request.PathAnyWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", 118 Expected: "creating", 119 }, 120 { 121 State: request.FailureWaiterState, 122 Matcher: request.PathAnyWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", 123 Expected: "incompatible-network", 124 }, 125 { 126 State: request.FailureWaiterState, 127 Matcher: request.PathAnyWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", 128 Expected: "modifying", 129 }, 130 { 131 State: request.FailureWaiterState, 132 Matcher: request.PathAnyWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", 133 Expected: "restore-failed", 134 }, 135 { 136 State: request.FailureWaiterState, 137 Matcher: request.PathAnyWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", 138 Expected: "snapshotting", 139 }, 140 }, 141 Logger: c.Config.Logger, 142 NewRequest: func(opts []request.Option) (*request.Request, error) { 143 var inCpy *DescribeCacheClustersInput 144 if input != nil { 145 tmp := *input 146 inCpy = &tmp 147 } 148 req, _ := c.DescribeCacheClustersRequest(inCpy) 149 req.SetContext(ctx) 150 req.ApplyOptions(opts...) 151 return req, nil 152 }, 153 } 154 w.ApplyOptions(opts...) 155 156 return w.WaitWithContext(ctx) 157 } 158 159 // WaitUntilReplicationGroupAvailable uses the Amazon ElastiCache API operation 160 // DescribeReplicationGroups to wait for a condition to be met before returning. 161 // If the condition is not met within the max attempt window, an error will 162 // be returned. 163 func (c *ElastiCache) WaitUntilReplicationGroupAvailable(input *DescribeReplicationGroupsInput) error { 164 return c.WaitUntilReplicationGroupAvailableWithContext(aws.BackgroundContext(), input) 165 } 166 167 // WaitUntilReplicationGroupAvailableWithContext is an extended version of WaitUntilReplicationGroupAvailable. 168 // With the support for passing in a context and options to configure the 169 // Waiter and the underlying request options. 170 // 171 // The context must be non-nil and will be used for request cancellation. If 172 // the context is nil a panic will occur. In the future the SDK may create 173 // sub-contexts for http.Requests. See https://golang.org/pkg/context/ 174 // for more information on using Contexts. 175 func (c *ElastiCache) WaitUntilReplicationGroupAvailableWithContext(ctx aws.Context, input *DescribeReplicationGroupsInput, opts ...request.WaiterOption) error { 176 w := request.Waiter{ 177 Name: "WaitUntilReplicationGroupAvailable", 178 MaxAttempts: 40, 179 Delay: request.ConstantWaiterDelay(15 * time.Second), 180 Acceptors: []request.WaiterAcceptor{ 181 { 182 State: request.SuccessWaiterState, 183 Matcher: request.PathAllWaiterMatch, Argument: "ReplicationGroups[].Status", 184 Expected: "available", 185 }, 186 { 187 State: request.FailureWaiterState, 188 Matcher: request.PathAnyWaiterMatch, Argument: "ReplicationGroups[].Status", 189 Expected: "deleted", 190 }, 191 }, 192 Logger: c.Config.Logger, 193 NewRequest: func(opts []request.Option) (*request.Request, error) { 194 var inCpy *DescribeReplicationGroupsInput 195 if input != nil { 196 tmp := *input 197 inCpy = &tmp 198 } 199 req, _ := c.DescribeReplicationGroupsRequest(inCpy) 200 req.SetContext(ctx) 201 req.ApplyOptions(opts...) 202 return req, nil 203 }, 204 } 205 w.ApplyOptions(opts...) 206 207 return w.WaitWithContext(ctx) 208 } 209 210 // WaitUntilReplicationGroupDeleted uses the Amazon ElastiCache API operation 211 // DescribeReplicationGroups to wait for a condition to be met before returning. 212 // If the condition is not met within the max attempt window, an error will 213 // be returned. 214 func (c *ElastiCache) WaitUntilReplicationGroupDeleted(input *DescribeReplicationGroupsInput) error { 215 return c.WaitUntilReplicationGroupDeletedWithContext(aws.BackgroundContext(), input) 216 } 217 218 // WaitUntilReplicationGroupDeletedWithContext is an extended version of WaitUntilReplicationGroupDeleted. 219 // With the support for passing in a context and options to configure the 220 // Waiter and the underlying request options. 221 // 222 // The context must be non-nil and will be used for request cancellation. If 223 // the context is nil a panic will occur. In the future the SDK may create 224 // sub-contexts for http.Requests. See https://golang.org/pkg/context/ 225 // for more information on using Contexts. 226 func (c *ElastiCache) WaitUntilReplicationGroupDeletedWithContext(ctx aws.Context, input *DescribeReplicationGroupsInput, opts ...request.WaiterOption) error { 227 w := request.Waiter{ 228 Name: "WaitUntilReplicationGroupDeleted", 229 MaxAttempts: 40, 230 Delay: request.ConstantWaiterDelay(15 * time.Second), 231 Acceptors: []request.WaiterAcceptor{ 232 { 233 State: request.SuccessWaiterState, 234 Matcher: request.PathAllWaiterMatch, Argument: "ReplicationGroups[].Status", 235 Expected: "deleted", 236 }, 237 { 238 State: request.FailureWaiterState, 239 Matcher: request.PathAnyWaiterMatch, Argument: "ReplicationGroups[].Status", 240 Expected: "available", 241 }, 242 { 243 State: request.SuccessWaiterState, 244 Matcher: request.ErrorWaiterMatch, 245 Expected: "ReplicationGroupNotFoundFault", 246 }, 247 }, 248 Logger: c.Config.Logger, 249 NewRequest: func(opts []request.Option) (*request.Request, error) { 250 var inCpy *DescribeReplicationGroupsInput 251 if input != nil { 252 tmp := *input 253 inCpy = &tmp 254 } 255 req, _ := c.DescribeReplicationGroupsRequest(inCpy) 256 req.SetContext(ctx) 257 req.ApplyOptions(opts...) 258 return req, nil 259 }, 260 } 261 w.ApplyOptions(opts...) 262 263 return w.WaitWithContext(ctx) 264 }