waiters.go 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616
  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 meet 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 meet 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 meet 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 meet 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 meet 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 meet 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 meet 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 meet 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 meet 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 meet 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 meet 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 meet 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 meet 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 meet 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 meet 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 meet 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 meet 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 meet 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 meet 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 meet 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.FailureWaiterState,
  968. Matcher: request.PathAnyWaiterMatch, Argument: "SpotInstanceRequests[].Status.Code",
  969. Expected: "schedule-expired",
  970. },
  971. {
  972. State: request.FailureWaiterState,
  973. Matcher: request.PathAnyWaiterMatch, Argument: "SpotInstanceRequests[].Status.Code",
  974. Expected: "canceled-before-fulfillment",
  975. },
  976. {
  977. State: request.FailureWaiterState,
  978. Matcher: request.PathAnyWaiterMatch, Argument: "SpotInstanceRequests[].Status.Code",
  979. Expected: "bad-parameters",
  980. },
  981. {
  982. State: request.FailureWaiterState,
  983. Matcher: request.PathAnyWaiterMatch, Argument: "SpotInstanceRequests[].Status.Code",
  984. Expected: "system-error",
  985. },
  986. },
  987. Logger: c.Config.Logger,
  988. NewRequest: func(opts []request.Option) (*request.Request, error) {
  989. var inCpy *DescribeSpotInstanceRequestsInput
  990. if input != nil {
  991. tmp := *input
  992. inCpy = &tmp
  993. }
  994. req, _ := c.DescribeSpotInstanceRequestsRequest(inCpy)
  995. req.SetContext(ctx)
  996. req.ApplyOptions(opts...)
  997. return req, nil
  998. },
  999. }
  1000. w.ApplyOptions(opts...)
  1001. return w.WaitWithContext(ctx)
  1002. }
  1003. // WaitUntilSubnetAvailable uses the Amazon EC2 API operation
  1004. // DescribeSubnets to wait for a condition to be met before returning.
  1005. // If the condition is not meet within the max attempt window an error will
  1006. // be returned.
  1007. func (c *EC2) WaitUntilSubnetAvailable(input *DescribeSubnetsInput) error {
  1008. return c.WaitUntilSubnetAvailableWithContext(aws.BackgroundContext(), input)
  1009. }
  1010. // WaitUntilSubnetAvailableWithContext is an extended version of WaitUntilSubnetAvailable.
  1011. // With the support for passing in a context and options to configure the
  1012. // Waiter and the underlying request options.
  1013. //
  1014. // The context must be non-nil and will be used for request cancellation. If
  1015. // the context is nil a panic will occur. In the future the SDK may create
  1016. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1017. // for more information on using Contexts.
  1018. func (c *EC2) WaitUntilSubnetAvailableWithContext(ctx aws.Context, input *DescribeSubnetsInput, opts ...request.WaiterOption) error {
  1019. w := request.Waiter{
  1020. Name: "WaitUntilSubnetAvailable",
  1021. MaxAttempts: 40,
  1022. Delay: request.ConstantWaiterDelay(15 * time.Second),
  1023. Acceptors: []request.WaiterAcceptor{
  1024. {
  1025. State: request.SuccessWaiterState,
  1026. Matcher: request.PathAllWaiterMatch, Argument: "Subnets[].State",
  1027. Expected: "available",
  1028. },
  1029. },
  1030. Logger: c.Config.Logger,
  1031. NewRequest: func(opts []request.Option) (*request.Request, error) {
  1032. var inCpy *DescribeSubnetsInput
  1033. if input != nil {
  1034. tmp := *input
  1035. inCpy = &tmp
  1036. }
  1037. req, _ := c.DescribeSubnetsRequest(inCpy)
  1038. req.SetContext(ctx)
  1039. req.ApplyOptions(opts...)
  1040. return req, nil
  1041. },
  1042. }
  1043. w.ApplyOptions(opts...)
  1044. return w.WaitWithContext(ctx)
  1045. }
  1046. // WaitUntilSystemStatusOk uses the Amazon EC2 API operation
  1047. // DescribeInstanceStatus to wait for a condition to be met before returning.
  1048. // If the condition is not meet within the max attempt window an error will
  1049. // be returned.
  1050. func (c *EC2) WaitUntilSystemStatusOk(input *DescribeInstanceStatusInput) error {
  1051. return c.WaitUntilSystemStatusOkWithContext(aws.BackgroundContext(), input)
  1052. }
  1053. // WaitUntilSystemStatusOkWithContext is an extended version of WaitUntilSystemStatusOk.
  1054. // With the support for passing in a context and options to configure the
  1055. // Waiter and the underlying request options.
  1056. //
  1057. // The context must be non-nil and will be used for request cancellation. If
  1058. // the context is nil a panic will occur. In the future the SDK may create
  1059. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1060. // for more information on using Contexts.
  1061. func (c *EC2) WaitUntilSystemStatusOkWithContext(ctx aws.Context, input *DescribeInstanceStatusInput, opts ...request.WaiterOption) error {
  1062. w := request.Waiter{
  1063. Name: "WaitUntilSystemStatusOk",
  1064. MaxAttempts: 40,
  1065. Delay: request.ConstantWaiterDelay(15 * time.Second),
  1066. Acceptors: []request.WaiterAcceptor{
  1067. {
  1068. State: request.SuccessWaiterState,
  1069. Matcher: request.PathAllWaiterMatch, Argument: "InstanceStatuses[].SystemStatus.Status",
  1070. Expected: "ok",
  1071. },
  1072. },
  1073. Logger: c.Config.Logger,
  1074. NewRequest: func(opts []request.Option) (*request.Request, error) {
  1075. var inCpy *DescribeInstanceStatusInput
  1076. if input != nil {
  1077. tmp := *input
  1078. inCpy = &tmp
  1079. }
  1080. req, _ := c.DescribeInstanceStatusRequest(inCpy)
  1081. req.SetContext(ctx)
  1082. req.ApplyOptions(opts...)
  1083. return req, nil
  1084. },
  1085. }
  1086. w.ApplyOptions(opts...)
  1087. return w.WaitWithContext(ctx)
  1088. }
  1089. // WaitUntilVolumeAvailable uses the Amazon EC2 API operation
  1090. // DescribeVolumes to wait for a condition to be met before returning.
  1091. // If the condition is not meet within the max attempt window an error will
  1092. // be returned.
  1093. func (c *EC2) WaitUntilVolumeAvailable(input *DescribeVolumesInput) error {
  1094. return c.WaitUntilVolumeAvailableWithContext(aws.BackgroundContext(), input)
  1095. }
  1096. // WaitUntilVolumeAvailableWithContext is an extended version of WaitUntilVolumeAvailable.
  1097. // With the support for passing in a context and options to configure the
  1098. // Waiter and the underlying request options.
  1099. //
  1100. // The context must be non-nil and will be used for request cancellation. If
  1101. // the context is nil a panic will occur. In the future the SDK may create
  1102. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1103. // for more information on using Contexts.
  1104. func (c *EC2) WaitUntilVolumeAvailableWithContext(ctx aws.Context, input *DescribeVolumesInput, opts ...request.WaiterOption) error {
  1105. w := request.Waiter{
  1106. Name: "WaitUntilVolumeAvailable",
  1107. MaxAttempts: 40,
  1108. Delay: request.ConstantWaiterDelay(15 * time.Second),
  1109. Acceptors: []request.WaiterAcceptor{
  1110. {
  1111. State: request.SuccessWaiterState,
  1112. Matcher: request.PathAllWaiterMatch, Argument: "Volumes[].State",
  1113. Expected: "available",
  1114. },
  1115. {
  1116. State: request.FailureWaiterState,
  1117. Matcher: request.PathAnyWaiterMatch, Argument: "Volumes[].State",
  1118. Expected: "deleted",
  1119. },
  1120. },
  1121. Logger: c.Config.Logger,
  1122. NewRequest: func(opts []request.Option) (*request.Request, error) {
  1123. var inCpy *DescribeVolumesInput
  1124. if input != nil {
  1125. tmp := *input
  1126. inCpy = &tmp
  1127. }
  1128. req, _ := c.DescribeVolumesRequest(inCpy)
  1129. req.SetContext(ctx)
  1130. req.ApplyOptions(opts...)
  1131. return req, nil
  1132. },
  1133. }
  1134. w.ApplyOptions(opts...)
  1135. return w.WaitWithContext(ctx)
  1136. }
  1137. // WaitUntilVolumeDeleted uses the Amazon EC2 API operation
  1138. // DescribeVolumes to wait for a condition to be met before returning.
  1139. // If the condition is not meet within the max attempt window an error will
  1140. // be returned.
  1141. func (c *EC2) WaitUntilVolumeDeleted(input *DescribeVolumesInput) error {
  1142. return c.WaitUntilVolumeDeletedWithContext(aws.BackgroundContext(), input)
  1143. }
  1144. // WaitUntilVolumeDeletedWithContext is an extended version of WaitUntilVolumeDeleted.
  1145. // With the support for passing in a context and options to configure the
  1146. // Waiter and the underlying request options.
  1147. //
  1148. // The context must be non-nil and will be used for request cancellation. If
  1149. // the context is nil a panic will occur. In the future the SDK may create
  1150. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1151. // for more information on using Contexts.
  1152. func (c *EC2) WaitUntilVolumeDeletedWithContext(ctx aws.Context, input *DescribeVolumesInput, opts ...request.WaiterOption) error {
  1153. w := request.Waiter{
  1154. Name: "WaitUntilVolumeDeleted",
  1155. MaxAttempts: 40,
  1156. Delay: request.ConstantWaiterDelay(15 * time.Second),
  1157. Acceptors: []request.WaiterAcceptor{
  1158. {
  1159. State: request.SuccessWaiterState,
  1160. Matcher: request.PathAllWaiterMatch, Argument: "Volumes[].State",
  1161. Expected: "deleted",
  1162. },
  1163. {
  1164. State: request.SuccessWaiterState,
  1165. Matcher: request.ErrorWaiterMatch,
  1166. Expected: "InvalidVolume.NotFound",
  1167. },
  1168. },
  1169. Logger: c.Config.Logger,
  1170. NewRequest: func(opts []request.Option) (*request.Request, error) {
  1171. var inCpy *DescribeVolumesInput
  1172. if input != nil {
  1173. tmp := *input
  1174. inCpy = &tmp
  1175. }
  1176. req, _ := c.DescribeVolumesRequest(inCpy)
  1177. req.SetContext(ctx)
  1178. req.ApplyOptions(opts...)
  1179. return req, nil
  1180. },
  1181. }
  1182. w.ApplyOptions(opts...)
  1183. return w.WaitWithContext(ctx)
  1184. }
  1185. // WaitUntilVolumeInUse uses the Amazon EC2 API operation
  1186. // DescribeVolumes to wait for a condition to be met before returning.
  1187. // If the condition is not meet within the max attempt window an error will
  1188. // be returned.
  1189. func (c *EC2) WaitUntilVolumeInUse(input *DescribeVolumesInput) error {
  1190. return c.WaitUntilVolumeInUseWithContext(aws.BackgroundContext(), input)
  1191. }
  1192. // WaitUntilVolumeInUseWithContext is an extended version of WaitUntilVolumeInUse.
  1193. // With the support for passing in a context and options to configure the
  1194. // Waiter and the underlying request options.
  1195. //
  1196. // The context must be non-nil and will be used for request cancellation. If
  1197. // the context is nil a panic will occur. In the future the SDK may create
  1198. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1199. // for more information on using Contexts.
  1200. func (c *EC2) WaitUntilVolumeInUseWithContext(ctx aws.Context, input *DescribeVolumesInput, opts ...request.WaiterOption) error {
  1201. w := request.Waiter{
  1202. Name: "WaitUntilVolumeInUse",
  1203. MaxAttempts: 40,
  1204. Delay: request.ConstantWaiterDelay(15 * time.Second),
  1205. Acceptors: []request.WaiterAcceptor{
  1206. {
  1207. State: request.SuccessWaiterState,
  1208. Matcher: request.PathAllWaiterMatch, Argument: "Volumes[].State",
  1209. Expected: "in-use",
  1210. },
  1211. {
  1212. State: request.FailureWaiterState,
  1213. Matcher: request.PathAnyWaiterMatch, Argument: "Volumes[].State",
  1214. Expected: "deleted",
  1215. },
  1216. },
  1217. Logger: c.Config.Logger,
  1218. NewRequest: func(opts []request.Option) (*request.Request, error) {
  1219. var inCpy *DescribeVolumesInput
  1220. if input != nil {
  1221. tmp := *input
  1222. inCpy = &tmp
  1223. }
  1224. req, _ := c.DescribeVolumesRequest(inCpy)
  1225. req.SetContext(ctx)
  1226. req.ApplyOptions(opts...)
  1227. return req, nil
  1228. },
  1229. }
  1230. w.ApplyOptions(opts...)
  1231. return w.WaitWithContext(ctx)
  1232. }
  1233. // WaitUntilVpcAvailable uses the Amazon EC2 API operation
  1234. // DescribeVpcs to wait for a condition to be met before returning.
  1235. // If the condition is not meet within the max attempt window an error will
  1236. // be returned.
  1237. func (c *EC2) WaitUntilVpcAvailable(input *DescribeVpcsInput) error {
  1238. return c.WaitUntilVpcAvailableWithContext(aws.BackgroundContext(), input)
  1239. }
  1240. // WaitUntilVpcAvailableWithContext is an extended version of WaitUntilVpcAvailable.
  1241. // With the support for passing in a context and options to configure the
  1242. // Waiter and the underlying request options.
  1243. //
  1244. // The context must be non-nil and will be used for request cancellation. If
  1245. // the context is nil a panic will occur. In the future the SDK may create
  1246. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1247. // for more information on using Contexts.
  1248. func (c *EC2) WaitUntilVpcAvailableWithContext(ctx aws.Context, input *DescribeVpcsInput, opts ...request.WaiterOption) error {
  1249. w := request.Waiter{
  1250. Name: "WaitUntilVpcAvailable",
  1251. MaxAttempts: 40,
  1252. Delay: request.ConstantWaiterDelay(15 * time.Second),
  1253. Acceptors: []request.WaiterAcceptor{
  1254. {
  1255. State: request.SuccessWaiterState,
  1256. Matcher: request.PathAllWaiterMatch, Argument: "Vpcs[].State",
  1257. Expected: "available",
  1258. },
  1259. },
  1260. Logger: c.Config.Logger,
  1261. NewRequest: func(opts []request.Option) (*request.Request, error) {
  1262. var inCpy *DescribeVpcsInput
  1263. if input != nil {
  1264. tmp := *input
  1265. inCpy = &tmp
  1266. }
  1267. req, _ := c.DescribeVpcsRequest(inCpy)
  1268. req.SetContext(ctx)
  1269. req.ApplyOptions(opts...)
  1270. return req, nil
  1271. },
  1272. }
  1273. w.ApplyOptions(opts...)
  1274. return w.WaitWithContext(ctx)
  1275. }
  1276. // WaitUntilVpcExists uses the Amazon EC2 API operation
  1277. // DescribeVpcs to wait for a condition to be met before returning.
  1278. // If the condition is not meet within the max attempt window an error will
  1279. // be returned.
  1280. func (c *EC2) WaitUntilVpcExists(input *DescribeVpcsInput) error {
  1281. return c.WaitUntilVpcExistsWithContext(aws.BackgroundContext(), input)
  1282. }
  1283. // WaitUntilVpcExistsWithContext is an extended version of WaitUntilVpcExists.
  1284. // With the support for passing in a context and options to configure the
  1285. // Waiter and the underlying request options.
  1286. //
  1287. // The context must be non-nil and will be used for request cancellation. If
  1288. // the context is nil a panic will occur. In the future the SDK may create
  1289. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1290. // for more information on using Contexts.
  1291. func (c *EC2) WaitUntilVpcExistsWithContext(ctx aws.Context, input *DescribeVpcsInput, opts ...request.WaiterOption) error {
  1292. w := request.Waiter{
  1293. Name: "WaitUntilVpcExists",
  1294. MaxAttempts: 5,
  1295. Delay: request.ConstantWaiterDelay(1 * time.Second),
  1296. Acceptors: []request.WaiterAcceptor{
  1297. {
  1298. State: request.SuccessWaiterState,
  1299. Matcher: request.StatusWaiterMatch,
  1300. Expected: 200,
  1301. },
  1302. {
  1303. State: request.RetryWaiterState,
  1304. Matcher: request.ErrorWaiterMatch,
  1305. Expected: "InvalidVpcID.NotFound",
  1306. },
  1307. },
  1308. Logger: c.Config.Logger,
  1309. NewRequest: func(opts []request.Option) (*request.Request, error) {
  1310. var inCpy *DescribeVpcsInput
  1311. if input != nil {
  1312. tmp := *input
  1313. inCpy = &tmp
  1314. }
  1315. req, _ := c.DescribeVpcsRequest(inCpy)
  1316. req.SetContext(ctx)
  1317. req.ApplyOptions(opts...)
  1318. return req, nil
  1319. },
  1320. }
  1321. w.ApplyOptions(opts...)
  1322. return w.WaitWithContext(ctx)
  1323. }
  1324. // WaitUntilVpcPeeringConnectionDeleted uses the Amazon EC2 API operation
  1325. // DescribeVpcPeeringConnections to wait for a condition to be met before returning.
  1326. // If the condition is not meet within the max attempt window an error will
  1327. // be returned.
  1328. func (c *EC2) WaitUntilVpcPeeringConnectionDeleted(input *DescribeVpcPeeringConnectionsInput) error {
  1329. return c.WaitUntilVpcPeeringConnectionDeletedWithContext(aws.BackgroundContext(), input)
  1330. }
  1331. // WaitUntilVpcPeeringConnectionDeletedWithContext is an extended version of WaitUntilVpcPeeringConnectionDeleted.
  1332. // With the support for passing in a context and options to configure the
  1333. // Waiter and the underlying request options.
  1334. //
  1335. // The context must be non-nil and will be used for request cancellation. If
  1336. // the context is nil a panic will occur. In the future the SDK may create
  1337. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1338. // for more information on using Contexts.
  1339. func (c *EC2) WaitUntilVpcPeeringConnectionDeletedWithContext(ctx aws.Context, input *DescribeVpcPeeringConnectionsInput, opts ...request.WaiterOption) error {
  1340. w := request.Waiter{
  1341. Name: "WaitUntilVpcPeeringConnectionDeleted",
  1342. MaxAttempts: 40,
  1343. Delay: request.ConstantWaiterDelay(15 * time.Second),
  1344. Acceptors: []request.WaiterAcceptor{
  1345. {
  1346. State: request.SuccessWaiterState,
  1347. Matcher: request.PathAllWaiterMatch, Argument: "VpcPeeringConnections[].Status.Code",
  1348. Expected: "deleted",
  1349. },
  1350. {
  1351. State: request.SuccessWaiterState,
  1352. Matcher: request.ErrorWaiterMatch,
  1353. Expected: "InvalidVpcPeeringConnectionID.NotFound",
  1354. },
  1355. },
  1356. Logger: c.Config.Logger,
  1357. NewRequest: func(opts []request.Option) (*request.Request, error) {
  1358. var inCpy *DescribeVpcPeeringConnectionsInput
  1359. if input != nil {
  1360. tmp := *input
  1361. inCpy = &tmp
  1362. }
  1363. req, _ := c.DescribeVpcPeeringConnectionsRequest(inCpy)
  1364. req.SetContext(ctx)
  1365. req.ApplyOptions(opts...)
  1366. return req, nil
  1367. },
  1368. }
  1369. w.ApplyOptions(opts...)
  1370. return w.WaitWithContext(ctx)
  1371. }
  1372. // WaitUntilVpcPeeringConnectionExists uses the Amazon EC2 API operation
  1373. // DescribeVpcPeeringConnections to wait for a condition to be met before returning.
  1374. // If the condition is not meet within the max attempt window an error will
  1375. // be returned.
  1376. func (c *EC2) WaitUntilVpcPeeringConnectionExists(input *DescribeVpcPeeringConnectionsInput) error {
  1377. return c.WaitUntilVpcPeeringConnectionExistsWithContext(aws.BackgroundContext(), input)
  1378. }
  1379. // WaitUntilVpcPeeringConnectionExistsWithContext is an extended version of WaitUntilVpcPeeringConnectionExists.
  1380. // With the support for passing in a context and options to configure the
  1381. // Waiter and the underlying request options.
  1382. //
  1383. // The context must be non-nil and will be used for request cancellation. If
  1384. // the context is nil a panic will occur. In the future the SDK may create
  1385. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1386. // for more information on using Contexts.
  1387. func (c *EC2) WaitUntilVpcPeeringConnectionExistsWithContext(ctx aws.Context, input *DescribeVpcPeeringConnectionsInput, opts ...request.WaiterOption) error {
  1388. w := request.Waiter{
  1389. Name: "WaitUntilVpcPeeringConnectionExists",
  1390. MaxAttempts: 40,
  1391. Delay: request.ConstantWaiterDelay(15 * time.Second),
  1392. Acceptors: []request.WaiterAcceptor{
  1393. {
  1394. State: request.SuccessWaiterState,
  1395. Matcher: request.StatusWaiterMatch,
  1396. Expected: 200,
  1397. },
  1398. {
  1399. State: request.RetryWaiterState,
  1400. Matcher: request.ErrorWaiterMatch,
  1401. Expected: "InvalidVpcPeeringConnectionID.NotFound",
  1402. },
  1403. },
  1404. Logger: c.Config.Logger,
  1405. NewRequest: func(opts []request.Option) (*request.Request, error) {
  1406. var inCpy *DescribeVpcPeeringConnectionsInput
  1407. if input != nil {
  1408. tmp := *input
  1409. inCpy = &tmp
  1410. }
  1411. req, _ := c.DescribeVpcPeeringConnectionsRequest(inCpy)
  1412. req.SetContext(ctx)
  1413. req.ApplyOptions(opts...)
  1414. return req, nil
  1415. },
  1416. }
  1417. w.ApplyOptions(opts...)
  1418. return w.WaitWithContext(ctx)
  1419. }
  1420. // WaitUntilVpnConnectionAvailable uses the Amazon EC2 API operation
  1421. // DescribeVpnConnections to wait for a condition to be met before returning.
  1422. // If the condition is not meet within the max attempt window an error will
  1423. // be returned.
  1424. func (c *EC2) WaitUntilVpnConnectionAvailable(input *DescribeVpnConnectionsInput) error {
  1425. return c.WaitUntilVpnConnectionAvailableWithContext(aws.BackgroundContext(), input)
  1426. }
  1427. // WaitUntilVpnConnectionAvailableWithContext is an extended version of WaitUntilVpnConnectionAvailable.
  1428. // With the support for passing in a context and options to configure the
  1429. // Waiter and the underlying request options.
  1430. //
  1431. // The context must be non-nil and will be used for request cancellation. If
  1432. // the context is nil a panic will occur. In the future the SDK may create
  1433. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1434. // for more information on using Contexts.
  1435. func (c *EC2) WaitUntilVpnConnectionAvailableWithContext(ctx aws.Context, input *DescribeVpnConnectionsInput, opts ...request.WaiterOption) error {
  1436. w := request.Waiter{
  1437. Name: "WaitUntilVpnConnectionAvailable",
  1438. MaxAttempts: 40,
  1439. Delay: request.ConstantWaiterDelay(15 * time.Second),
  1440. Acceptors: []request.WaiterAcceptor{
  1441. {
  1442. State: request.SuccessWaiterState,
  1443. Matcher: request.PathAllWaiterMatch, Argument: "VpnConnections[].State",
  1444. Expected: "available",
  1445. },
  1446. {
  1447. State: request.FailureWaiterState,
  1448. Matcher: request.PathAnyWaiterMatch, Argument: "VpnConnections[].State",
  1449. Expected: "deleting",
  1450. },
  1451. {
  1452. State: request.FailureWaiterState,
  1453. Matcher: request.PathAnyWaiterMatch, Argument: "VpnConnections[].State",
  1454. Expected: "deleted",
  1455. },
  1456. },
  1457. Logger: c.Config.Logger,
  1458. NewRequest: func(opts []request.Option) (*request.Request, error) {
  1459. var inCpy *DescribeVpnConnectionsInput
  1460. if input != nil {
  1461. tmp := *input
  1462. inCpy = &tmp
  1463. }
  1464. req, _ := c.DescribeVpnConnectionsRequest(inCpy)
  1465. req.SetContext(ctx)
  1466. req.ApplyOptions(opts...)
  1467. return req, nil
  1468. },
  1469. }
  1470. w.ApplyOptions(opts...)
  1471. return w.WaitWithContext(ctx)
  1472. }
  1473. // WaitUntilVpnConnectionDeleted uses the Amazon EC2 API operation
  1474. // DescribeVpnConnections to wait for a condition to be met before returning.
  1475. // If the condition is not meet within the max attempt window an error will
  1476. // be returned.
  1477. func (c *EC2) WaitUntilVpnConnectionDeleted(input *DescribeVpnConnectionsInput) error {
  1478. return c.WaitUntilVpnConnectionDeletedWithContext(aws.BackgroundContext(), input)
  1479. }
  1480. // WaitUntilVpnConnectionDeletedWithContext is an extended version of WaitUntilVpnConnectionDeleted.
  1481. // With the support for passing in a context and options to configure the
  1482. // Waiter and the underlying request options.
  1483. //
  1484. // The context must be non-nil and will be used for request cancellation. If
  1485. // the context is nil a panic will occur. In the future the SDK may create
  1486. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1487. // for more information on using Contexts.
  1488. func (c *EC2) WaitUntilVpnConnectionDeletedWithContext(ctx aws.Context, input *DescribeVpnConnectionsInput, opts ...request.WaiterOption) error {
  1489. w := request.Waiter{
  1490. Name: "WaitUntilVpnConnectionDeleted",
  1491. MaxAttempts: 40,
  1492. Delay: request.ConstantWaiterDelay(15 * time.Second),
  1493. Acceptors: []request.WaiterAcceptor{
  1494. {
  1495. State: request.SuccessWaiterState,
  1496. Matcher: request.PathAllWaiterMatch, Argument: "VpnConnections[].State",
  1497. Expected: "deleted",
  1498. },
  1499. {
  1500. State: request.FailureWaiterState,
  1501. Matcher: request.PathAnyWaiterMatch, Argument: "VpnConnections[].State",
  1502. Expected: "pending",
  1503. },
  1504. },
  1505. Logger: c.Config.Logger,
  1506. NewRequest: func(opts []request.Option) (*request.Request, error) {
  1507. var inCpy *DescribeVpnConnectionsInput
  1508. if input != nil {
  1509. tmp := *input
  1510. inCpy = &tmp
  1511. }
  1512. req, _ := c.DescribeVpnConnectionsRequest(inCpy)
  1513. req.SetContext(ctx)
  1514. req.ApplyOptions(opts...)
  1515. return req, nil
  1516. },
  1517. }
  1518. w.ApplyOptions(opts...)
  1519. return w.WaitWithContext(ctx)
  1520. }