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

     1  // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
     2  
     3  package proton
     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  // WaitUntilEnvironmentDeployed uses the AWS Proton API operation
    13  // GetEnvironment 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 *Proton) WaitUntilEnvironmentDeployed(input *GetEnvironmentInput) error {
    17  	return c.WaitUntilEnvironmentDeployedWithContext(aws.BackgroundContext(), input)
    18  }
    19  
    20  // WaitUntilEnvironmentDeployedWithContext is an extended version of WaitUntilEnvironmentDeployed.
    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 *Proton) WaitUntilEnvironmentDeployedWithContext(ctx aws.Context, input *GetEnvironmentInput, opts ...request.WaiterOption) error {
    29  	w := request.Waiter{
    30  		Name:        "WaitUntilEnvironmentDeployed",
    31  		MaxAttempts: 999,
    32  		Delay:       request.ConstantWaiterDelay(5 * time.Second),
    33  		Acceptors: []request.WaiterAcceptor{
    34  			{
    35  				State:   request.SuccessWaiterState,
    36  				Matcher: request.PathWaiterMatch, Argument: "environment.deploymentStatus",
    37  				Expected: "SUCCEEDED",
    38  			},
    39  			{
    40  				State:   request.FailureWaiterState,
    41  				Matcher: request.PathWaiterMatch, Argument: "environment.deploymentStatus",
    42  				Expected: "FAILED",
    43  			},
    44  		},
    45  		Logger: c.Config.Logger,
    46  		NewRequest: func(opts []request.Option) (*request.Request, error) {
    47  			var inCpy *GetEnvironmentInput
    48  			if input != nil {
    49  				tmp := *input
    50  				inCpy = &tmp
    51  			}
    52  			req, _ := c.GetEnvironmentRequest(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  // WaitUntilEnvironmentTemplateVersionRegistered uses the AWS Proton API operation
    64  // GetEnvironmentTemplateVersion 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 *Proton) WaitUntilEnvironmentTemplateVersionRegistered(input *GetEnvironmentTemplateVersionInput) error {
    68  	return c.WaitUntilEnvironmentTemplateVersionRegisteredWithContext(aws.BackgroundContext(), input)
    69  }
    70  
    71  // WaitUntilEnvironmentTemplateVersionRegisteredWithContext is an extended version of WaitUntilEnvironmentTemplateVersionRegistered.
    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 *Proton) WaitUntilEnvironmentTemplateVersionRegisteredWithContext(ctx aws.Context, input *GetEnvironmentTemplateVersionInput, opts ...request.WaiterOption) error {
    80  	w := request.Waiter{
    81  		Name:        "WaitUntilEnvironmentTemplateVersionRegistered",
    82  		MaxAttempts: 150,
    83  		Delay:       request.ConstantWaiterDelay(2 * time.Second),
    84  		Acceptors: []request.WaiterAcceptor{
    85  			{
    86  				State:   request.SuccessWaiterState,
    87  				Matcher: request.PathWaiterMatch, Argument: "environmentTemplateVersion.status",
    88  				Expected: "DRAFT",
    89  			},
    90  			{
    91  				State:   request.SuccessWaiterState,
    92  				Matcher: request.PathWaiterMatch, Argument: "environmentTemplateVersion.status",
    93  				Expected: "PUBLISHED",
    94  			},
    95  			{
    96  				State:   request.FailureWaiterState,
    97  				Matcher: request.PathWaiterMatch, Argument: "environmentTemplateVersion.status",
    98  				Expected: "REGISTRATION_FAILED",
    99  			},
   100  		},
   101  		Logger: c.Config.Logger,
   102  		NewRequest: func(opts []request.Option) (*request.Request, error) {
   103  			var inCpy *GetEnvironmentTemplateVersionInput
   104  			if input != nil {
   105  				tmp := *input
   106  				inCpy = &tmp
   107  			}
   108  			req, _ := c.GetEnvironmentTemplateVersionRequest(inCpy)
   109  			req.SetContext(ctx)
   110  			req.ApplyOptions(opts...)
   111  			return req, nil
   112  		},
   113  	}
   114  	w.ApplyOptions(opts...)
   115  
   116  	return w.WaitWithContext(ctx)
   117  }
   118  
   119  // WaitUntilServiceCreated uses the AWS Proton API operation
   120  // GetService to wait for a condition to be met before returning.
   121  // If the condition is not met within the max attempt window, an error will
   122  // be returned.
   123  func (c *Proton) WaitUntilServiceCreated(input *GetServiceInput) error {
   124  	return c.WaitUntilServiceCreatedWithContext(aws.BackgroundContext(), input)
   125  }
   126  
   127  // WaitUntilServiceCreatedWithContext is an extended version of WaitUntilServiceCreated.
   128  // With the support for passing in a context and options to configure the
   129  // Waiter and the underlying request options.
   130  //
   131  // The context must be non-nil and will be used for request cancellation. If
   132  // the context is nil a panic will occur. In the future the SDK may create
   133  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
   134  // for more information on using Contexts.
   135  func (c *Proton) WaitUntilServiceCreatedWithContext(ctx aws.Context, input *GetServiceInput, opts ...request.WaiterOption) error {
   136  	w := request.Waiter{
   137  		Name:        "WaitUntilServiceCreated",
   138  		MaxAttempts: 999,
   139  		Delay:       request.ConstantWaiterDelay(5 * time.Second),
   140  		Acceptors: []request.WaiterAcceptor{
   141  			{
   142  				State:   request.SuccessWaiterState,
   143  				Matcher: request.PathWaiterMatch, Argument: "service.status",
   144  				Expected: "ACTIVE",
   145  			},
   146  			{
   147  				State:   request.FailureWaiterState,
   148  				Matcher: request.PathWaiterMatch, Argument: "service.status",
   149  				Expected: "CREATE_FAILED_CLEANUP_COMPLETE",
   150  			},
   151  			{
   152  				State:   request.FailureWaiterState,
   153  				Matcher: request.PathWaiterMatch, Argument: "service.status",
   154  				Expected: "CREATE_FAILED_CLEANUP_FAILED",
   155  			},
   156  			{
   157  				State:   request.FailureWaiterState,
   158  				Matcher: request.PathWaiterMatch, Argument: "service.status",
   159  				Expected: "CREATE_FAILED",
   160  			},
   161  		},
   162  		Logger: c.Config.Logger,
   163  		NewRequest: func(opts []request.Option) (*request.Request, error) {
   164  			var inCpy *GetServiceInput
   165  			if input != nil {
   166  				tmp := *input
   167  				inCpy = &tmp
   168  			}
   169  			req, _ := c.GetServiceRequest(inCpy)
   170  			req.SetContext(ctx)
   171  			req.ApplyOptions(opts...)
   172  			return req, nil
   173  		},
   174  	}
   175  	w.ApplyOptions(opts...)
   176  
   177  	return w.WaitWithContext(ctx)
   178  }
   179  
   180  // WaitUntilServiceDeleted uses the AWS Proton API operation
   181  // GetService to wait for a condition to be met before returning.
   182  // If the condition is not met within the max attempt window, an error will
   183  // be returned.
   184  func (c *Proton) WaitUntilServiceDeleted(input *GetServiceInput) error {
   185  	return c.WaitUntilServiceDeletedWithContext(aws.BackgroundContext(), input)
   186  }
   187  
   188  // WaitUntilServiceDeletedWithContext is an extended version of WaitUntilServiceDeleted.
   189  // With the support for passing in a context and options to configure the
   190  // Waiter and the underlying request options.
   191  //
   192  // The context must be non-nil and will be used for request cancellation. If
   193  // the context is nil a panic will occur. In the future the SDK may create
   194  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
   195  // for more information on using Contexts.
   196  func (c *Proton) WaitUntilServiceDeletedWithContext(ctx aws.Context, input *GetServiceInput, opts ...request.WaiterOption) error {
   197  	w := request.Waiter{
   198  		Name:        "WaitUntilServiceDeleted",
   199  		MaxAttempts: 999,
   200  		Delay:       request.ConstantWaiterDelay(5 * time.Second),
   201  		Acceptors: []request.WaiterAcceptor{
   202  			{
   203  				State:    request.SuccessWaiterState,
   204  				Matcher:  request.ErrorWaiterMatch,
   205  				Expected: "ResourceNotFoundException",
   206  			},
   207  			{
   208  				State:   request.FailureWaiterState,
   209  				Matcher: request.PathWaiterMatch, Argument: "service.status",
   210  				Expected: "DELETE_FAILED",
   211  			},
   212  		},
   213  		Logger: c.Config.Logger,
   214  		NewRequest: func(opts []request.Option) (*request.Request, error) {
   215  			var inCpy *GetServiceInput
   216  			if input != nil {
   217  				tmp := *input
   218  				inCpy = &tmp
   219  			}
   220  			req, _ := c.GetServiceRequest(inCpy)
   221  			req.SetContext(ctx)
   222  			req.ApplyOptions(opts...)
   223  			return req, nil
   224  		},
   225  	}
   226  	w.ApplyOptions(opts...)
   227  
   228  	return w.WaitWithContext(ctx)
   229  }
   230  
   231  // WaitUntilServiceInstanceDeployed uses the AWS Proton API operation
   232  // GetServiceInstance to wait for a condition to be met before returning.
   233  // If the condition is not met within the max attempt window, an error will
   234  // be returned.
   235  func (c *Proton) WaitUntilServiceInstanceDeployed(input *GetServiceInstanceInput) error {
   236  	return c.WaitUntilServiceInstanceDeployedWithContext(aws.BackgroundContext(), input)
   237  }
   238  
   239  // WaitUntilServiceInstanceDeployedWithContext is an extended version of WaitUntilServiceInstanceDeployed.
   240  // With the support for passing in a context and options to configure the
   241  // Waiter and the underlying request options.
   242  //
   243  // The context must be non-nil and will be used for request cancellation. If
   244  // the context is nil a panic will occur. In the future the SDK may create
   245  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
   246  // for more information on using Contexts.
   247  func (c *Proton) WaitUntilServiceInstanceDeployedWithContext(ctx aws.Context, input *GetServiceInstanceInput, opts ...request.WaiterOption) error {
   248  	w := request.Waiter{
   249  		Name:        "WaitUntilServiceInstanceDeployed",
   250  		MaxAttempts: 999,
   251  		Delay:       request.ConstantWaiterDelay(5 * time.Second),
   252  		Acceptors: []request.WaiterAcceptor{
   253  			{
   254  				State:   request.SuccessWaiterState,
   255  				Matcher: request.PathWaiterMatch, Argument: "serviceInstance.deploymentStatus",
   256  				Expected: "SUCCEEDED",
   257  			},
   258  			{
   259  				State:   request.FailureWaiterState,
   260  				Matcher: request.PathWaiterMatch, Argument: "serviceInstance.deploymentStatus",
   261  				Expected: "FAILED",
   262  			},
   263  		},
   264  		Logger: c.Config.Logger,
   265  		NewRequest: func(opts []request.Option) (*request.Request, error) {
   266  			var inCpy *GetServiceInstanceInput
   267  			if input != nil {
   268  				tmp := *input
   269  				inCpy = &tmp
   270  			}
   271  			req, _ := c.GetServiceInstanceRequest(inCpy)
   272  			req.SetContext(ctx)
   273  			req.ApplyOptions(opts...)
   274  			return req, nil
   275  		},
   276  	}
   277  	w.ApplyOptions(opts...)
   278  
   279  	return w.WaitWithContext(ctx)
   280  }
   281  
   282  // WaitUntilServicePipelineDeployed uses the AWS Proton API operation
   283  // GetService to wait for a condition to be met before returning.
   284  // If the condition is not met within the max attempt window, an error will
   285  // be returned.
   286  func (c *Proton) WaitUntilServicePipelineDeployed(input *GetServiceInput) error {
   287  	return c.WaitUntilServicePipelineDeployedWithContext(aws.BackgroundContext(), input)
   288  }
   289  
   290  // WaitUntilServicePipelineDeployedWithContext is an extended version of WaitUntilServicePipelineDeployed.
   291  // With the support for passing in a context and options to configure the
   292  // Waiter and the underlying request options.
   293  //
   294  // The context must be non-nil and will be used for request cancellation. If
   295  // the context is nil a panic will occur. In the future the SDK may create
   296  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
   297  // for more information on using Contexts.
   298  func (c *Proton) WaitUntilServicePipelineDeployedWithContext(ctx aws.Context, input *GetServiceInput, opts ...request.WaiterOption) error {
   299  	w := request.Waiter{
   300  		Name:        "WaitUntilServicePipelineDeployed",
   301  		MaxAttempts: 360,
   302  		Delay:       request.ConstantWaiterDelay(10 * time.Second),
   303  		Acceptors: []request.WaiterAcceptor{
   304  			{
   305  				State:   request.SuccessWaiterState,
   306  				Matcher: request.PathWaiterMatch, Argument: "service.pipeline.deploymentStatus",
   307  				Expected: "SUCCEEDED",
   308  			},
   309  			{
   310  				State:   request.FailureWaiterState,
   311  				Matcher: request.PathWaiterMatch, Argument: "service.pipeline.deploymentStatus",
   312  				Expected: "FAILED",
   313  			},
   314  		},
   315  		Logger: c.Config.Logger,
   316  		NewRequest: func(opts []request.Option) (*request.Request, error) {
   317  			var inCpy *GetServiceInput
   318  			if input != nil {
   319  				tmp := *input
   320  				inCpy = &tmp
   321  			}
   322  			req, _ := c.GetServiceRequest(inCpy)
   323  			req.SetContext(ctx)
   324  			req.ApplyOptions(opts...)
   325  			return req, nil
   326  		},
   327  	}
   328  	w.ApplyOptions(opts...)
   329  
   330  	return w.WaitWithContext(ctx)
   331  }
   332  
   333  // WaitUntilServiceTemplateVersionRegistered uses the AWS Proton API operation
   334  // GetServiceTemplateVersion to wait for a condition to be met before returning.
   335  // If the condition is not met within the max attempt window, an error will
   336  // be returned.
   337  func (c *Proton) WaitUntilServiceTemplateVersionRegistered(input *GetServiceTemplateVersionInput) error {
   338  	return c.WaitUntilServiceTemplateVersionRegisteredWithContext(aws.BackgroundContext(), input)
   339  }
   340  
   341  // WaitUntilServiceTemplateVersionRegisteredWithContext is an extended version of WaitUntilServiceTemplateVersionRegistered.
   342  // With the support for passing in a context and options to configure the
   343  // Waiter and the underlying request options.
   344  //
   345  // The context must be non-nil and will be used for request cancellation. If
   346  // the context is nil a panic will occur. In the future the SDK may create
   347  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
   348  // for more information on using Contexts.
   349  func (c *Proton) WaitUntilServiceTemplateVersionRegisteredWithContext(ctx aws.Context, input *GetServiceTemplateVersionInput, opts ...request.WaiterOption) error {
   350  	w := request.Waiter{
   351  		Name:        "WaitUntilServiceTemplateVersionRegistered",
   352  		MaxAttempts: 150,
   353  		Delay:       request.ConstantWaiterDelay(2 * time.Second),
   354  		Acceptors: []request.WaiterAcceptor{
   355  			{
   356  				State:   request.SuccessWaiterState,
   357  				Matcher: request.PathWaiterMatch, Argument: "serviceTemplateVersion.status",
   358  				Expected: "DRAFT",
   359  			},
   360  			{
   361  				State:   request.SuccessWaiterState,
   362  				Matcher: request.PathWaiterMatch, Argument: "serviceTemplateVersion.status",
   363  				Expected: "PUBLISHED",
   364  			},
   365  			{
   366  				State:   request.FailureWaiterState,
   367  				Matcher: request.PathWaiterMatch, Argument: "serviceTemplateVersion.status",
   368  				Expected: "REGISTRATION_FAILED",
   369  			},
   370  		},
   371  		Logger: c.Config.Logger,
   372  		NewRequest: func(opts []request.Option) (*request.Request, error) {
   373  			var inCpy *GetServiceTemplateVersionInput
   374  			if input != nil {
   375  				tmp := *input
   376  				inCpy = &tmp
   377  			}
   378  			req, _ := c.GetServiceTemplateVersionRequest(inCpy)
   379  			req.SetContext(ctx)
   380  			req.ApplyOptions(opts...)
   381  			return req, nil
   382  		},
   383  	}
   384  	w.ApplyOptions(opts...)
   385  
   386  	return w.WaitWithContext(ctx)
   387  }
   388  
   389  // WaitUntilServiceUpdated uses the AWS Proton API operation
   390  // GetService to wait for a condition to be met before returning.
   391  // If the condition is not met within the max attempt window, an error will
   392  // be returned.
   393  func (c *Proton) WaitUntilServiceUpdated(input *GetServiceInput) error {
   394  	return c.WaitUntilServiceUpdatedWithContext(aws.BackgroundContext(), input)
   395  }
   396  
   397  // WaitUntilServiceUpdatedWithContext is an extended version of WaitUntilServiceUpdated.
   398  // With the support for passing in a context and options to configure the
   399  // Waiter and the underlying request options.
   400  //
   401  // The context must be non-nil and will be used for request cancellation. If
   402  // the context is nil a panic will occur. In the future the SDK may create
   403  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
   404  // for more information on using Contexts.
   405  func (c *Proton) WaitUntilServiceUpdatedWithContext(ctx aws.Context, input *GetServiceInput, opts ...request.WaiterOption) error {
   406  	w := request.Waiter{
   407  		Name:        "WaitUntilServiceUpdated",
   408  		MaxAttempts: 999,
   409  		Delay:       request.ConstantWaiterDelay(5 * time.Second),
   410  		Acceptors: []request.WaiterAcceptor{
   411  			{
   412  				State:   request.SuccessWaiterState,
   413  				Matcher: request.PathWaiterMatch, Argument: "service.status",
   414  				Expected: "ACTIVE",
   415  			},
   416  			{
   417  				State:   request.FailureWaiterState,
   418  				Matcher: request.PathWaiterMatch, Argument: "service.status",
   419  				Expected: "UPDATE_FAILED_CLEANUP_COMPLETE",
   420  			},
   421  			{
   422  				State:   request.FailureWaiterState,
   423  				Matcher: request.PathWaiterMatch, Argument: "service.status",
   424  				Expected: "UPDATE_FAILED_CLEANUP_FAILED",
   425  			},
   426  			{
   427  				State:   request.FailureWaiterState,
   428  				Matcher: request.PathWaiterMatch, Argument: "service.status",
   429  				Expected: "UPDATE_FAILED",
   430  			},
   431  			{
   432  				State:   request.FailureWaiterState,
   433  				Matcher: request.PathWaiterMatch, Argument: "service.status",
   434  				Expected: "UPDATE_COMPLETE_CLEANUP_FAILED",
   435  			},
   436  		},
   437  		Logger: c.Config.Logger,
   438  		NewRequest: func(opts []request.Option) (*request.Request, error) {
   439  			var inCpy *GetServiceInput
   440  			if input != nil {
   441  				tmp := *input
   442  				inCpy = &tmp
   443  			}
   444  			req, _ := c.GetServiceRequest(inCpy)
   445  			req.SetContext(ctx)
   446  			req.ApplyOptions(opts...)
   447  			return req, nil
   448  		},
   449  	}
   450  	w.ApplyOptions(opts...)
   451  
   452  	return w.WaitWithContext(ctx)
   453  }