github.com/aavshr/aws-sdk-go@v1.41.3/service/ec2/waiters.go (about)

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