waiters.go 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626
  1. // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
  2. package ec2
  3. import (
  4. "time"
  5. "github.com/aws/aws-sdk-go/aws"
  6. "github.com/aws/aws-sdk-go/aws/request"
  7. )
  8. // WaitUntilBundleTaskComplete uses the Amazon EC2 API operation
  9. // DescribeBundleTasks to wait for a condition to be met before returning.
  10. // If the condition is not met within the max attempt window, an error will
  11. // be returned.
  12. func (c *EC2) WaitUntilBundleTaskComplete(input *DescribeBundleTasksInput) error {
  13. return c.WaitUntilBundleTaskCompleteWithContext(aws.BackgroundContext(), input)
  14. }
  15. // WaitUntilBundleTaskCompleteWithContext is an extended version of WaitUntilBundleTaskComplete.
  16. // With the support for passing in a context and options to configure the
  17. // Waiter and the underlying request options.
  18. //
  19. // The context must be non-nil and will be used for request cancellation. If
  20. // the context is nil a panic will occur. In the future the SDK may create
  21. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  22. // for more information on using Contexts.
  23. func (c *EC2) WaitUntilBundleTaskCompleteWithContext(ctx aws.Context, input *DescribeBundleTasksInput, opts ...request.WaiterOption) error {
  24. w := request.Waiter{
  25. Name: "WaitUntilBundleTaskComplete",
  26. MaxAttempts: 40,
  27. Delay: request.ConstantWaiterDelay(15 * time.Second),
  28. Acceptors: []request.WaiterAcceptor{
  29. {
  30. State: request.SuccessWaiterState,
  31. Matcher: request.PathAllWaiterMatch, Argument: "BundleTasks[].State",
  32. Expected: "complete",
  33. },
  34. {
  35. State: request.FailureWaiterState,
  36. Matcher: request.PathAnyWaiterMatch, Argument: "BundleTasks[].State",
  37. Expected: "failed",
  38. },
  39. },
  40. Logger: c.Config.Logger,
  41. NewRequest: func(opts []request.Option) (*request.Request, error) {
  42. var inCpy *DescribeBundleTasksInput
  43. if input != nil {
  44. tmp := *input
  45. inCpy = &tmp
  46. }
  47. req, _ := c.DescribeBundleTasksRequest(inCpy)
  48. req.SetContext(ctx)
  49. req.ApplyOptions(opts...)
  50. return req, nil
  51. },
  52. }
  53. w.ApplyOptions(opts...)
  54. return w.WaitWithContext(ctx)
  55. }
  56. // WaitUntilConversionTaskCancelled uses the Amazon EC2 API operation
  57. // DescribeConversionTasks to wait for a condition to be met before returning.
  58. // If the condition is not met within the max attempt window, an error will
  59. // be returned.
  60. func (c *EC2) WaitUntilConversionTaskCancelled(input *DescribeConversionTasksInput) error {
  61. return c.WaitUntilConversionTaskCancelledWithContext(aws.BackgroundContext(), input)
  62. }
  63. // WaitUntilConversionTaskCancelledWithContext is an extended version of WaitUntilConversionTaskCancelled.
  64. // With the support for passing in a context and options to configure the
  65. // Waiter and the underlying request options.
  66. //
  67. // The context must be non-nil and will be used for request cancellation. If
  68. // the context is nil a panic will occur. In the future the SDK may create
  69. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  70. // for more information on using Contexts.
  71. func (c *EC2) WaitUntilConversionTaskCancelledWithContext(ctx aws.Context, input *DescribeConversionTasksInput, opts ...request.WaiterOption) error {
  72. w := request.Waiter{
  73. Name: "WaitUntilConversionTaskCancelled",
  74. MaxAttempts: 40,
  75. Delay: request.ConstantWaiterDelay(15 * time.Second),
  76. Acceptors: []request.WaiterAcceptor{
  77. {
  78. State: request.SuccessWaiterState,
  79. Matcher: request.PathAllWaiterMatch, Argument: "ConversionTasks[].State",
  80. Expected: "cancelled",
  81. },
  82. },
  83. Logger: c.Config.Logger,
  84. NewRequest: func(opts []request.Option) (*request.Request, error) {
  85. var inCpy *DescribeConversionTasksInput
  86. if input != nil {
  87. tmp := *input
  88. inCpy = &tmp
  89. }
  90. req, _ := c.DescribeConversionTasksRequest(inCpy)
  91. req.SetContext(ctx)
  92. req.ApplyOptions(opts...)
  93. return req, nil
  94. },
  95. }
  96. w.ApplyOptions(opts...)
  97. return w.WaitWithContext(ctx)
  98. }
  99. // WaitUntilConversionTaskCompleted uses the Amazon EC2 API operation
  100. // DescribeConversionTasks to wait for a condition to be met before returning.
  101. // If the condition is not met within the max attempt window, an error will
  102. // be returned.
  103. func (c *EC2) WaitUntilConversionTaskCompleted(input *DescribeConversionTasksInput) error {
  104. return c.WaitUntilConversionTaskCompletedWithContext(aws.BackgroundContext(), input)
  105. }
  106. // WaitUntilConversionTaskCompletedWithContext is an extended version of WaitUntilConversionTaskCompleted.
  107. // With the support for passing in a context and options to configure the
  108. // Waiter and the underlying request options.
  109. //
  110. // The context must be non-nil and will be used for request cancellation. If
  111. // the context is nil a panic will occur. In the future the SDK may create
  112. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  113. // for more information on using Contexts.
  114. func (c *EC2) WaitUntilConversionTaskCompletedWithContext(ctx aws.Context, input *DescribeConversionTasksInput, opts ...request.WaiterOption) error {
  115. w := request.Waiter{
  116. Name: "WaitUntilConversionTaskCompleted",
  117. MaxAttempts: 40,
  118. Delay: request.ConstantWaiterDelay(15 * time.Second),
  119. Acceptors: []request.WaiterAcceptor{
  120. {
  121. State: request.SuccessWaiterState,
  122. Matcher: request.PathAllWaiterMatch, Argument: "ConversionTasks[].State",
  123. Expected: "completed",
  124. },
  125. {
  126. State: request.FailureWaiterState,
  127. Matcher: request.PathAnyWaiterMatch, Argument: "ConversionTasks[].State",
  128. Expected: "cancelled",
  129. },
  130. {
  131. State: request.FailureWaiterState,
  132. Matcher: request.PathAnyWaiterMatch, Argument: "ConversionTasks[].State",
  133. Expected: "cancelling",
  134. },
  135. },
  136. Logger: c.Config.Logger,
  137. NewRequest: func(opts []request.Option) (*request.Request, error) {
  138. var inCpy *DescribeConversionTasksInput
  139. if input != nil {
  140. tmp := *input
  141. inCpy = &tmp
  142. }
  143. req, _ := c.DescribeConversionTasksRequest(inCpy)
  144. req.SetContext(ctx)
  145. req.ApplyOptions(opts...)
  146. return req, nil
  147. },
  148. }
  149. w.ApplyOptions(opts...)
  150. return w.WaitWithContext(ctx)
  151. }
  152. // WaitUntilConversionTaskDeleted uses the Amazon EC2 API operation
  153. // DescribeConversionTasks to wait for a condition to be met before returning.
  154. // If the condition is not met within the max attempt window, an error will
  155. // be returned.
  156. func (c *EC2) WaitUntilConversionTaskDeleted(input *DescribeConversionTasksInput) error {
  157. return c.WaitUntilConversionTaskDeletedWithContext(aws.BackgroundContext(), input)
  158. }
  159. // WaitUntilConversionTaskDeletedWithContext is an extended version of WaitUntilConversionTaskDeleted.
  160. // With the support for passing in a context and options to configure the
  161. // Waiter and the underlying request options.
  162. //
  163. // The context must be non-nil and will be used for request cancellation. If
  164. // the context is nil a panic will occur. In the future the SDK may create
  165. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  166. // for more information on using Contexts.
  167. func (c *EC2) WaitUntilConversionTaskDeletedWithContext(ctx aws.Context, input *DescribeConversionTasksInput, opts ...request.WaiterOption) error {
  168. w := request.Waiter{
  169. Name: "WaitUntilConversionTaskDeleted",
  170. MaxAttempts: 40,
  171. Delay: request.ConstantWaiterDelay(15 * time.Second),
  172. Acceptors: []request.WaiterAcceptor{
  173. {
  174. State: request.SuccessWaiterState,
  175. Matcher: request.PathAllWaiterMatch, Argument: "ConversionTasks[].State",
  176. Expected: "deleted",
  177. },
  178. },
  179. Logger: c.Config.Logger,
  180. NewRequest: func(opts []request.Option) (*request.Request, error) {
  181. var inCpy *DescribeConversionTasksInput
  182. if input != nil {
  183. tmp := *input
  184. inCpy = &tmp
  185. }
  186. req, _ := c.DescribeConversionTasksRequest(inCpy)
  187. req.SetContext(ctx)
  188. req.ApplyOptions(opts...)
  189. return req, nil
  190. },
  191. }
  192. w.ApplyOptions(opts...)
  193. return w.WaitWithContext(ctx)
  194. }
  195. // WaitUntilCustomerGatewayAvailable uses the Amazon EC2 API operation
  196. // DescribeCustomerGateways to wait for a condition to be met before returning.
  197. // If the condition is not met within the max attempt window, an error will
  198. // be returned.
  199. func (c *EC2) WaitUntilCustomerGatewayAvailable(input *DescribeCustomerGatewaysInput) error {
  200. return c.WaitUntilCustomerGatewayAvailableWithContext(aws.BackgroundContext(), input)
  201. }
  202. // WaitUntilCustomerGatewayAvailableWithContext is an extended version of WaitUntilCustomerGatewayAvailable.
  203. // With the support for passing in a context and options to configure the
  204. // Waiter and the underlying request options.
  205. //
  206. // The context must be non-nil and will be used for request cancellation. If
  207. // the context is nil a panic will occur. In the future the SDK may create
  208. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  209. // for more information on using Contexts.
  210. func (c *EC2) WaitUntilCustomerGatewayAvailableWithContext(ctx aws.Context, input *DescribeCustomerGatewaysInput, opts ...request.WaiterOption) error {
  211. w := request.Waiter{
  212. Name: "WaitUntilCustomerGatewayAvailable",
  213. MaxAttempts: 40,
  214. Delay: request.ConstantWaiterDelay(15 * time.Second),
  215. Acceptors: []request.WaiterAcceptor{
  216. {
  217. State: request.SuccessWaiterState,
  218. Matcher: request.PathAllWaiterMatch, Argument: "CustomerGateways[].State",
  219. Expected: "available",
  220. },
  221. {
  222. State: request.FailureWaiterState,
  223. Matcher: request.PathAnyWaiterMatch, Argument: "CustomerGateways[].State",
  224. Expected: "deleted",
  225. },
  226. {
  227. State: request.FailureWaiterState,
  228. Matcher: request.PathAnyWaiterMatch, Argument: "CustomerGateways[].State",
  229. Expected: "deleting",
  230. },
  231. },
  232. Logger: c.Config.Logger,
  233. NewRequest: func(opts []request.Option) (*request.Request, error) {
  234. var inCpy *DescribeCustomerGatewaysInput
  235. if input != nil {
  236. tmp := *input
  237. inCpy = &tmp
  238. }
  239. req, _ := c.DescribeCustomerGatewaysRequest(inCpy)
  240. req.SetContext(ctx)
  241. req.ApplyOptions(opts...)
  242. return req, nil
  243. },
  244. }
  245. w.ApplyOptions(opts...)
  246. return w.WaitWithContext(ctx)
  247. }
  248. // WaitUntilExportTaskCancelled uses the Amazon EC2 API operation
  249. // DescribeExportTasks to wait for a condition to be met before returning.
  250. // If the condition is not met within the max attempt window, an error will
  251. // be returned.
  252. func (c *EC2) WaitUntilExportTaskCancelled(input *DescribeExportTasksInput) error {
  253. return c.WaitUntilExportTaskCancelledWithContext(aws.BackgroundContext(), input)
  254. }
  255. // WaitUntilExportTaskCancelledWithContext is an extended version of WaitUntilExportTaskCancelled.
  256. // With the support for passing in a context and options to configure the
  257. // Waiter and the underlying request options.
  258. //
  259. // The context must be non-nil and will be used for request cancellation. If
  260. // the context is nil a panic will occur. In the future the SDK may create
  261. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  262. // for more information on using Contexts.
  263. func (c *EC2) WaitUntilExportTaskCancelledWithContext(ctx aws.Context, input *DescribeExportTasksInput, opts ...request.WaiterOption) error {
  264. w := request.Waiter{
  265. Name: "WaitUntilExportTaskCancelled",
  266. MaxAttempts: 40,
  267. Delay: request.ConstantWaiterDelay(15 * time.Second),
  268. Acceptors: []request.WaiterAcceptor{
  269. {
  270. State: request.SuccessWaiterState,
  271. Matcher: request.PathAllWaiterMatch, Argument: "ExportTasks[].State",
  272. Expected: "cancelled",
  273. },
  274. },
  275. Logger: c.Config.Logger,
  276. NewRequest: func(opts []request.Option) (*request.Request, error) {
  277. var inCpy *DescribeExportTasksInput
  278. if input != nil {
  279. tmp := *input
  280. inCpy = &tmp
  281. }
  282. req, _ := c.DescribeExportTasksRequest(inCpy)
  283. req.SetContext(ctx)
  284. req.ApplyOptions(opts...)
  285. return req, nil
  286. },
  287. }
  288. w.ApplyOptions(opts...)
  289. return w.WaitWithContext(ctx)
  290. }
  291. // WaitUntilExportTaskCompleted uses the Amazon EC2 API operation
  292. // DescribeExportTasks to wait for a condition to be met before returning.
  293. // If the condition is not met within the max attempt window, an error will
  294. // be returned.
  295. func (c *EC2) WaitUntilExportTaskCompleted(input *DescribeExportTasksInput) error {
  296. return c.WaitUntilExportTaskCompletedWithContext(aws.BackgroundContext(), input)
  297. }
  298. // WaitUntilExportTaskCompletedWithContext is an extended version of WaitUntilExportTaskCompleted.
  299. // With the support for passing in a context and options to configure the
  300. // Waiter and the underlying request options.
  301. //
  302. // The context must be non-nil and will be used for request cancellation. If
  303. // the context is nil a panic will occur. In the future the SDK may create
  304. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  305. // for more information on using Contexts.
  306. func (c *EC2) WaitUntilExportTaskCompletedWithContext(ctx aws.Context, input *DescribeExportTasksInput, opts ...request.WaiterOption) error {
  307. w := request.Waiter{
  308. Name: "WaitUntilExportTaskCompleted",
  309. MaxAttempts: 40,
  310. Delay: request.ConstantWaiterDelay(15 * time.Second),
  311. Acceptors: []request.WaiterAcceptor{
  312. {
  313. State: request.SuccessWaiterState,
  314. Matcher: request.PathAllWaiterMatch, Argument: "ExportTasks[].State",
  315. Expected: "completed",
  316. },
  317. },
  318. Logger: c.Config.Logger,
  319. NewRequest: func(opts []request.Option) (*request.Request, error) {
  320. var inCpy *DescribeExportTasksInput
  321. if input != nil {
  322. tmp := *input
  323. inCpy = &tmp
  324. }
  325. req, _ := c.DescribeExportTasksRequest(inCpy)
  326. req.SetContext(ctx)
  327. req.ApplyOptions(opts...)
  328. return req, nil
  329. },
  330. }
  331. w.ApplyOptions(opts...)
  332. return w.WaitWithContext(ctx)
  333. }
  334. // WaitUntilImageAvailable uses the Amazon EC2 API operation
  335. // DescribeImages to wait for a condition to be met before returning.
  336. // If the condition is not met within the max attempt window, an error will
  337. // be returned.
  338. func (c *EC2) WaitUntilImageAvailable(input *DescribeImagesInput) error {
  339. return c.WaitUntilImageAvailableWithContext(aws.BackgroundContext(), input)
  340. }
  341. // WaitUntilImageAvailableWithContext is an extended version of WaitUntilImageAvailable.
  342. // With the support for passing in a context and options to configure the
  343. // Waiter and the underlying request options.
  344. //
  345. // The context must be non-nil and will be used for request cancellation. If
  346. // the context is nil a panic will occur. In the future the SDK may create
  347. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  348. // for more information on using Contexts.
  349. func (c *EC2) WaitUntilImageAvailableWithContext(ctx aws.Context, input *DescribeImagesInput, opts ...request.WaiterOption) error {
  350. w := request.Waiter{
  351. Name: "WaitUntilImageAvailable",
  352. MaxAttempts: 40,
  353. Delay: request.ConstantWaiterDelay(15 * time.Second),
  354. Acceptors: []request.WaiterAcceptor{
  355. {
  356. State: request.SuccessWaiterState,
  357. Matcher: request.PathAllWaiterMatch, Argument: "Images[].State",
  358. Expected: "available",
  359. },
  360. {
  361. State: request.FailureWaiterState,
  362. Matcher: request.PathAnyWaiterMatch, Argument: "Images[].State",
  363. Expected: "failed",
  364. },
  365. },
  366. Logger: c.Config.Logger,
  367. NewRequest: func(opts []request.Option) (*request.Request, error) {
  368. var inCpy *DescribeImagesInput
  369. if input != nil {
  370. tmp := *input
  371. inCpy = &tmp
  372. }
  373. req, _ := c.DescribeImagesRequest(inCpy)
  374. req.SetContext(ctx)
  375. req.ApplyOptions(opts...)
  376. return req, nil
  377. },
  378. }
  379. w.ApplyOptions(opts...)
  380. return w.WaitWithContext(ctx)
  381. }
  382. // WaitUntilImageExists uses the Amazon EC2 API operation
  383. // DescribeImages to wait for a condition to be met before returning.
  384. // If the condition is not met within the max attempt window, an error will
  385. // be returned.
  386. func (c *EC2) WaitUntilImageExists(input *DescribeImagesInput) error {
  387. return c.WaitUntilImageExistsWithContext(aws.BackgroundContext(), input)
  388. }
  389. // WaitUntilImageExistsWithContext is an extended version of WaitUntilImageExists.
  390. // With the support for passing in a context and options to configure the
  391. // Waiter and the underlying request options.
  392. //
  393. // The context must be non-nil and will be used for request cancellation. If
  394. // the context is nil a panic will occur. In the future the SDK may create
  395. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  396. // for more information on using Contexts.
  397. func (c *EC2) WaitUntilImageExistsWithContext(ctx aws.Context, input *DescribeImagesInput, opts ...request.WaiterOption) error {
  398. w := request.Waiter{
  399. Name: "WaitUntilImageExists",
  400. MaxAttempts: 40,
  401. Delay: request.ConstantWaiterDelay(15 * time.Second),
  402. Acceptors: []request.WaiterAcceptor{
  403. {
  404. State: request.SuccessWaiterState,
  405. Matcher: request.PathWaiterMatch, Argument: "length(Images[]) > `0`",
  406. Expected: true,
  407. },
  408. {
  409. State: request.RetryWaiterState,
  410. Matcher: request.ErrorWaiterMatch,
  411. Expected: "InvalidAMIID.NotFound",
  412. },
  413. },
  414. Logger: c.Config.Logger,
  415. NewRequest: func(opts []request.Option) (*request.Request, error) {
  416. var inCpy *DescribeImagesInput
  417. if input != nil {
  418. tmp := *input
  419. inCpy = &tmp
  420. }
  421. req, _ := c.DescribeImagesRequest(inCpy)
  422. req.SetContext(ctx)
  423. req.ApplyOptions(opts...)
  424. return req, nil
  425. },
  426. }
  427. w.ApplyOptions(opts...)
  428. return w.WaitWithContext(ctx)
  429. }
  430. // WaitUntilInstanceExists uses the Amazon EC2 API operation
  431. // DescribeInstances to wait for a condition to be met before returning.
  432. // If the condition is not met within the max attempt window, an error will
  433. // be returned.
  434. func (c *EC2) WaitUntilInstanceExists(input *DescribeInstancesInput) error {
  435. return c.WaitUntilInstanceExistsWithContext(aws.BackgroundContext(), input)
  436. }
  437. // WaitUntilInstanceExistsWithContext is an extended version of WaitUntilInstanceExists.
  438. // With the support for passing in a context and options to configure the
  439. // Waiter and the underlying request options.
  440. //
  441. // The context must be non-nil and will be used for request cancellation. If
  442. // the context is nil a panic will occur. In the future the SDK may create
  443. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  444. // for more information on using Contexts.
  445. func (c *EC2) WaitUntilInstanceExistsWithContext(ctx aws.Context, input *DescribeInstancesInput, opts ...request.WaiterOption) error {
  446. w := request.Waiter{
  447. Name: "WaitUntilInstanceExists",
  448. MaxAttempts: 40,
  449. Delay: request.ConstantWaiterDelay(5 * time.Second),
  450. Acceptors: []request.WaiterAcceptor{
  451. {
  452. State: request.SuccessWaiterState,
  453. Matcher: request.PathWaiterMatch, Argument: "length(Reservations[]) > `0`",
  454. Expected: true,
  455. },
  456. {
  457. State: request.RetryWaiterState,
  458. Matcher: request.ErrorWaiterMatch,
  459. Expected: "InvalidInstanceID.NotFound",
  460. },
  461. },
  462. Logger: c.Config.Logger,
  463. NewRequest: func(opts []request.Option) (*request.Request, error) {
  464. var inCpy *DescribeInstancesInput
  465. if input != nil {
  466. tmp := *input
  467. inCpy = &tmp
  468. }
  469. req, _ := c.DescribeInstancesRequest(inCpy)
  470. req.SetContext(ctx)
  471. req.ApplyOptions(opts...)
  472. return req, nil
  473. },
  474. }
  475. w.ApplyOptions(opts...)
  476. return w.WaitWithContext(ctx)
  477. }
  478. // WaitUntilInstanceRunning uses the Amazon EC2 API operation
  479. // DescribeInstances to wait for a condition to be met before returning.
  480. // If the condition is not met within the max attempt window, an error will
  481. // be returned.
  482. func (c *EC2) WaitUntilInstanceRunning(input *DescribeInstancesInput) error {
  483. return c.WaitUntilInstanceRunningWithContext(aws.BackgroundContext(), input)
  484. }
  485. // WaitUntilInstanceRunningWithContext is an extended version of WaitUntilInstanceRunning.
  486. // With the support for passing in a context and options to configure the
  487. // Waiter and the underlying request options.
  488. //
  489. // The context must be non-nil and will be used for request cancellation. If
  490. // the context is nil a panic will occur. In the future the SDK may create
  491. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  492. // for more information on using Contexts.
  493. func (c *EC2) WaitUntilInstanceRunningWithContext(ctx aws.Context, input *DescribeInstancesInput, opts ...request.WaiterOption) error {
  494. w := request.Waiter{
  495. Name: "WaitUntilInstanceRunning",
  496. MaxAttempts: 40,
  497. Delay: request.ConstantWaiterDelay(15 * time.Second),
  498. Acceptors: []request.WaiterAcceptor{
  499. {
  500. State: request.SuccessWaiterState,
  501. Matcher: request.PathAllWaiterMatch, Argument: "Reservations[].Instances[].State.Name",
  502. Expected: "running",
  503. },
  504. {
  505. State: request.FailureWaiterState,
  506. Matcher: request.PathAnyWaiterMatch, Argument: "Reservations[].Instances[].State.Name",
  507. Expected: "shutting-down",
  508. },
  509. {
  510. State: request.FailureWaiterState,
  511. Matcher: request.PathAnyWaiterMatch, Argument: "Reservations[].Instances[].State.Name",
  512. Expected: "terminated",
  513. },
  514. {
  515. State: request.FailureWaiterState,
  516. Matcher: request.PathAnyWaiterMatch, Argument: "Reservations[].Instances[].State.Name",
  517. Expected: "stopping",
  518. },
  519. {
  520. State: request.RetryWaiterState,
  521. Matcher: request.ErrorWaiterMatch,
  522. Expected: "InvalidInstanceID.NotFound",
  523. },
  524. },
  525. Logger: c.Config.Logger,
  526. NewRequest: func(opts []request.Option) (*request.Request, error) {
  527. var inCpy *DescribeInstancesInput
  528. if input != nil {
  529. tmp := *input
  530. inCpy = &tmp
  531. }
  532. req, _ := c.DescribeInstancesRequest(inCpy)
  533. req.SetContext(ctx)
  534. req.ApplyOptions(opts...)
  535. return req, nil
  536. },
  537. }
  538. w.ApplyOptions(opts...)
  539. return w.WaitWithContext(ctx)
  540. }
  541. // WaitUntilInstanceStatusOk uses the Amazon EC2 API operation
  542. // DescribeInstanceStatus to wait for a condition to be met before returning.
  543. // If the condition is not met within the max attempt window, an error will
  544. // be returned.
  545. func (c *EC2) WaitUntilInstanceStatusOk(input *DescribeInstanceStatusInput) error {
  546. return c.WaitUntilInstanceStatusOkWithContext(aws.BackgroundContext(), input)
  547. }
  548. // WaitUntilInstanceStatusOkWithContext is an extended version of WaitUntilInstanceStatusOk.
  549. // With the support for passing in a context and options to configure the
  550. // Waiter and the underlying request options.
  551. //
  552. // The context must be non-nil and will be used for request cancellation. If
  553. // the context is nil a panic will occur. In the future the SDK may create
  554. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  555. // for more information on using Contexts.
  556. func (c *EC2) WaitUntilInstanceStatusOkWithContext(ctx aws.Context, input *DescribeInstanceStatusInput, opts ...request.WaiterOption) error {
  557. w := request.Waiter{
  558. Name: "WaitUntilInstanceStatusOk",
  559. MaxAttempts: 40,
  560. Delay: request.ConstantWaiterDelay(15 * time.Second),
  561. Acceptors: []request.WaiterAcceptor{
  562. {
  563. State: request.SuccessWaiterState,
  564. Matcher: request.PathAllWaiterMatch, Argument: "InstanceStatuses[].InstanceStatus.Status",
  565. Expected: "ok",
  566. },
  567. {
  568. State: request.RetryWaiterState,
  569. Matcher: request.ErrorWaiterMatch,
  570. Expected: "InvalidInstanceID.NotFound",
  571. },
  572. },
  573. Logger: c.Config.Logger,
  574. NewRequest: func(opts []request.Option) (*request.Request, error) {
  575. var inCpy *DescribeInstanceStatusInput
  576. if input != nil {
  577. tmp := *input
  578. inCpy = &tmp
  579. }
  580. req, _ := c.DescribeInstanceStatusRequest(inCpy)
  581. req.SetContext(ctx)
  582. req.ApplyOptions(opts...)
  583. return req, nil
  584. },
  585. }
  586. w.ApplyOptions(opts...)
  587. return w.WaitWithContext(ctx)
  588. }
  589. // WaitUntilInstanceStopped uses the Amazon EC2 API operation
  590. // DescribeInstances to wait for a condition to be met before returning.
  591. // If the condition is not met within the max attempt window, an error will
  592. // be returned.
  593. func (c *EC2) WaitUntilInstanceStopped(input *DescribeInstancesInput) error {
  594. return c.WaitUntilInstanceStoppedWithContext(aws.BackgroundContext(), input)
  595. }
  596. // WaitUntilInstanceStoppedWithContext is an extended version of WaitUntilInstanceStopped.
  597. // With the support for passing in a context and options to configure the
  598. // Waiter and the underlying request options.
  599. //
  600. // The context must be non-nil and will be used for request cancellation. If
  601. // the context is nil a panic will occur. In the future the SDK may create
  602. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  603. // for more information on using Contexts.
  604. func (c *EC2) WaitUntilInstanceStoppedWithContext(ctx aws.Context, input *DescribeInstancesInput, opts ...request.WaiterOption) error {
  605. w := request.Waiter{
  606. Name: "WaitUntilInstanceStopped",
  607. MaxAttempts: 40,
  608. Delay: request.ConstantWaiterDelay(15 * time.Second),
  609. Acceptors: []request.WaiterAcceptor{
  610. {
  611. State: request.SuccessWaiterState,
  612. Matcher: request.PathAllWaiterMatch, Argument: "Reservations[].Instances[].State.Name",
  613. Expected: "stopped",
  614. },
  615. {
  616. State: request.FailureWaiterState,
  617. Matcher: request.PathAnyWaiterMatch, Argument: "Reservations[].Instances[].State.Name",
  618. Expected: "pending",
  619. },
  620. {
  621. State: request.FailureWaiterState,
  622. Matcher: request.PathAnyWaiterMatch, Argument: "Reservations[].Instances[].State.Name",
  623. Expected: "terminated",
  624. },
  625. },
  626. Logger: c.Config.Logger,
  627. NewRequest: func(opts []request.Option) (*request.Request, error) {
  628. var inCpy *DescribeInstancesInput
  629. if input != nil {
  630. tmp := *input
  631. inCpy = &tmp
  632. }
  633. req, _ := c.DescribeInstancesRequest(inCpy)
  634. req.SetContext(ctx)
  635. req.ApplyOptions(opts...)
  636. return req, nil
  637. },
  638. }
  639. w.ApplyOptions(opts...)
  640. return w.WaitWithContext(ctx)
  641. }
  642. // WaitUntilInstanceTerminated uses the Amazon EC2 API operation
  643. // DescribeInstances to wait for a condition to be met before returning.
  644. // If the condition is not met within the max attempt window, an error will
  645. // be returned.
  646. func (c *EC2) WaitUntilInstanceTerminated(input *DescribeInstancesInput) error {
  647. return c.WaitUntilInstanceTerminatedWithContext(aws.BackgroundContext(), input)
  648. }
  649. // WaitUntilInstanceTerminatedWithContext is an extended version of WaitUntilInstanceTerminated.
  650. // With the support for passing in a context and options to configure the
  651. // Waiter and the underlying request options.
  652. //
  653. // The context must be non-nil and will be used for request cancellation. If
  654. // the context is nil a panic will occur. In the future the SDK may create
  655. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  656. // for more information on using Contexts.
  657. func (c *EC2) WaitUntilInstanceTerminatedWithContext(ctx aws.Context, input *DescribeInstancesInput, opts ...request.WaiterOption) error {
  658. w := request.Waiter{
  659. Name: "WaitUntilInstanceTerminated",
  660. MaxAttempts: 40,
  661. Delay: request.ConstantWaiterDelay(15 * time.Second),
  662. Acceptors: []request.WaiterAcceptor{
  663. {
  664. State: request.SuccessWaiterState,
  665. Matcher: request.PathAllWaiterMatch, Argument: "Reservations[].Instances[].State.Name",
  666. Expected: "terminated",
  667. },
  668. {
  669. State: request.FailureWaiterState,
  670. Matcher: request.PathAnyWaiterMatch, Argument: "Reservations[].Instances[].State.Name",
  671. Expected: "pending",
  672. },
  673. {
  674. State: request.FailureWaiterState,
  675. Matcher: request.PathAnyWaiterMatch, Argument: "Reservations[].Instances[].State.Name",
  676. Expected: "stopping",
  677. },
  678. },
  679. Logger: c.Config.Logger,
  680. NewRequest: func(opts []request.Option) (*request.Request, error) {
  681. var inCpy *DescribeInstancesInput
  682. if input != nil {
  683. tmp := *input
  684. inCpy = &tmp
  685. }
  686. req, _ := c.DescribeInstancesRequest(inCpy)
  687. req.SetContext(ctx)
  688. req.ApplyOptions(opts...)
  689. return req, nil
  690. },
  691. }
  692. w.ApplyOptions(opts...)
  693. return w.WaitWithContext(ctx)
  694. }
  695. // WaitUntilKeyPairExists uses the Amazon EC2 API operation
  696. // DescribeKeyPairs to wait for a condition to be met before returning.
  697. // If the condition is not met within the max attempt window, an error will
  698. // be returned.
  699. func (c *EC2) WaitUntilKeyPairExists(input *DescribeKeyPairsInput) error {
  700. return c.WaitUntilKeyPairExistsWithContext(aws.BackgroundContext(), input)
  701. }
  702. // WaitUntilKeyPairExistsWithContext is an extended version of WaitUntilKeyPairExists.
  703. // With the support for passing in a context and options to configure the
  704. // Waiter and the underlying request options.
  705. //
  706. // The context must be non-nil and will be used for request cancellation. If
  707. // the context is nil a panic will occur. In the future the SDK may create
  708. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  709. // for more information on using Contexts.
  710. func (c *EC2) WaitUntilKeyPairExistsWithContext(ctx aws.Context, input *DescribeKeyPairsInput, opts ...request.WaiterOption) error {
  711. w := request.Waiter{
  712. Name: "WaitUntilKeyPairExists",
  713. MaxAttempts: 6,
  714. Delay: request.ConstantWaiterDelay(5 * time.Second),
  715. Acceptors: []request.WaiterAcceptor{
  716. {
  717. State: request.SuccessWaiterState,
  718. Matcher: request.PathWaiterMatch, Argument: "length(KeyPairs[].KeyName) > `0`",
  719. Expected: true,
  720. },
  721. {
  722. State: request.RetryWaiterState,
  723. Matcher: request.ErrorWaiterMatch,
  724. Expected: "InvalidKeyPair.NotFound",
  725. },
  726. },
  727. Logger: c.Config.Logger,
  728. NewRequest: func(opts []request.Option) (*request.Request, error) {
  729. var inCpy *DescribeKeyPairsInput
  730. if input != nil {
  731. tmp := *input
  732. inCpy = &tmp
  733. }
  734. req, _ := c.DescribeKeyPairsRequest(inCpy)
  735. req.SetContext(ctx)
  736. req.ApplyOptions(opts...)
  737. return req, nil
  738. },
  739. }
  740. w.ApplyOptions(opts...)
  741. return w.WaitWithContext(ctx)
  742. }
  743. // WaitUntilNatGatewayAvailable uses the Amazon EC2 API operation
  744. // DescribeNatGateways to wait for a condition to be met before returning.
  745. // If the condition is not met within the max attempt window, an error will
  746. // be returned.
  747. func (c *EC2) WaitUntilNatGatewayAvailable(input *DescribeNatGatewaysInput) error {
  748. return c.WaitUntilNatGatewayAvailableWithContext(aws.BackgroundContext(), input)
  749. }
  750. // WaitUntilNatGatewayAvailableWithContext is an extended version of WaitUntilNatGatewayAvailable.
  751. // With the support for passing in a context and options to configure the
  752. // Waiter and the underlying request options.
  753. //
  754. // The context must be non-nil and will be used for request cancellation. If
  755. // the context is nil a panic will occur. In the future the SDK may create
  756. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  757. // for more information on using Contexts.
  758. func (c *EC2) WaitUntilNatGatewayAvailableWithContext(ctx aws.Context, input *DescribeNatGatewaysInput, opts ...request.WaiterOption) error {
  759. w := request.Waiter{
  760. Name: "WaitUntilNatGatewayAvailable",
  761. MaxAttempts: 40,
  762. Delay: request.ConstantWaiterDelay(15 * time.Second),
  763. Acceptors: []request.WaiterAcceptor{
  764. {
  765. State: request.SuccessWaiterState,
  766. Matcher: request.PathAllWaiterMatch, Argument: "NatGateways[].State",
  767. Expected: "available",
  768. },
  769. {
  770. State: request.FailureWaiterState,
  771. Matcher: request.PathAnyWaiterMatch, Argument: "NatGateways[].State",
  772. Expected: "failed",
  773. },
  774. {
  775. State: request.FailureWaiterState,
  776. Matcher: request.PathAnyWaiterMatch, Argument: "NatGateways[].State",
  777. Expected: "deleting",
  778. },
  779. {
  780. State: request.FailureWaiterState,
  781. Matcher: request.PathAnyWaiterMatch, Argument: "NatGateways[].State",
  782. Expected: "deleted",
  783. },
  784. {
  785. State: request.RetryWaiterState,
  786. Matcher: request.ErrorWaiterMatch,
  787. Expected: "NatGatewayNotFound",
  788. },
  789. },
  790. Logger: c.Config.Logger,
  791. NewRequest: func(opts []request.Option) (*request.Request, error) {
  792. var inCpy *DescribeNatGatewaysInput
  793. if input != nil {
  794. tmp := *input
  795. inCpy = &tmp
  796. }
  797. req, _ := c.DescribeNatGatewaysRequest(inCpy)
  798. req.SetContext(ctx)
  799. req.ApplyOptions(opts...)
  800. return req, nil
  801. },
  802. }
  803. w.ApplyOptions(opts...)
  804. return w.WaitWithContext(ctx)
  805. }
  806. // WaitUntilNetworkInterfaceAvailable uses the Amazon EC2 API operation
  807. // DescribeNetworkInterfaces to wait for a condition to be met before returning.
  808. // If the condition is not met within the max attempt window, an error will
  809. // be returned.
  810. func (c *EC2) WaitUntilNetworkInterfaceAvailable(input *DescribeNetworkInterfacesInput) error {
  811. return c.WaitUntilNetworkInterfaceAvailableWithContext(aws.BackgroundContext(), input)
  812. }
  813. // WaitUntilNetworkInterfaceAvailableWithContext is an extended version of WaitUntilNetworkInterfaceAvailable.
  814. // With the support for passing in a context and options to configure the
  815. // Waiter and the underlying request options.
  816. //
  817. // The context must be non-nil and will be used for request cancellation. If
  818. // the context is nil a panic will occur. In the future the SDK may create
  819. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  820. // for more information on using Contexts.
  821. func (c *EC2) WaitUntilNetworkInterfaceAvailableWithContext(ctx aws.Context, input *DescribeNetworkInterfacesInput, opts ...request.WaiterOption) error {
  822. w := request.Waiter{
  823. Name: "WaitUntilNetworkInterfaceAvailable",
  824. MaxAttempts: 10,
  825. Delay: request.ConstantWaiterDelay(20 * time.Second),
  826. Acceptors: []request.WaiterAcceptor{
  827. {
  828. State: request.SuccessWaiterState,
  829. Matcher: request.PathAllWaiterMatch, Argument: "NetworkInterfaces[].Status",
  830. Expected: "available",
  831. },
  832. {
  833. State: request.FailureWaiterState,
  834. Matcher: request.ErrorWaiterMatch,
  835. Expected: "InvalidNetworkInterfaceID.NotFound",
  836. },
  837. },
  838. Logger: c.Config.Logger,
  839. NewRequest: func(opts []request.Option) (*request.Request, error) {
  840. var inCpy *DescribeNetworkInterfacesInput
  841. if input != nil {
  842. tmp := *input
  843. inCpy = &tmp
  844. }
  845. req, _ := c.DescribeNetworkInterfacesRequest(inCpy)
  846. req.SetContext(ctx)
  847. req.ApplyOptions(opts...)
  848. return req, nil
  849. },
  850. }
  851. w.ApplyOptions(opts...)
  852. return w.WaitWithContext(ctx)
  853. }
  854. // WaitUntilPasswordDataAvailable uses the Amazon EC2 API operation
  855. // GetPasswordData to wait for a condition to be met before returning.
  856. // If the condition is not met within the max attempt window, an error will
  857. // be returned.
  858. func (c *EC2) WaitUntilPasswordDataAvailable(input *GetPasswordDataInput) error {
  859. return c.WaitUntilPasswordDataAvailableWithContext(aws.BackgroundContext(), input)
  860. }
  861. // WaitUntilPasswordDataAvailableWithContext is an extended version of WaitUntilPasswordDataAvailable.
  862. // With the support for passing in a context and options to configure the
  863. // Waiter and the underlying request options.
  864. //
  865. // The context must be non-nil and will be used for request cancellation. If
  866. // the context is nil a panic will occur. In the future the SDK may create
  867. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  868. // for more information on using Contexts.
  869. func (c *EC2) WaitUntilPasswordDataAvailableWithContext(ctx aws.Context, input *GetPasswordDataInput, opts ...request.WaiterOption) error {
  870. w := request.Waiter{
  871. Name: "WaitUntilPasswordDataAvailable",
  872. MaxAttempts: 40,
  873. Delay: request.ConstantWaiterDelay(15 * time.Second),
  874. Acceptors: []request.WaiterAcceptor{
  875. {
  876. State: request.SuccessWaiterState,
  877. Matcher: request.PathWaiterMatch, Argument: "length(PasswordData) > `0`",
  878. Expected: true,
  879. },
  880. },
  881. Logger: c.Config.Logger,
  882. NewRequest: func(opts []request.Option) (*request.Request, error) {
  883. var inCpy *GetPasswordDataInput
  884. if input != nil {
  885. tmp := *input
  886. inCpy = &tmp
  887. }
  888. req, _ := c.GetPasswordDataRequest(inCpy)
  889. req.SetContext(ctx)
  890. req.ApplyOptions(opts...)
  891. return req, nil
  892. },
  893. }
  894. w.ApplyOptions(opts...)
  895. return w.WaitWithContext(ctx)
  896. }
  897. // WaitUntilSnapshotCompleted uses the Amazon EC2 API operation
  898. // DescribeSnapshots to wait for a condition to be met before returning.
  899. // If the condition is not met within the max attempt window, an error will
  900. // be returned.
  901. func (c *EC2) WaitUntilSnapshotCompleted(input *DescribeSnapshotsInput) error {
  902. return c.WaitUntilSnapshotCompletedWithContext(aws.BackgroundContext(), input)
  903. }
  904. // WaitUntilSnapshotCompletedWithContext is an extended version of WaitUntilSnapshotCompleted.
  905. // With the support for passing in a context and options to configure the
  906. // Waiter and the underlying request options.
  907. //
  908. // The context must be non-nil and will be used for request cancellation. If
  909. // the context is nil a panic will occur. In the future the SDK may create
  910. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  911. // for more information on using Contexts.
  912. func (c *EC2) WaitUntilSnapshotCompletedWithContext(ctx aws.Context, input *DescribeSnapshotsInput, opts ...request.WaiterOption) error {
  913. w := request.Waiter{
  914. Name: "WaitUntilSnapshotCompleted",
  915. MaxAttempts: 40,
  916. Delay: request.ConstantWaiterDelay(15 * time.Second),
  917. Acceptors: []request.WaiterAcceptor{
  918. {
  919. State: request.SuccessWaiterState,
  920. Matcher: request.PathAllWaiterMatch, Argument: "Snapshots[].State",
  921. Expected: "completed",
  922. },
  923. },
  924. Logger: c.Config.Logger,
  925. NewRequest: func(opts []request.Option) (*request.Request, error) {
  926. var inCpy *DescribeSnapshotsInput
  927. if input != nil {
  928. tmp := *input
  929. inCpy = &tmp
  930. }
  931. req, _ := c.DescribeSnapshotsRequest(inCpy)
  932. req.SetContext(ctx)
  933. req.ApplyOptions(opts...)
  934. return req, nil
  935. },
  936. }
  937. w.ApplyOptions(opts...)
  938. return w.WaitWithContext(ctx)
  939. }
  940. // WaitUntilSpotInstanceRequestFulfilled uses the Amazon EC2 API operation
  941. // DescribeSpotInstanceRequests to wait for a condition to be met before returning.
  942. // If the condition is not met within the max attempt window, an error will
  943. // be returned.
  944. func (c *EC2) WaitUntilSpotInstanceRequestFulfilled(input *DescribeSpotInstanceRequestsInput) error {
  945. return c.WaitUntilSpotInstanceRequestFulfilledWithContext(aws.BackgroundContext(), input)
  946. }
  947. // WaitUntilSpotInstanceRequestFulfilledWithContext is an extended version of WaitUntilSpotInstanceRequestFulfilled.
  948. // With the support for passing in a context and options to configure the
  949. // Waiter and the underlying request options.
  950. //
  951. // The context must be non-nil and will be used for request cancellation. If
  952. // the context is nil a panic will occur. In the future the SDK may create
  953. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  954. // for more information on using Contexts.
  955. func (c *EC2) WaitUntilSpotInstanceRequestFulfilledWithContext(ctx aws.Context, input *DescribeSpotInstanceRequestsInput, opts ...request.WaiterOption) error {
  956. w := request.Waiter{
  957. Name: "WaitUntilSpotInstanceRequestFulfilled",
  958. MaxAttempts: 40,
  959. Delay: request.ConstantWaiterDelay(15 * time.Second),
  960. Acceptors: []request.WaiterAcceptor{
  961. {
  962. State: request.SuccessWaiterState,
  963. Matcher: request.PathAllWaiterMatch, Argument: "SpotInstanceRequests[].Status.Code",
  964. Expected: "fulfilled",
  965. },
  966. {
  967. State: request.SuccessWaiterState,
  968. Matcher: request.PathAllWaiterMatch, Argument: "SpotInstanceRequests[].Status.Code",
  969. Expected: "request-canceled-and-instance-running",
  970. },
  971. {
  972. State: request.FailureWaiterState,
  973. Matcher: request.PathAnyWaiterMatch, Argument: "SpotInstanceRequests[].Status.Code",
  974. Expected: "schedule-expired",
  975. },
  976. {
  977. State: request.FailureWaiterState,
  978. Matcher: request.PathAnyWaiterMatch, Argument: "SpotInstanceRequests[].Status.Code",
  979. Expected: "canceled-before-fulfillment",
  980. },
  981. {
  982. State: request.FailureWaiterState,
  983. Matcher: request.PathAnyWaiterMatch, Argument: "SpotInstanceRequests[].Status.Code",
  984. Expected: "bad-parameters",
  985. },
  986. {
  987. State: request.FailureWaiterState,
  988. Matcher: request.PathAnyWaiterMatch, Argument: "SpotInstanceRequests[].Status.Code",
  989. Expected: "system-error",
  990. },
  991. {
  992. State: request.RetryWaiterState,
  993. Matcher: request.ErrorWaiterMatch,
  994. Expected: "InvalidSpotInstanceRequestID.NotFound",
  995. },
  996. },
  997. Logger: c.Config.Logger,
  998. NewRequest: func(opts []request.Option) (*request.Request, error) {
  999. var inCpy *DescribeSpotInstanceRequestsInput
  1000. if input != nil {
  1001. tmp := *input
  1002. inCpy = &tmp
  1003. }
  1004. req, _ := c.DescribeSpotInstanceRequestsRequest(inCpy)
  1005. req.SetContext(ctx)
  1006. req.ApplyOptions(opts...)
  1007. return req, nil
  1008. },
  1009. }
  1010. w.ApplyOptions(opts...)
  1011. return w.WaitWithContext(ctx)
  1012. }
  1013. // WaitUntilSubnetAvailable uses the Amazon EC2 API operation
  1014. // DescribeSubnets to wait for a condition to be met before returning.
  1015. // If the condition is not met within the max attempt window, an error will
  1016. // be returned.
  1017. func (c *EC2) WaitUntilSubnetAvailable(input *DescribeSubnetsInput) error {
  1018. return c.WaitUntilSubnetAvailableWithContext(aws.BackgroundContext(), input)
  1019. }
  1020. // WaitUntilSubnetAvailableWithContext is an extended version of WaitUntilSubnetAvailable.
  1021. // With the support for passing in a context and options to configure the
  1022. // Waiter and the underlying request options.
  1023. //
  1024. // The context must be non-nil and will be used for request cancellation. If
  1025. // the context is nil a panic will occur. In the future the SDK may create
  1026. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1027. // for more information on using Contexts.
  1028. func (c *EC2) WaitUntilSubnetAvailableWithContext(ctx aws.Context, input *DescribeSubnetsInput, opts ...request.WaiterOption) error {
  1029. w := request.Waiter{
  1030. Name: "WaitUntilSubnetAvailable",
  1031. MaxAttempts: 40,
  1032. Delay: request.ConstantWaiterDelay(15 * time.Second),
  1033. Acceptors: []request.WaiterAcceptor{
  1034. {
  1035. State: request.SuccessWaiterState,
  1036. Matcher: request.PathAllWaiterMatch, Argument: "Subnets[].State",
  1037. Expected: "available",
  1038. },
  1039. },
  1040. Logger: c.Config.Logger,
  1041. NewRequest: func(opts []request.Option) (*request.Request, error) {
  1042. var inCpy *DescribeSubnetsInput
  1043. if input != nil {
  1044. tmp := *input
  1045. inCpy = &tmp
  1046. }
  1047. req, _ := c.DescribeSubnetsRequest(inCpy)
  1048. req.SetContext(ctx)
  1049. req.ApplyOptions(opts...)
  1050. return req, nil
  1051. },
  1052. }
  1053. w.ApplyOptions(opts...)
  1054. return w.WaitWithContext(ctx)
  1055. }
  1056. // WaitUntilSystemStatusOk uses the Amazon EC2 API operation
  1057. // DescribeInstanceStatus to wait for a condition to be met before returning.
  1058. // If the condition is not met within the max attempt window, an error will
  1059. // be returned.
  1060. func (c *EC2) WaitUntilSystemStatusOk(input *DescribeInstanceStatusInput) error {
  1061. return c.WaitUntilSystemStatusOkWithContext(aws.BackgroundContext(), input)
  1062. }
  1063. // WaitUntilSystemStatusOkWithContext is an extended version of WaitUntilSystemStatusOk.
  1064. // With the support for passing in a context and options to configure the
  1065. // Waiter and the underlying request options.
  1066. //
  1067. // The context must be non-nil and will be used for request cancellation. If
  1068. // the context is nil a panic will occur. In the future the SDK may create
  1069. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1070. // for more information on using Contexts.
  1071. func (c *EC2) WaitUntilSystemStatusOkWithContext(ctx aws.Context, input *DescribeInstanceStatusInput, opts ...request.WaiterOption) error {
  1072. w := request.Waiter{
  1073. Name: "WaitUntilSystemStatusOk",
  1074. MaxAttempts: 40,
  1075. Delay: request.ConstantWaiterDelay(15 * time.Second),
  1076. Acceptors: []request.WaiterAcceptor{
  1077. {
  1078. State: request.SuccessWaiterState,
  1079. Matcher: request.PathAllWaiterMatch, Argument: "InstanceStatuses[].SystemStatus.Status",
  1080. Expected: "ok",
  1081. },
  1082. },
  1083. Logger: c.Config.Logger,
  1084. NewRequest: func(opts []request.Option) (*request.Request, error) {
  1085. var inCpy *DescribeInstanceStatusInput
  1086. if input != nil {
  1087. tmp := *input
  1088. inCpy = &tmp
  1089. }
  1090. req, _ := c.DescribeInstanceStatusRequest(inCpy)
  1091. req.SetContext(ctx)
  1092. req.ApplyOptions(opts...)
  1093. return req, nil
  1094. },
  1095. }
  1096. w.ApplyOptions(opts...)
  1097. return w.WaitWithContext(ctx)
  1098. }
  1099. // WaitUntilVolumeAvailable uses the Amazon EC2 API operation
  1100. // DescribeVolumes to wait for a condition to be met before returning.
  1101. // If the condition is not met within the max attempt window, an error will
  1102. // be returned.
  1103. func (c *EC2) WaitUntilVolumeAvailable(input *DescribeVolumesInput) error {
  1104. return c.WaitUntilVolumeAvailableWithContext(aws.BackgroundContext(), input)
  1105. }
  1106. // WaitUntilVolumeAvailableWithContext is an extended version of WaitUntilVolumeAvailable.
  1107. // With the support for passing in a context and options to configure the
  1108. // Waiter and the underlying request options.
  1109. //
  1110. // The context must be non-nil and will be used for request cancellation. If
  1111. // the context is nil a panic will occur. In the future the SDK may create
  1112. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1113. // for more information on using Contexts.
  1114. func (c *EC2) WaitUntilVolumeAvailableWithContext(ctx aws.Context, input *DescribeVolumesInput, opts ...request.WaiterOption) error {
  1115. w := request.Waiter{
  1116. Name: "WaitUntilVolumeAvailable",
  1117. MaxAttempts: 40,
  1118. Delay: request.ConstantWaiterDelay(15 * time.Second),
  1119. Acceptors: []request.WaiterAcceptor{
  1120. {
  1121. State: request.SuccessWaiterState,
  1122. Matcher: request.PathAllWaiterMatch, Argument: "Volumes[].State",
  1123. Expected: "available",
  1124. },
  1125. {
  1126. State: request.FailureWaiterState,
  1127. Matcher: request.PathAnyWaiterMatch, Argument: "Volumes[].State",
  1128. Expected: "deleted",
  1129. },
  1130. },
  1131. Logger: c.Config.Logger,
  1132. NewRequest: func(opts []request.Option) (*request.Request, error) {
  1133. var inCpy *DescribeVolumesInput
  1134. if input != nil {
  1135. tmp := *input
  1136. inCpy = &tmp
  1137. }
  1138. req, _ := c.DescribeVolumesRequest(inCpy)
  1139. req.SetContext(ctx)
  1140. req.ApplyOptions(opts...)
  1141. return req, nil
  1142. },
  1143. }
  1144. w.ApplyOptions(opts...)
  1145. return w.WaitWithContext(ctx)
  1146. }
  1147. // WaitUntilVolumeDeleted uses the Amazon EC2 API operation
  1148. // DescribeVolumes to wait for a condition to be met before returning.
  1149. // If the condition is not met within the max attempt window, an error will
  1150. // be returned.
  1151. func (c *EC2) WaitUntilVolumeDeleted(input *DescribeVolumesInput) error {
  1152. return c.WaitUntilVolumeDeletedWithContext(aws.BackgroundContext(), input)
  1153. }
  1154. // WaitUntilVolumeDeletedWithContext is an extended version of WaitUntilVolumeDeleted.
  1155. // With the support for passing in a context and options to configure the
  1156. // Waiter and the underlying request options.
  1157. //
  1158. // The context must be non-nil and will be used for request cancellation. If
  1159. // the context is nil a panic will occur. In the future the SDK may create
  1160. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1161. // for more information on using Contexts.
  1162. func (c *EC2) WaitUntilVolumeDeletedWithContext(ctx aws.Context, input *DescribeVolumesInput, opts ...request.WaiterOption) error {
  1163. w := request.Waiter{
  1164. Name: "WaitUntilVolumeDeleted",
  1165. MaxAttempts: 40,
  1166. Delay: request.ConstantWaiterDelay(15 * time.Second),
  1167. Acceptors: []request.WaiterAcceptor{
  1168. {
  1169. State: request.SuccessWaiterState,
  1170. Matcher: request.PathAllWaiterMatch, Argument: "Volumes[].State",
  1171. Expected: "deleted",
  1172. },
  1173. {
  1174. State: request.SuccessWaiterState,
  1175. Matcher: request.ErrorWaiterMatch,
  1176. Expected: "InvalidVolume.NotFound",
  1177. },
  1178. },
  1179. Logger: c.Config.Logger,
  1180. NewRequest: func(opts []request.Option) (*request.Request, error) {
  1181. var inCpy *DescribeVolumesInput
  1182. if input != nil {
  1183. tmp := *input
  1184. inCpy = &tmp
  1185. }
  1186. req, _ := c.DescribeVolumesRequest(inCpy)
  1187. req.SetContext(ctx)
  1188. req.ApplyOptions(opts...)
  1189. return req, nil
  1190. },
  1191. }
  1192. w.ApplyOptions(opts...)
  1193. return w.WaitWithContext(ctx)
  1194. }
  1195. // WaitUntilVolumeInUse uses the Amazon EC2 API operation
  1196. // DescribeVolumes to wait for a condition to be met before returning.
  1197. // If the condition is not met within the max attempt window, an error will
  1198. // be returned.
  1199. func (c *EC2) WaitUntilVolumeInUse(input *DescribeVolumesInput) error {
  1200. return c.WaitUntilVolumeInUseWithContext(aws.BackgroundContext(), input)
  1201. }
  1202. // WaitUntilVolumeInUseWithContext is an extended version of WaitUntilVolumeInUse.
  1203. // With the support for passing in a context and options to configure the
  1204. // Waiter and the underlying request options.
  1205. //
  1206. // The context must be non-nil and will be used for request cancellation. If
  1207. // the context is nil a panic will occur. In the future the SDK may create
  1208. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1209. // for more information on using Contexts.
  1210. func (c *EC2) WaitUntilVolumeInUseWithContext(ctx aws.Context, input *DescribeVolumesInput, opts ...request.WaiterOption) error {
  1211. w := request.Waiter{
  1212. Name: "WaitUntilVolumeInUse",
  1213. MaxAttempts: 40,
  1214. Delay: request.ConstantWaiterDelay(15 * time.Second),
  1215. Acceptors: []request.WaiterAcceptor{
  1216. {
  1217. State: request.SuccessWaiterState,
  1218. Matcher: request.PathAllWaiterMatch, Argument: "Volumes[].State",
  1219. Expected: "in-use",
  1220. },
  1221. {
  1222. State: request.FailureWaiterState,
  1223. Matcher: request.PathAnyWaiterMatch, Argument: "Volumes[].State",
  1224. Expected: "deleted",
  1225. },
  1226. },
  1227. Logger: c.Config.Logger,
  1228. NewRequest: func(opts []request.Option) (*request.Request, error) {
  1229. var inCpy *DescribeVolumesInput
  1230. if input != nil {
  1231. tmp := *input
  1232. inCpy = &tmp
  1233. }
  1234. req, _ := c.DescribeVolumesRequest(inCpy)
  1235. req.SetContext(ctx)
  1236. req.ApplyOptions(opts...)
  1237. return req, nil
  1238. },
  1239. }
  1240. w.ApplyOptions(opts...)
  1241. return w.WaitWithContext(ctx)
  1242. }
  1243. // WaitUntilVpcAvailable uses the Amazon EC2 API operation
  1244. // DescribeVpcs to wait for a condition to be met before returning.
  1245. // If the condition is not met within the max attempt window, an error will
  1246. // be returned.
  1247. func (c *EC2) WaitUntilVpcAvailable(input *DescribeVpcsInput) error {
  1248. return c.WaitUntilVpcAvailableWithContext(aws.BackgroundContext(), input)
  1249. }
  1250. // WaitUntilVpcAvailableWithContext is an extended version of WaitUntilVpcAvailable.
  1251. // With the support for passing in a context and options to configure the
  1252. // Waiter and the underlying request options.
  1253. //
  1254. // The context must be non-nil and will be used for request cancellation. If
  1255. // the context is nil a panic will occur. In the future the SDK may create
  1256. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1257. // for more information on using Contexts.
  1258. func (c *EC2) WaitUntilVpcAvailableWithContext(ctx aws.Context, input *DescribeVpcsInput, opts ...request.WaiterOption) error {
  1259. w := request.Waiter{
  1260. Name: "WaitUntilVpcAvailable",
  1261. MaxAttempts: 40,
  1262. Delay: request.ConstantWaiterDelay(15 * time.Second),
  1263. Acceptors: []request.WaiterAcceptor{
  1264. {
  1265. State: request.SuccessWaiterState,
  1266. Matcher: request.PathAllWaiterMatch, Argument: "Vpcs[].State",
  1267. Expected: "available",
  1268. },
  1269. },
  1270. Logger: c.Config.Logger,
  1271. NewRequest: func(opts []request.Option) (*request.Request, error) {
  1272. var inCpy *DescribeVpcsInput
  1273. if input != nil {
  1274. tmp := *input
  1275. inCpy = &tmp
  1276. }
  1277. req, _ := c.DescribeVpcsRequest(inCpy)
  1278. req.SetContext(ctx)
  1279. req.ApplyOptions(opts...)
  1280. return req, nil
  1281. },
  1282. }
  1283. w.ApplyOptions(opts...)
  1284. return w.WaitWithContext(ctx)
  1285. }
  1286. // WaitUntilVpcExists uses the Amazon EC2 API operation
  1287. // DescribeVpcs to wait for a condition to be met before returning.
  1288. // If the condition is not met within the max attempt window, an error will
  1289. // be returned.
  1290. func (c *EC2) WaitUntilVpcExists(input *DescribeVpcsInput) error {
  1291. return c.WaitUntilVpcExistsWithContext(aws.BackgroundContext(), input)
  1292. }
  1293. // WaitUntilVpcExistsWithContext is an extended version of WaitUntilVpcExists.
  1294. // With the support for passing in a context and options to configure the
  1295. // Waiter and the underlying request options.
  1296. //
  1297. // The context must be non-nil and will be used for request cancellation. If
  1298. // the context is nil a panic will occur. In the future the SDK may create
  1299. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1300. // for more information on using Contexts.
  1301. func (c *EC2) WaitUntilVpcExistsWithContext(ctx aws.Context, input *DescribeVpcsInput, opts ...request.WaiterOption) error {
  1302. w := request.Waiter{
  1303. Name: "WaitUntilVpcExists",
  1304. MaxAttempts: 5,
  1305. Delay: request.ConstantWaiterDelay(1 * time.Second),
  1306. Acceptors: []request.WaiterAcceptor{
  1307. {
  1308. State: request.SuccessWaiterState,
  1309. Matcher: request.StatusWaiterMatch,
  1310. Expected: 200,
  1311. },
  1312. {
  1313. State: request.RetryWaiterState,
  1314. Matcher: request.ErrorWaiterMatch,
  1315. Expected: "InvalidVpcID.NotFound",
  1316. },
  1317. },
  1318. Logger: c.Config.Logger,
  1319. NewRequest: func(opts []request.Option) (*request.Request, error) {
  1320. var inCpy *DescribeVpcsInput
  1321. if input != nil {
  1322. tmp := *input
  1323. inCpy = &tmp
  1324. }
  1325. req, _ := c.DescribeVpcsRequest(inCpy)
  1326. req.SetContext(ctx)
  1327. req.ApplyOptions(opts...)
  1328. return req, nil
  1329. },
  1330. }
  1331. w.ApplyOptions(opts...)
  1332. return w.WaitWithContext(ctx)
  1333. }
  1334. // WaitUntilVpcPeeringConnectionDeleted uses the Amazon EC2 API operation
  1335. // DescribeVpcPeeringConnections to wait for a condition to be met before returning.
  1336. // If the condition is not met within the max attempt window, an error will
  1337. // be returned.
  1338. func (c *EC2) WaitUntilVpcPeeringConnectionDeleted(input *DescribeVpcPeeringConnectionsInput) error {
  1339. return c.WaitUntilVpcPeeringConnectionDeletedWithContext(aws.BackgroundContext(), input)
  1340. }
  1341. // WaitUntilVpcPeeringConnectionDeletedWithContext is an extended version of WaitUntilVpcPeeringConnectionDeleted.
  1342. // With the support for passing in a context and options to configure the
  1343. // Waiter and the underlying request options.
  1344. //
  1345. // The context must be non-nil and will be used for request cancellation. If
  1346. // the context is nil a panic will occur. In the future the SDK may create
  1347. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1348. // for more information on using Contexts.
  1349. func (c *EC2) WaitUntilVpcPeeringConnectionDeletedWithContext(ctx aws.Context, input *DescribeVpcPeeringConnectionsInput, opts ...request.WaiterOption) error {
  1350. w := request.Waiter{
  1351. Name: "WaitUntilVpcPeeringConnectionDeleted",
  1352. MaxAttempts: 40,
  1353. Delay: request.ConstantWaiterDelay(15 * time.Second),
  1354. Acceptors: []request.WaiterAcceptor{
  1355. {
  1356. State: request.SuccessWaiterState,
  1357. Matcher: request.PathAllWaiterMatch, Argument: "VpcPeeringConnections[].Status.Code",
  1358. Expected: "deleted",
  1359. },
  1360. {
  1361. State: request.SuccessWaiterState,
  1362. Matcher: request.ErrorWaiterMatch,
  1363. Expected: "InvalidVpcPeeringConnectionID.NotFound",
  1364. },
  1365. },
  1366. Logger: c.Config.Logger,
  1367. NewRequest: func(opts []request.Option) (*request.Request, error) {
  1368. var inCpy *DescribeVpcPeeringConnectionsInput
  1369. if input != nil {
  1370. tmp := *input
  1371. inCpy = &tmp
  1372. }
  1373. req, _ := c.DescribeVpcPeeringConnectionsRequest(inCpy)
  1374. req.SetContext(ctx)
  1375. req.ApplyOptions(opts...)
  1376. return req, nil
  1377. },
  1378. }
  1379. w.ApplyOptions(opts...)
  1380. return w.WaitWithContext(ctx)
  1381. }
  1382. // WaitUntilVpcPeeringConnectionExists uses the Amazon EC2 API operation
  1383. // DescribeVpcPeeringConnections to wait for a condition to be met before returning.
  1384. // If the condition is not met within the max attempt window, an error will
  1385. // be returned.
  1386. func (c *EC2) WaitUntilVpcPeeringConnectionExists(input *DescribeVpcPeeringConnectionsInput) error {
  1387. return c.WaitUntilVpcPeeringConnectionExistsWithContext(aws.BackgroundContext(), input)
  1388. }
  1389. // WaitUntilVpcPeeringConnectionExistsWithContext is an extended version of WaitUntilVpcPeeringConnectionExists.
  1390. // With the support for passing in a context and options to configure the
  1391. // Waiter and the underlying request options.
  1392. //
  1393. // The context must be non-nil and will be used for request cancellation. If
  1394. // the context is nil a panic will occur. In the future the SDK may create
  1395. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1396. // for more information on using Contexts.
  1397. func (c *EC2) WaitUntilVpcPeeringConnectionExistsWithContext(ctx aws.Context, input *DescribeVpcPeeringConnectionsInput, opts ...request.WaiterOption) error {
  1398. w := request.Waiter{
  1399. Name: "WaitUntilVpcPeeringConnectionExists",
  1400. MaxAttempts: 40,
  1401. Delay: request.ConstantWaiterDelay(15 * time.Second),
  1402. Acceptors: []request.WaiterAcceptor{
  1403. {
  1404. State: request.SuccessWaiterState,
  1405. Matcher: request.StatusWaiterMatch,
  1406. Expected: 200,
  1407. },
  1408. {
  1409. State: request.RetryWaiterState,
  1410. Matcher: request.ErrorWaiterMatch,
  1411. Expected: "InvalidVpcPeeringConnectionID.NotFound",
  1412. },
  1413. },
  1414. Logger: c.Config.Logger,
  1415. NewRequest: func(opts []request.Option) (*request.Request, error) {
  1416. var inCpy *DescribeVpcPeeringConnectionsInput
  1417. if input != nil {
  1418. tmp := *input
  1419. inCpy = &tmp
  1420. }
  1421. req, _ := c.DescribeVpcPeeringConnectionsRequest(inCpy)
  1422. req.SetContext(ctx)
  1423. req.ApplyOptions(opts...)
  1424. return req, nil
  1425. },
  1426. }
  1427. w.ApplyOptions(opts...)
  1428. return w.WaitWithContext(ctx)
  1429. }
  1430. // WaitUntilVpnConnectionAvailable uses the Amazon EC2 API operation
  1431. // DescribeVpnConnections to wait for a condition to be met before returning.
  1432. // If the condition is not met within the max attempt window, an error will
  1433. // be returned.
  1434. func (c *EC2) WaitUntilVpnConnectionAvailable(input *DescribeVpnConnectionsInput) error {
  1435. return c.WaitUntilVpnConnectionAvailableWithContext(aws.BackgroundContext(), input)
  1436. }
  1437. // WaitUntilVpnConnectionAvailableWithContext is an extended version of WaitUntilVpnConnectionAvailable.
  1438. // With the support for passing in a context and options to configure the
  1439. // Waiter and the underlying request options.
  1440. //
  1441. // The context must be non-nil and will be used for request cancellation. If
  1442. // the context is nil a panic will occur. In the future the SDK may create
  1443. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1444. // for more information on using Contexts.
  1445. func (c *EC2) WaitUntilVpnConnectionAvailableWithContext(ctx aws.Context, input *DescribeVpnConnectionsInput, opts ...request.WaiterOption) error {
  1446. w := request.Waiter{
  1447. Name: "WaitUntilVpnConnectionAvailable",
  1448. MaxAttempts: 40,
  1449. Delay: request.ConstantWaiterDelay(15 * time.Second),
  1450. Acceptors: []request.WaiterAcceptor{
  1451. {
  1452. State: request.SuccessWaiterState,
  1453. Matcher: request.PathAllWaiterMatch, Argument: "VpnConnections[].State",
  1454. Expected: "available",
  1455. },
  1456. {
  1457. State: request.FailureWaiterState,
  1458. Matcher: request.PathAnyWaiterMatch, Argument: "VpnConnections[].State",
  1459. Expected: "deleting",
  1460. },
  1461. {
  1462. State: request.FailureWaiterState,
  1463. Matcher: request.PathAnyWaiterMatch, Argument: "VpnConnections[].State",
  1464. Expected: "deleted",
  1465. },
  1466. },
  1467. Logger: c.Config.Logger,
  1468. NewRequest: func(opts []request.Option) (*request.Request, error) {
  1469. var inCpy *DescribeVpnConnectionsInput
  1470. if input != nil {
  1471. tmp := *input
  1472. inCpy = &tmp
  1473. }
  1474. req, _ := c.DescribeVpnConnectionsRequest(inCpy)
  1475. req.SetContext(ctx)
  1476. req.ApplyOptions(opts...)
  1477. return req, nil
  1478. },
  1479. }
  1480. w.ApplyOptions(opts...)
  1481. return w.WaitWithContext(ctx)
  1482. }
  1483. // WaitUntilVpnConnectionDeleted uses the Amazon EC2 API operation
  1484. // DescribeVpnConnections to wait for a condition to be met before returning.
  1485. // If the condition is not met within the max attempt window, an error will
  1486. // be returned.
  1487. func (c *EC2) WaitUntilVpnConnectionDeleted(input *DescribeVpnConnectionsInput) error {
  1488. return c.WaitUntilVpnConnectionDeletedWithContext(aws.BackgroundContext(), input)
  1489. }
  1490. // WaitUntilVpnConnectionDeletedWithContext is an extended version of WaitUntilVpnConnectionDeleted.
  1491. // With the support for passing in a context and options to configure the
  1492. // Waiter and the underlying request options.
  1493. //
  1494. // The context must be non-nil and will be used for request cancellation. If
  1495. // the context is nil a panic will occur. In the future the SDK may create
  1496. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1497. // for more information on using Contexts.
  1498. func (c *EC2) WaitUntilVpnConnectionDeletedWithContext(ctx aws.Context, input *DescribeVpnConnectionsInput, opts ...request.WaiterOption) error {
  1499. w := request.Waiter{
  1500. Name: "WaitUntilVpnConnectionDeleted",
  1501. MaxAttempts: 40,
  1502. Delay: request.ConstantWaiterDelay(15 * time.Second),
  1503. Acceptors: []request.WaiterAcceptor{
  1504. {
  1505. State: request.SuccessWaiterState,
  1506. Matcher: request.PathAllWaiterMatch, Argument: "VpnConnections[].State",
  1507. Expected: "deleted",
  1508. },
  1509. {
  1510. State: request.FailureWaiterState,
  1511. Matcher: request.PathAnyWaiterMatch, Argument: "VpnConnections[].State",
  1512. Expected: "pending",
  1513. },
  1514. },
  1515. Logger: c.Config.Logger,
  1516. NewRequest: func(opts []request.Option) (*request.Request, error) {
  1517. var inCpy *DescribeVpnConnectionsInput
  1518. if input != nil {
  1519. tmp := *input
  1520. inCpy = &tmp
  1521. }
  1522. req, _ := c.DescribeVpnConnectionsRequest(inCpy)
  1523. req.SetContext(ctx)
  1524. req.ApplyOptions(opts...)
  1525. return req, nil
  1526. },
  1527. }
  1528. w.ApplyOptions(opts...)
  1529. return w.WaitWithContext(ctx)
  1530. }