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

     1  // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
     2  
     3  package lexmodelsv2
     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  // WaitUntilBotAliasAvailable uses the Lex Models V2 API operation
    13  // DescribeBotAlias 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 *LexModelsV2) WaitUntilBotAliasAvailable(input *DescribeBotAliasInput) error {
    17  	return c.WaitUntilBotAliasAvailableWithContext(aws.BackgroundContext(), input)
    18  }
    19  
    20  // WaitUntilBotAliasAvailableWithContext is an extended version of WaitUntilBotAliasAvailable.
    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 *LexModelsV2) WaitUntilBotAliasAvailableWithContext(ctx aws.Context, input *DescribeBotAliasInput, opts ...request.WaiterOption) error {
    29  	w := request.Waiter{
    30  		Name:        "WaitUntilBotAliasAvailable",
    31  		MaxAttempts: 35,
    32  		Delay:       request.ConstantWaiterDelay(10 * time.Second),
    33  		Acceptors: []request.WaiterAcceptor{
    34  			{
    35  				State:   request.SuccessWaiterState,
    36  				Matcher: request.PathWaiterMatch, Argument: "botAliasStatus",
    37  				Expected: "Available",
    38  			},
    39  			{
    40  				State:   request.FailureWaiterState,
    41  				Matcher: request.PathWaiterMatch, Argument: "botAliasStatus",
    42  				Expected: "Failed",
    43  			},
    44  			{
    45  				State:   request.FailureWaiterState,
    46  				Matcher: request.PathWaiterMatch, Argument: "botAliasStatus",
    47  				Expected: "Deleting",
    48  			},
    49  		},
    50  		Logger: c.Config.Logger,
    51  		NewRequest: func(opts []request.Option) (*request.Request, error) {
    52  			var inCpy *DescribeBotAliasInput
    53  			if input != nil {
    54  				tmp := *input
    55  				inCpy = &tmp
    56  			}
    57  			req, _ := c.DescribeBotAliasRequest(inCpy)
    58  			req.SetContext(ctx)
    59  			req.ApplyOptions(opts...)
    60  			return req, nil
    61  		},
    62  	}
    63  	w.ApplyOptions(opts...)
    64  
    65  	return w.WaitWithContext(ctx)
    66  }
    67  
    68  // WaitUntilBotAvailable uses the Lex Models V2 API operation
    69  // DescribeBot to wait for a condition to be met before returning.
    70  // If the condition is not met within the max attempt window, an error will
    71  // be returned.
    72  func (c *LexModelsV2) WaitUntilBotAvailable(input *DescribeBotInput) error {
    73  	return c.WaitUntilBotAvailableWithContext(aws.BackgroundContext(), input)
    74  }
    75  
    76  // WaitUntilBotAvailableWithContext is an extended version of WaitUntilBotAvailable.
    77  // With the support for passing in a context and options to configure the
    78  // Waiter and the underlying request options.
    79  //
    80  // The context must be non-nil and will be used for request cancellation. If
    81  // the context is nil a panic will occur. In the future the SDK may create
    82  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
    83  // for more information on using Contexts.
    84  func (c *LexModelsV2) WaitUntilBotAvailableWithContext(ctx aws.Context, input *DescribeBotInput, opts ...request.WaiterOption) error {
    85  	w := request.Waiter{
    86  		Name:        "WaitUntilBotAvailable",
    87  		MaxAttempts: 35,
    88  		Delay:       request.ConstantWaiterDelay(10 * time.Second),
    89  		Acceptors: []request.WaiterAcceptor{
    90  			{
    91  				State:   request.SuccessWaiterState,
    92  				Matcher: request.PathWaiterMatch, Argument: "botStatus",
    93  				Expected: "Available",
    94  			},
    95  			{
    96  				State:   request.FailureWaiterState,
    97  				Matcher: request.PathWaiterMatch, Argument: "botStatus",
    98  				Expected: "Deleting",
    99  			},
   100  			{
   101  				State:   request.FailureWaiterState,
   102  				Matcher: request.PathWaiterMatch, Argument: "botStatus",
   103  				Expected: "Failed",
   104  			},
   105  			{
   106  				State:   request.FailureWaiterState,
   107  				Matcher: request.PathWaiterMatch, Argument: "botStatus",
   108  				Expected: "Inactive",
   109  			},
   110  		},
   111  		Logger: c.Config.Logger,
   112  		NewRequest: func(opts []request.Option) (*request.Request, error) {
   113  			var inCpy *DescribeBotInput
   114  			if input != nil {
   115  				tmp := *input
   116  				inCpy = &tmp
   117  			}
   118  			req, _ := c.DescribeBotRequest(inCpy)
   119  			req.SetContext(ctx)
   120  			req.ApplyOptions(opts...)
   121  			return req, nil
   122  		},
   123  	}
   124  	w.ApplyOptions(opts...)
   125  
   126  	return w.WaitWithContext(ctx)
   127  }
   128  
   129  // WaitUntilBotExportCompleted uses the Lex Models V2 API operation
   130  // DescribeExport to wait for a condition to be met before returning.
   131  // If the condition is not met within the max attempt window, an error will
   132  // be returned.
   133  func (c *LexModelsV2) WaitUntilBotExportCompleted(input *DescribeExportInput) error {
   134  	return c.WaitUntilBotExportCompletedWithContext(aws.BackgroundContext(), input)
   135  }
   136  
   137  // WaitUntilBotExportCompletedWithContext is an extended version of WaitUntilBotExportCompleted.
   138  // With the support for passing in a context and options to configure the
   139  // Waiter and the underlying request options.
   140  //
   141  // The context must be non-nil and will be used for request cancellation. If
   142  // the context is nil a panic will occur. In the future the SDK may create
   143  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
   144  // for more information on using Contexts.
   145  func (c *LexModelsV2) WaitUntilBotExportCompletedWithContext(ctx aws.Context, input *DescribeExportInput, opts ...request.WaiterOption) error {
   146  	w := request.Waiter{
   147  		Name:        "WaitUntilBotExportCompleted",
   148  		MaxAttempts: 35,
   149  		Delay:       request.ConstantWaiterDelay(10 * time.Second),
   150  		Acceptors: []request.WaiterAcceptor{
   151  			{
   152  				State:   request.SuccessWaiterState,
   153  				Matcher: request.PathWaiterMatch, Argument: "exportStatus",
   154  				Expected: "Completed",
   155  			},
   156  			{
   157  				State:   request.FailureWaiterState,
   158  				Matcher: request.PathWaiterMatch, Argument: "exportStatus",
   159  				Expected: "Deleting",
   160  			},
   161  			{
   162  				State:   request.FailureWaiterState,
   163  				Matcher: request.PathWaiterMatch, Argument: "exportStatus",
   164  				Expected: "Failed",
   165  			},
   166  		},
   167  		Logger: c.Config.Logger,
   168  		NewRequest: func(opts []request.Option) (*request.Request, error) {
   169  			var inCpy *DescribeExportInput
   170  			if input != nil {
   171  				tmp := *input
   172  				inCpy = &tmp
   173  			}
   174  			req, _ := c.DescribeExportRequest(inCpy)
   175  			req.SetContext(ctx)
   176  			req.ApplyOptions(opts...)
   177  			return req, nil
   178  		},
   179  	}
   180  	w.ApplyOptions(opts...)
   181  
   182  	return w.WaitWithContext(ctx)
   183  }
   184  
   185  // WaitUntilBotImportCompleted uses the Lex Models V2 API operation
   186  // DescribeImport to wait for a condition to be met before returning.
   187  // If the condition is not met within the max attempt window, an error will
   188  // be returned.
   189  func (c *LexModelsV2) WaitUntilBotImportCompleted(input *DescribeImportInput) error {
   190  	return c.WaitUntilBotImportCompletedWithContext(aws.BackgroundContext(), input)
   191  }
   192  
   193  // WaitUntilBotImportCompletedWithContext is an extended version of WaitUntilBotImportCompleted.
   194  // With the support for passing in a context and options to configure the
   195  // Waiter and the underlying request options.
   196  //
   197  // The context must be non-nil and will be used for request cancellation. If
   198  // the context is nil a panic will occur. In the future the SDK may create
   199  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
   200  // for more information on using Contexts.
   201  func (c *LexModelsV2) WaitUntilBotImportCompletedWithContext(ctx aws.Context, input *DescribeImportInput, opts ...request.WaiterOption) error {
   202  	w := request.Waiter{
   203  		Name:        "WaitUntilBotImportCompleted",
   204  		MaxAttempts: 35,
   205  		Delay:       request.ConstantWaiterDelay(10 * time.Second),
   206  		Acceptors: []request.WaiterAcceptor{
   207  			{
   208  				State:   request.SuccessWaiterState,
   209  				Matcher: request.PathWaiterMatch, Argument: "importStatus",
   210  				Expected: "Completed",
   211  			},
   212  			{
   213  				State:   request.FailureWaiterState,
   214  				Matcher: request.PathWaiterMatch, Argument: "importStatus",
   215  				Expected: "Deleting",
   216  			},
   217  			{
   218  				State:   request.FailureWaiterState,
   219  				Matcher: request.PathWaiterMatch, Argument: "importStatus",
   220  				Expected: "Failed",
   221  			},
   222  		},
   223  		Logger: c.Config.Logger,
   224  		NewRequest: func(opts []request.Option) (*request.Request, error) {
   225  			var inCpy *DescribeImportInput
   226  			if input != nil {
   227  				tmp := *input
   228  				inCpy = &tmp
   229  			}
   230  			req, _ := c.DescribeImportRequest(inCpy)
   231  			req.SetContext(ctx)
   232  			req.ApplyOptions(opts...)
   233  			return req, nil
   234  		},
   235  	}
   236  	w.ApplyOptions(opts...)
   237  
   238  	return w.WaitWithContext(ctx)
   239  }
   240  
   241  // WaitUntilBotLocaleBuilt uses the Lex Models V2 API operation
   242  // DescribeBotLocale to wait for a condition to be met before returning.
   243  // If the condition is not met within the max attempt window, an error will
   244  // be returned.
   245  func (c *LexModelsV2) WaitUntilBotLocaleBuilt(input *DescribeBotLocaleInput) error {
   246  	return c.WaitUntilBotLocaleBuiltWithContext(aws.BackgroundContext(), input)
   247  }
   248  
   249  // WaitUntilBotLocaleBuiltWithContext is an extended version of WaitUntilBotLocaleBuilt.
   250  // With the support for passing in a context and options to configure the
   251  // Waiter and the underlying request options.
   252  //
   253  // The context must be non-nil and will be used for request cancellation. If
   254  // the context is nil a panic will occur. In the future the SDK may create
   255  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
   256  // for more information on using Contexts.
   257  func (c *LexModelsV2) WaitUntilBotLocaleBuiltWithContext(ctx aws.Context, input *DescribeBotLocaleInput, opts ...request.WaiterOption) error {
   258  	w := request.Waiter{
   259  		Name:        "WaitUntilBotLocaleBuilt",
   260  		MaxAttempts: 35,
   261  		Delay:       request.ConstantWaiterDelay(10 * time.Second),
   262  		Acceptors: []request.WaiterAcceptor{
   263  			{
   264  				State:   request.SuccessWaiterState,
   265  				Matcher: request.PathWaiterMatch, Argument: "botLocaleStatus",
   266  				Expected: "Built",
   267  			},
   268  			{
   269  				State:   request.FailureWaiterState,
   270  				Matcher: request.PathWaiterMatch, Argument: "botLocaleStatus",
   271  				Expected: "Deleting",
   272  			},
   273  			{
   274  				State:   request.FailureWaiterState,
   275  				Matcher: request.PathWaiterMatch, Argument: "botLocaleStatus",
   276  				Expected: "Failed",
   277  			},
   278  			{
   279  				State:   request.FailureWaiterState,
   280  				Matcher: request.PathWaiterMatch, Argument: "botLocaleStatus",
   281  				Expected: "NotBuilt",
   282  			},
   283  		},
   284  		Logger: c.Config.Logger,
   285  		NewRequest: func(opts []request.Option) (*request.Request, error) {
   286  			var inCpy *DescribeBotLocaleInput
   287  			if input != nil {
   288  				tmp := *input
   289  				inCpy = &tmp
   290  			}
   291  			req, _ := c.DescribeBotLocaleRequest(inCpy)
   292  			req.SetContext(ctx)
   293  			req.ApplyOptions(opts...)
   294  			return req, nil
   295  		},
   296  	}
   297  	w.ApplyOptions(opts...)
   298  
   299  	return w.WaitWithContext(ctx)
   300  }
   301  
   302  // WaitUntilBotLocaleCreated uses the Lex Models V2 API operation
   303  // DescribeBotLocale to wait for a condition to be met before returning.
   304  // If the condition is not met within the max attempt window, an error will
   305  // be returned.
   306  func (c *LexModelsV2) WaitUntilBotLocaleCreated(input *DescribeBotLocaleInput) error {
   307  	return c.WaitUntilBotLocaleCreatedWithContext(aws.BackgroundContext(), input)
   308  }
   309  
   310  // WaitUntilBotLocaleCreatedWithContext is an extended version of WaitUntilBotLocaleCreated.
   311  // With the support for passing in a context and options to configure the
   312  // Waiter and the underlying request options.
   313  //
   314  // The context must be non-nil and will be used for request cancellation. If
   315  // the context is nil a panic will occur. In the future the SDK may create
   316  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
   317  // for more information on using Contexts.
   318  func (c *LexModelsV2) WaitUntilBotLocaleCreatedWithContext(ctx aws.Context, input *DescribeBotLocaleInput, opts ...request.WaiterOption) error {
   319  	w := request.Waiter{
   320  		Name:        "WaitUntilBotLocaleCreated",
   321  		MaxAttempts: 35,
   322  		Delay:       request.ConstantWaiterDelay(10 * time.Second),
   323  		Acceptors: []request.WaiterAcceptor{
   324  			{
   325  				State:   request.SuccessWaiterState,
   326  				Matcher: request.PathWaiterMatch, Argument: "botLocaleStatus",
   327  				Expected: "Built",
   328  			},
   329  			{
   330  				State:   request.SuccessWaiterState,
   331  				Matcher: request.PathWaiterMatch, Argument: "botLocaleStatus",
   332  				Expected: "ReadyExpressTesting",
   333  			},
   334  			{
   335  				State:   request.SuccessWaiterState,
   336  				Matcher: request.PathWaiterMatch, Argument: "botLocaleStatus",
   337  				Expected: "NotBuilt",
   338  			},
   339  			{
   340  				State:   request.FailureWaiterState,
   341  				Matcher: request.PathWaiterMatch, Argument: "botLocaleStatus",
   342  				Expected: "Deleting",
   343  			},
   344  			{
   345  				State:   request.FailureWaiterState,
   346  				Matcher: request.PathWaiterMatch, Argument: "botLocaleStatus",
   347  				Expected: "Failed",
   348  			},
   349  		},
   350  		Logger: c.Config.Logger,
   351  		NewRequest: func(opts []request.Option) (*request.Request, error) {
   352  			var inCpy *DescribeBotLocaleInput
   353  			if input != nil {
   354  				tmp := *input
   355  				inCpy = &tmp
   356  			}
   357  			req, _ := c.DescribeBotLocaleRequest(inCpy)
   358  			req.SetContext(ctx)
   359  			req.ApplyOptions(opts...)
   360  			return req, nil
   361  		},
   362  	}
   363  	w.ApplyOptions(opts...)
   364  
   365  	return w.WaitWithContext(ctx)
   366  }
   367  
   368  // WaitUntilBotLocaleExpressTestingAvailable uses the Lex Models V2 API operation
   369  // DescribeBotLocale to wait for a condition to be met before returning.
   370  // If the condition is not met within the max attempt window, an error will
   371  // be returned.
   372  func (c *LexModelsV2) WaitUntilBotLocaleExpressTestingAvailable(input *DescribeBotLocaleInput) error {
   373  	return c.WaitUntilBotLocaleExpressTestingAvailableWithContext(aws.BackgroundContext(), input)
   374  }
   375  
   376  // WaitUntilBotLocaleExpressTestingAvailableWithContext is an extended version of WaitUntilBotLocaleExpressTestingAvailable.
   377  // With the support for passing in a context and options to configure the
   378  // Waiter and the underlying request options.
   379  //
   380  // The context must be non-nil and will be used for request cancellation. If
   381  // the context is nil a panic will occur. In the future the SDK may create
   382  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
   383  // for more information on using Contexts.
   384  func (c *LexModelsV2) WaitUntilBotLocaleExpressTestingAvailableWithContext(ctx aws.Context, input *DescribeBotLocaleInput, opts ...request.WaiterOption) error {
   385  	w := request.Waiter{
   386  		Name:        "WaitUntilBotLocaleExpressTestingAvailable",
   387  		MaxAttempts: 35,
   388  		Delay:       request.ConstantWaiterDelay(10 * time.Second),
   389  		Acceptors: []request.WaiterAcceptor{
   390  			{
   391  				State:   request.SuccessWaiterState,
   392  				Matcher: request.PathWaiterMatch, Argument: "botLocaleStatus",
   393  				Expected: "Built",
   394  			},
   395  			{
   396  				State:   request.SuccessWaiterState,
   397  				Matcher: request.PathWaiterMatch, Argument: "botLocaleStatus",
   398  				Expected: "ReadyExpressTesting",
   399  			},
   400  			{
   401  				State:   request.FailureWaiterState,
   402  				Matcher: request.PathWaiterMatch, Argument: "botLocaleStatus",
   403  				Expected: "Deleting",
   404  			},
   405  			{
   406  				State:   request.FailureWaiterState,
   407  				Matcher: request.PathWaiterMatch, Argument: "botLocaleStatus",
   408  				Expected: "Failed",
   409  			},
   410  			{
   411  				State:   request.FailureWaiterState,
   412  				Matcher: request.PathWaiterMatch, Argument: "botLocaleStatus",
   413  				Expected: "NotBuilt",
   414  			},
   415  		},
   416  		Logger: c.Config.Logger,
   417  		NewRequest: func(opts []request.Option) (*request.Request, error) {
   418  			var inCpy *DescribeBotLocaleInput
   419  			if input != nil {
   420  				tmp := *input
   421  				inCpy = &tmp
   422  			}
   423  			req, _ := c.DescribeBotLocaleRequest(inCpy)
   424  			req.SetContext(ctx)
   425  			req.ApplyOptions(opts...)
   426  			return req, nil
   427  		},
   428  	}
   429  	w.ApplyOptions(opts...)
   430  
   431  	return w.WaitWithContext(ctx)
   432  }
   433  
   434  // WaitUntilBotVersionAvailable uses the Lex Models V2 API operation
   435  // DescribeBotVersion to wait for a condition to be met before returning.
   436  // If the condition is not met within the max attempt window, an error will
   437  // be returned.
   438  func (c *LexModelsV2) WaitUntilBotVersionAvailable(input *DescribeBotVersionInput) error {
   439  	return c.WaitUntilBotVersionAvailableWithContext(aws.BackgroundContext(), input)
   440  }
   441  
   442  // WaitUntilBotVersionAvailableWithContext is an extended version of WaitUntilBotVersionAvailable.
   443  // With the support for passing in a context and options to configure the
   444  // Waiter and the underlying request options.
   445  //
   446  // The context must be non-nil and will be used for request cancellation. If
   447  // the context is nil a panic will occur. In the future the SDK may create
   448  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
   449  // for more information on using Contexts.
   450  func (c *LexModelsV2) WaitUntilBotVersionAvailableWithContext(ctx aws.Context, input *DescribeBotVersionInput, opts ...request.WaiterOption) error {
   451  	w := request.Waiter{
   452  		Name:        "WaitUntilBotVersionAvailable",
   453  		MaxAttempts: 35,
   454  		Delay:       request.ConstantWaiterDelay(10 * time.Second),
   455  		Acceptors: []request.WaiterAcceptor{
   456  			{
   457  				State:   request.SuccessWaiterState,
   458  				Matcher: request.PathWaiterMatch, Argument: "botStatus",
   459  				Expected: "Available",
   460  			},
   461  			{
   462  				State:   request.FailureWaiterState,
   463  				Matcher: request.PathWaiterMatch, Argument: "botStatus",
   464  				Expected: "Deleting",
   465  			},
   466  			{
   467  				State:   request.FailureWaiterState,
   468  				Matcher: request.PathWaiterMatch, Argument: "botStatus",
   469  				Expected: "Failed",
   470  			},
   471  			{
   472  				State:    request.RetryWaiterState,
   473  				Matcher:  request.StatusWaiterMatch,
   474  				Expected: 404,
   475  			},
   476  		},
   477  		Logger: c.Config.Logger,
   478  		NewRequest: func(opts []request.Option) (*request.Request, error) {
   479  			var inCpy *DescribeBotVersionInput
   480  			if input != nil {
   481  				tmp := *input
   482  				inCpy = &tmp
   483  			}
   484  			req, _ := c.DescribeBotVersionRequest(inCpy)
   485  			req.SetContext(ctx)
   486  			req.ApplyOptions(opts...)
   487  			return req, nil
   488  		},
   489  	}
   490  	w.ApplyOptions(opts...)
   491  
   492  	return w.WaitWithContext(ctx)
   493  }