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

     1  // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
     2  
     3  package rds
     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  // WaitUntilDBClusterSnapshotAvailable uses the Amazon RDS API operation
    13  // DescribeDBClusterSnapshots 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 *RDS) WaitUntilDBClusterSnapshotAvailable(input *DescribeDBClusterSnapshotsInput) error {
    17  	return c.WaitUntilDBClusterSnapshotAvailableWithContext(aws.BackgroundContext(), input)
    18  }
    19  
    20  // WaitUntilDBClusterSnapshotAvailableWithContext is an extended version of WaitUntilDBClusterSnapshotAvailable.
    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 *RDS) WaitUntilDBClusterSnapshotAvailableWithContext(ctx aws.Context, input *DescribeDBClusterSnapshotsInput, opts ...request.WaiterOption) error {
    29  	w := request.Waiter{
    30  		Name:        "WaitUntilDBClusterSnapshotAvailable",
    31  		MaxAttempts: 60,
    32  		Delay:       request.ConstantWaiterDelay(30 * time.Second),
    33  		Acceptors: []request.WaiterAcceptor{
    34  			{
    35  				State:   request.SuccessWaiterState,
    36  				Matcher: request.PathAllWaiterMatch, Argument: "DBClusterSnapshots[].Status",
    37  				Expected: "available",
    38  			},
    39  			{
    40  				State:   request.FailureWaiterState,
    41  				Matcher: request.PathAnyWaiterMatch, Argument: "DBClusterSnapshots[].Status",
    42  				Expected: "deleted",
    43  			},
    44  			{
    45  				State:   request.FailureWaiterState,
    46  				Matcher: request.PathAnyWaiterMatch, Argument: "DBClusterSnapshots[].Status",
    47  				Expected: "deleting",
    48  			},
    49  			{
    50  				State:   request.FailureWaiterState,
    51  				Matcher: request.PathAnyWaiterMatch, Argument: "DBClusterSnapshots[].Status",
    52  				Expected: "failed",
    53  			},
    54  			{
    55  				State:   request.FailureWaiterState,
    56  				Matcher: request.PathAnyWaiterMatch, Argument: "DBClusterSnapshots[].Status",
    57  				Expected: "incompatible-restore",
    58  			},
    59  			{
    60  				State:   request.FailureWaiterState,
    61  				Matcher: request.PathAnyWaiterMatch, Argument: "DBClusterSnapshots[].Status",
    62  				Expected: "incompatible-parameters",
    63  			},
    64  		},
    65  		Logger: c.Config.Logger,
    66  		NewRequest: func(opts []request.Option) (*request.Request, error) {
    67  			var inCpy *DescribeDBClusterSnapshotsInput
    68  			if input != nil {
    69  				tmp := *input
    70  				inCpy = &tmp
    71  			}
    72  			req, _ := c.DescribeDBClusterSnapshotsRequest(inCpy)
    73  			req.SetContext(ctx)
    74  			req.ApplyOptions(opts...)
    75  			return req, nil
    76  		},
    77  	}
    78  	w.ApplyOptions(opts...)
    79  
    80  	return w.WaitWithContext(ctx)
    81  }
    82  
    83  // WaitUntilDBClusterSnapshotDeleted uses the Amazon RDS API operation
    84  // DescribeDBClusterSnapshots to wait for a condition to be met before returning.
    85  // If the condition is not met within the max attempt window, an error will
    86  // be returned.
    87  func (c *RDS) WaitUntilDBClusterSnapshotDeleted(input *DescribeDBClusterSnapshotsInput) error {
    88  	return c.WaitUntilDBClusterSnapshotDeletedWithContext(aws.BackgroundContext(), input)
    89  }
    90  
    91  // WaitUntilDBClusterSnapshotDeletedWithContext is an extended version of WaitUntilDBClusterSnapshotDeleted.
    92  // With the support for passing in a context and options to configure the
    93  // Waiter and the underlying request options.
    94  //
    95  // The context must be non-nil and will be used for request cancellation. If
    96  // the context is nil a panic will occur. In the future the SDK may create
    97  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
    98  // for more information on using Contexts.
    99  func (c *RDS) WaitUntilDBClusterSnapshotDeletedWithContext(ctx aws.Context, input *DescribeDBClusterSnapshotsInput, opts ...request.WaiterOption) error {
   100  	w := request.Waiter{
   101  		Name:        "WaitUntilDBClusterSnapshotDeleted",
   102  		MaxAttempts: 60,
   103  		Delay:       request.ConstantWaiterDelay(30 * time.Second),
   104  		Acceptors: []request.WaiterAcceptor{
   105  			{
   106  				State:   request.SuccessWaiterState,
   107  				Matcher: request.PathWaiterMatch, Argument: "length(DBClusterSnapshots) == `0`",
   108  				Expected: true,
   109  			},
   110  			{
   111  				State:    request.SuccessWaiterState,
   112  				Matcher:  request.ErrorWaiterMatch,
   113  				Expected: "DBClusterSnapshotNotFoundFault",
   114  			},
   115  			{
   116  				State:   request.FailureWaiterState,
   117  				Matcher: request.PathAnyWaiterMatch, Argument: "DBClusterSnapshots[].Status",
   118  				Expected: "creating",
   119  			},
   120  			{
   121  				State:   request.FailureWaiterState,
   122  				Matcher: request.PathAnyWaiterMatch, Argument: "DBClusterSnapshots[].Status",
   123  				Expected: "modifying",
   124  			},
   125  			{
   126  				State:   request.FailureWaiterState,
   127  				Matcher: request.PathAnyWaiterMatch, Argument: "DBClusterSnapshots[].Status",
   128  				Expected: "rebooting",
   129  			},
   130  			{
   131  				State:   request.FailureWaiterState,
   132  				Matcher: request.PathAnyWaiterMatch, Argument: "DBClusterSnapshots[].Status",
   133  				Expected: "resetting-master-credentials",
   134  			},
   135  		},
   136  		Logger: c.Config.Logger,
   137  		NewRequest: func(opts []request.Option) (*request.Request, error) {
   138  			var inCpy *DescribeDBClusterSnapshotsInput
   139  			if input != nil {
   140  				tmp := *input
   141  				inCpy = &tmp
   142  			}
   143  			req, _ := c.DescribeDBClusterSnapshotsRequest(inCpy)
   144  			req.SetContext(ctx)
   145  			req.ApplyOptions(opts...)
   146  			return req, nil
   147  		},
   148  	}
   149  	w.ApplyOptions(opts...)
   150  
   151  	return w.WaitWithContext(ctx)
   152  }
   153  
   154  // WaitUntilDBInstanceAvailable uses the Amazon RDS API operation
   155  // DescribeDBInstances to wait for a condition to be met before returning.
   156  // If the condition is not met within the max attempt window, an error will
   157  // be returned.
   158  func (c *RDS) WaitUntilDBInstanceAvailable(input *DescribeDBInstancesInput) error {
   159  	return c.WaitUntilDBInstanceAvailableWithContext(aws.BackgroundContext(), input)
   160  }
   161  
   162  // WaitUntilDBInstanceAvailableWithContext is an extended version of WaitUntilDBInstanceAvailable.
   163  // With the support for passing in a context and options to configure the
   164  // Waiter and the underlying request options.
   165  //
   166  // The context must be non-nil and will be used for request cancellation. If
   167  // the context is nil a panic will occur. In the future the SDK may create
   168  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
   169  // for more information on using Contexts.
   170  func (c *RDS) WaitUntilDBInstanceAvailableWithContext(ctx aws.Context, input *DescribeDBInstancesInput, opts ...request.WaiterOption) error {
   171  	w := request.Waiter{
   172  		Name:        "WaitUntilDBInstanceAvailable",
   173  		MaxAttempts: 60,
   174  		Delay:       request.ConstantWaiterDelay(30 * time.Second),
   175  		Acceptors: []request.WaiterAcceptor{
   176  			{
   177  				State:   request.SuccessWaiterState,
   178  				Matcher: request.PathAllWaiterMatch, Argument: "DBInstances[].DBInstanceStatus",
   179  				Expected: "available",
   180  			},
   181  			{
   182  				State:   request.FailureWaiterState,
   183  				Matcher: request.PathAnyWaiterMatch, Argument: "DBInstances[].DBInstanceStatus",
   184  				Expected: "deleted",
   185  			},
   186  			{
   187  				State:   request.FailureWaiterState,
   188  				Matcher: request.PathAnyWaiterMatch, Argument: "DBInstances[].DBInstanceStatus",
   189  				Expected: "deleting",
   190  			},
   191  			{
   192  				State:   request.FailureWaiterState,
   193  				Matcher: request.PathAnyWaiterMatch, Argument: "DBInstances[].DBInstanceStatus",
   194  				Expected: "failed",
   195  			},
   196  			{
   197  				State:   request.FailureWaiterState,
   198  				Matcher: request.PathAnyWaiterMatch, Argument: "DBInstances[].DBInstanceStatus",
   199  				Expected: "incompatible-restore",
   200  			},
   201  			{
   202  				State:   request.FailureWaiterState,
   203  				Matcher: request.PathAnyWaiterMatch, Argument: "DBInstances[].DBInstanceStatus",
   204  				Expected: "incompatible-parameters",
   205  			},
   206  		},
   207  		Logger: c.Config.Logger,
   208  		NewRequest: func(opts []request.Option) (*request.Request, error) {
   209  			var inCpy *DescribeDBInstancesInput
   210  			if input != nil {
   211  				tmp := *input
   212  				inCpy = &tmp
   213  			}
   214  			req, _ := c.DescribeDBInstancesRequest(inCpy)
   215  			req.SetContext(ctx)
   216  			req.ApplyOptions(opts...)
   217  			return req, nil
   218  		},
   219  	}
   220  	w.ApplyOptions(opts...)
   221  
   222  	return w.WaitWithContext(ctx)
   223  }
   224  
   225  // WaitUntilDBInstanceDeleted uses the Amazon RDS API operation
   226  // DescribeDBInstances to wait for a condition to be met before returning.
   227  // If the condition is not met within the max attempt window, an error will
   228  // be returned.
   229  func (c *RDS) WaitUntilDBInstanceDeleted(input *DescribeDBInstancesInput) error {
   230  	return c.WaitUntilDBInstanceDeletedWithContext(aws.BackgroundContext(), input)
   231  }
   232  
   233  // WaitUntilDBInstanceDeletedWithContext is an extended version of WaitUntilDBInstanceDeleted.
   234  // With the support for passing in a context and options to configure the
   235  // Waiter and the underlying request options.
   236  //
   237  // The context must be non-nil and will be used for request cancellation. If
   238  // the context is nil a panic will occur. In the future the SDK may create
   239  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
   240  // for more information on using Contexts.
   241  func (c *RDS) WaitUntilDBInstanceDeletedWithContext(ctx aws.Context, input *DescribeDBInstancesInput, opts ...request.WaiterOption) error {
   242  	w := request.Waiter{
   243  		Name:        "WaitUntilDBInstanceDeleted",
   244  		MaxAttempts: 60,
   245  		Delay:       request.ConstantWaiterDelay(30 * time.Second),
   246  		Acceptors: []request.WaiterAcceptor{
   247  			{
   248  				State:   request.SuccessWaiterState,
   249  				Matcher: request.PathWaiterMatch, Argument: "length(DBInstances) == `0`",
   250  				Expected: true,
   251  			},
   252  			{
   253  				State:    request.SuccessWaiterState,
   254  				Matcher:  request.ErrorWaiterMatch,
   255  				Expected: "DBInstanceNotFound",
   256  			},
   257  			{
   258  				State:   request.FailureWaiterState,
   259  				Matcher: request.PathAnyWaiterMatch, Argument: "DBInstances[].DBInstanceStatus",
   260  				Expected: "creating",
   261  			},
   262  			{
   263  				State:   request.FailureWaiterState,
   264  				Matcher: request.PathAnyWaiterMatch, Argument: "DBInstances[].DBInstanceStatus",
   265  				Expected: "modifying",
   266  			},
   267  			{
   268  				State:   request.FailureWaiterState,
   269  				Matcher: request.PathAnyWaiterMatch, Argument: "DBInstances[].DBInstanceStatus",
   270  				Expected: "rebooting",
   271  			},
   272  			{
   273  				State:   request.FailureWaiterState,
   274  				Matcher: request.PathAnyWaiterMatch, Argument: "DBInstances[].DBInstanceStatus",
   275  				Expected: "resetting-master-credentials",
   276  			},
   277  		},
   278  		Logger: c.Config.Logger,
   279  		NewRequest: func(opts []request.Option) (*request.Request, error) {
   280  			var inCpy *DescribeDBInstancesInput
   281  			if input != nil {
   282  				tmp := *input
   283  				inCpy = &tmp
   284  			}
   285  			req, _ := c.DescribeDBInstancesRequest(inCpy)
   286  			req.SetContext(ctx)
   287  			req.ApplyOptions(opts...)
   288  			return req, nil
   289  		},
   290  	}
   291  	w.ApplyOptions(opts...)
   292  
   293  	return w.WaitWithContext(ctx)
   294  }
   295  
   296  // WaitUntilDBSnapshotAvailable uses the Amazon RDS API operation
   297  // DescribeDBSnapshots to wait for a condition to be met before returning.
   298  // If the condition is not met within the max attempt window, an error will
   299  // be returned.
   300  func (c *RDS) WaitUntilDBSnapshotAvailable(input *DescribeDBSnapshotsInput) error {
   301  	return c.WaitUntilDBSnapshotAvailableWithContext(aws.BackgroundContext(), input)
   302  }
   303  
   304  // WaitUntilDBSnapshotAvailableWithContext is an extended version of WaitUntilDBSnapshotAvailable.
   305  // With the support for passing in a context and options to configure the
   306  // Waiter and the underlying request options.
   307  //
   308  // The context must be non-nil and will be used for request cancellation. If
   309  // the context is nil a panic will occur. In the future the SDK may create
   310  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
   311  // for more information on using Contexts.
   312  func (c *RDS) WaitUntilDBSnapshotAvailableWithContext(ctx aws.Context, input *DescribeDBSnapshotsInput, opts ...request.WaiterOption) error {
   313  	w := request.Waiter{
   314  		Name:        "WaitUntilDBSnapshotAvailable",
   315  		MaxAttempts: 60,
   316  		Delay:       request.ConstantWaiterDelay(30 * time.Second),
   317  		Acceptors: []request.WaiterAcceptor{
   318  			{
   319  				State:   request.SuccessWaiterState,
   320  				Matcher: request.PathAllWaiterMatch, Argument: "DBSnapshots[].Status",
   321  				Expected: "available",
   322  			},
   323  			{
   324  				State:   request.FailureWaiterState,
   325  				Matcher: request.PathAnyWaiterMatch, Argument: "DBSnapshots[].Status",
   326  				Expected: "deleted",
   327  			},
   328  			{
   329  				State:   request.FailureWaiterState,
   330  				Matcher: request.PathAnyWaiterMatch, Argument: "DBSnapshots[].Status",
   331  				Expected: "deleting",
   332  			},
   333  			{
   334  				State:   request.FailureWaiterState,
   335  				Matcher: request.PathAnyWaiterMatch, Argument: "DBSnapshots[].Status",
   336  				Expected: "failed",
   337  			},
   338  			{
   339  				State:   request.FailureWaiterState,
   340  				Matcher: request.PathAnyWaiterMatch, Argument: "DBSnapshots[].Status",
   341  				Expected: "incompatible-restore",
   342  			},
   343  			{
   344  				State:   request.FailureWaiterState,
   345  				Matcher: request.PathAnyWaiterMatch, Argument: "DBSnapshots[].Status",
   346  				Expected: "incompatible-parameters",
   347  			},
   348  		},
   349  		Logger: c.Config.Logger,
   350  		NewRequest: func(opts []request.Option) (*request.Request, error) {
   351  			var inCpy *DescribeDBSnapshotsInput
   352  			if input != nil {
   353  				tmp := *input
   354  				inCpy = &tmp
   355  			}
   356  			req, _ := c.DescribeDBSnapshotsRequest(inCpy)
   357  			req.SetContext(ctx)
   358  			req.ApplyOptions(opts...)
   359  			return req, nil
   360  		},
   361  	}
   362  	w.ApplyOptions(opts...)
   363  
   364  	return w.WaitWithContext(ctx)
   365  }
   366  
   367  // WaitUntilDBSnapshotDeleted uses the Amazon RDS API operation
   368  // DescribeDBSnapshots to wait for a condition to be met before returning.
   369  // If the condition is not met within the max attempt window, an error will
   370  // be returned.
   371  func (c *RDS) WaitUntilDBSnapshotDeleted(input *DescribeDBSnapshotsInput) error {
   372  	return c.WaitUntilDBSnapshotDeletedWithContext(aws.BackgroundContext(), input)
   373  }
   374  
   375  // WaitUntilDBSnapshotDeletedWithContext is an extended version of WaitUntilDBSnapshotDeleted.
   376  // With the support for passing in a context and options to configure the
   377  // Waiter and the underlying request options.
   378  //
   379  // The context must be non-nil and will be used for request cancellation. If
   380  // the context is nil a panic will occur. In the future the SDK may create
   381  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
   382  // for more information on using Contexts.
   383  func (c *RDS) WaitUntilDBSnapshotDeletedWithContext(ctx aws.Context, input *DescribeDBSnapshotsInput, opts ...request.WaiterOption) error {
   384  	w := request.Waiter{
   385  		Name:        "WaitUntilDBSnapshotDeleted",
   386  		MaxAttempts: 60,
   387  		Delay:       request.ConstantWaiterDelay(30 * time.Second),
   388  		Acceptors: []request.WaiterAcceptor{
   389  			{
   390  				State:   request.SuccessWaiterState,
   391  				Matcher: request.PathWaiterMatch, Argument: "length(DBSnapshots) == `0`",
   392  				Expected: true,
   393  			},
   394  			{
   395  				State:    request.SuccessWaiterState,
   396  				Matcher:  request.ErrorWaiterMatch,
   397  				Expected: "DBSnapshotNotFound",
   398  			},
   399  			{
   400  				State:   request.FailureWaiterState,
   401  				Matcher: request.PathAnyWaiterMatch, Argument: "DBSnapshots[].Status",
   402  				Expected: "creating",
   403  			},
   404  			{
   405  				State:   request.FailureWaiterState,
   406  				Matcher: request.PathAnyWaiterMatch, Argument: "DBSnapshots[].Status",
   407  				Expected: "modifying",
   408  			},
   409  			{
   410  				State:   request.FailureWaiterState,
   411  				Matcher: request.PathAnyWaiterMatch, Argument: "DBSnapshots[].Status",
   412  				Expected: "rebooting",
   413  			},
   414  			{
   415  				State:   request.FailureWaiterState,
   416  				Matcher: request.PathAnyWaiterMatch, Argument: "DBSnapshots[].Status",
   417  				Expected: "resetting-master-credentials",
   418  			},
   419  		},
   420  		Logger: c.Config.Logger,
   421  		NewRequest: func(opts []request.Option) (*request.Request, error) {
   422  			var inCpy *DescribeDBSnapshotsInput
   423  			if input != nil {
   424  				tmp := *input
   425  				inCpy = &tmp
   426  			}
   427  			req, _ := c.DescribeDBSnapshotsRequest(inCpy)
   428  			req.SetContext(ctx)
   429  			req.ApplyOptions(opts...)
   430  			return req, nil
   431  		},
   432  	}
   433  	w.ApplyOptions(opts...)
   434  
   435  	return w.WaitWithContext(ctx)
   436  }