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

     1  // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
     2  
     3  package iotsitewise
     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  // WaitUntilAssetActive uses the AWS IoT SiteWise API operation
    13  // DescribeAsset 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 *IoTSiteWise) WaitUntilAssetActive(input *DescribeAssetInput) error {
    17  	return c.WaitUntilAssetActiveWithContext(aws.BackgroundContext(), input)
    18  }
    19  
    20  // WaitUntilAssetActiveWithContext is an extended version of WaitUntilAssetActive.
    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 *IoTSiteWise) WaitUntilAssetActiveWithContext(ctx aws.Context, input *DescribeAssetInput, opts ...request.WaiterOption) error {
    29  	w := request.Waiter{
    30  		Name:        "WaitUntilAssetActive",
    31  		MaxAttempts: 20,
    32  		Delay:       request.ConstantWaiterDelay(3 * time.Second),
    33  		Acceptors: []request.WaiterAcceptor{
    34  			{
    35  				State:   request.SuccessWaiterState,
    36  				Matcher: request.PathWaiterMatch, Argument: "assetStatus.state",
    37  				Expected: "ACTIVE",
    38  			},
    39  			{
    40  				State:   request.FailureWaiterState,
    41  				Matcher: request.PathWaiterMatch, Argument: "assetStatus.state",
    42  				Expected: "FAILED",
    43  			},
    44  		},
    45  		Logger: c.Config.Logger,
    46  		NewRequest: func(opts []request.Option) (*request.Request, error) {
    47  			var inCpy *DescribeAssetInput
    48  			if input != nil {
    49  				tmp := *input
    50  				inCpy = &tmp
    51  			}
    52  			req, _ := c.DescribeAssetRequest(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  // WaitUntilAssetModelActive uses the AWS IoT SiteWise API operation
    64  // DescribeAssetModel 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 *IoTSiteWise) WaitUntilAssetModelActive(input *DescribeAssetModelInput) error {
    68  	return c.WaitUntilAssetModelActiveWithContext(aws.BackgroundContext(), input)
    69  }
    70  
    71  // WaitUntilAssetModelActiveWithContext is an extended version of WaitUntilAssetModelActive.
    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 *IoTSiteWise) WaitUntilAssetModelActiveWithContext(ctx aws.Context, input *DescribeAssetModelInput, opts ...request.WaiterOption) error {
    80  	w := request.Waiter{
    81  		Name:        "WaitUntilAssetModelActive",
    82  		MaxAttempts: 20,
    83  		Delay:       request.ConstantWaiterDelay(3 * time.Second),
    84  		Acceptors: []request.WaiterAcceptor{
    85  			{
    86  				State:   request.SuccessWaiterState,
    87  				Matcher: request.PathWaiterMatch, Argument: "assetModelStatus.state",
    88  				Expected: "ACTIVE",
    89  			},
    90  			{
    91  				State:   request.FailureWaiterState,
    92  				Matcher: request.PathWaiterMatch, Argument: "assetModelStatus.state",
    93  				Expected: "FAILED",
    94  			},
    95  		},
    96  		Logger: c.Config.Logger,
    97  		NewRequest: func(opts []request.Option) (*request.Request, error) {
    98  			var inCpy *DescribeAssetModelInput
    99  			if input != nil {
   100  				tmp := *input
   101  				inCpy = &tmp
   102  			}
   103  			req, _ := c.DescribeAssetModelRequest(inCpy)
   104  			req.SetContext(ctx)
   105  			req.ApplyOptions(opts...)
   106  			return req, nil
   107  		},
   108  	}
   109  	w.ApplyOptions(opts...)
   110  
   111  	return w.WaitWithContext(ctx)
   112  }
   113  
   114  // WaitUntilAssetModelNotExists uses the AWS IoT SiteWise API operation
   115  // DescribeAssetModel to wait for a condition to be met before returning.
   116  // If the condition is not met within the max attempt window, an error will
   117  // be returned.
   118  func (c *IoTSiteWise) WaitUntilAssetModelNotExists(input *DescribeAssetModelInput) error {
   119  	return c.WaitUntilAssetModelNotExistsWithContext(aws.BackgroundContext(), input)
   120  }
   121  
   122  // WaitUntilAssetModelNotExistsWithContext is an extended version of WaitUntilAssetModelNotExists.
   123  // With the support for passing in a context and options to configure the
   124  // Waiter and the underlying request options.
   125  //
   126  // The context must be non-nil and will be used for request cancellation. If
   127  // the context is nil a panic will occur. In the future the SDK may create
   128  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
   129  // for more information on using Contexts.
   130  func (c *IoTSiteWise) WaitUntilAssetModelNotExistsWithContext(ctx aws.Context, input *DescribeAssetModelInput, opts ...request.WaiterOption) error {
   131  	w := request.Waiter{
   132  		Name:        "WaitUntilAssetModelNotExists",
   133  		MaxAttempts: 20,
   134  		Delay:       request.ConstantWaiterDelay(3 * time.Second),
   135  		Acceptors: []request.WaiterAcceptor{
   136  			{
   137  				State:    request.SuccessWaiterState,
   138  				Matcher:  request.ErrorWaiterMatch,
   139  				Expected: "ResourceNotFoundException",
   140  			},
   141  		},
   142  		Logger: c.Config.Logger,
   143  		NewRequest: func(opts []request.Option) (*request.Request, error) {
   144  			var inCpy *DescribeAssetModelInput
   145  			if input != nil {
   146  				tmp := *input
   147  				inCpy = &tmp
   148  			}
   149  			req, _ := c.DescribeAssetModelRequest(inCpy)
   150  			req.SetContext(ctx)
   151  			req.ApplyOptions(opts...)
   152  			return req, nil
   153  		},
   154  	}
   155  	w.ApplyOptions(opts...)
   156  
   157  	return w.WaitWithContext(ctx)
   158  }
   159  
   160  // WaitUntilAssetNotExists uses the AWS IoT SiteWise API operation
   161  // DescribeAsset to wait for a condition to be met before returning.
   162  // If the condition is not met within the max attempt window, an error will
   163  // be returned.
   164  func (c *IoTSiteWise) WaitUntilAssetNotExists(input *DescribeAssetInput) error {
   165  	return c.WaitUntilAssetNotExistsWithContext(aws.BackgroundContext(), input)
   166  }
   167  
   168  // WaitUntilAssetNotExistsWithContext is an extended version of WaitUntilAssetNotExists.
   169  // With the support for passing in a context and options to configure the
   170  // Waiter and the underlying request options.
   171  //
   172  // The context must be non-nil and will be used for request cancellation. If
   173  // the context is nil a panic will occur. In the future the SDK may create
   174  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
   175  // for more information on using Contexts.
   176  func (c *IoTSiteWise) WaitUntilAssetNotExistsWithContext(ctx aws.Context, input *DescribeAssetInput, opts ...request.WaiterOption) error {
   177  	w := request.Waiter{
   178  		Name:        "WaitUntilAssetNotExists",
   179  		MaxAttempts: 20,
   180  		Delay:       request.ConstantWaiterDelay(3 * time.Second),
   181  		Acceptors: []request.WaiterAcceptor{
   182  			{
   183  				State:    request.SuccessWaiterState,
   184  				Matcher:  request.ErrorWaiterMatch,
   185  				Expected: "ResourceNotFoundException",
   186  			},
   187  		},
   188  		Logger: c.Config.Logger,
   189  		NewRequest: func(opts []request.Option) (*request.Request, error) {
   190  			var inCpy *DescribeAssetInput
   191  			if input != nil {
   192  				tmp := *input
   193  				inCpy = &tmp
   194  			}
   195  			req, _ := c.DescribeAssetRequest(inCpy)
   196  			req.SetContext(ctx)
   197  			req.ApplyOptions(opts...)
   198  			return req, nil
   199  		},
   200  	}
   201  	w.ApplyOptions(opts...)
   202  
   203  	return w.WaitWithContext(ctx)
   204  }
   205  
   206  // WaitUntilPortalActive uses the AWS IoT SiteWise API operation
   207  // DescribePortal to wait for a condition to be met before returning.
   208  // If the condition is not met within the max attempt window, an error will
   209  // be returned.
   210  func (c *IoTSiteWise) WaitUntilPortalActive(input *DescribePortalInput) error {
   211  	return c.WaitUntilPortalActiveWithContext(aws.BackgroundContext(), input)
   212  }
   213  
   214  // WaitUntilPortalActiveWithContext is an extended version of WaitUntilPortalActive.
   215  // With the support for passing in a context and options to configure the
   216  // Waiter and the underlying request options.
   217  //
   218  // The context must be non-nil and will be used for request cancellation. If
   219  // the context is nil a panic will occur. In the future the SDK may create
   220  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
   221  // for more information on using Contexts.
   222  func (c *IoTSiteWise) WaitUntilPortalActiveWithContext(ctx aws.Context, input *DescribePortalInput, opts ...request.WaiterOption) error {
   223  	w := request.Waiter{
   224  		Name:        "WaitUntilPortalActive",
   225  		MaxAttempts: 20,
   226  		Delay:       request.ConstantWaiterDelay(3 * time.Second),
   227  		Acceptors: []request.WaiterAcceptor{
   228  			{
   229  				State:   request.SuccessWaiterState,
   230  				Matcher: request.PathWaiterMatch, Argument: "portalStatus.state",
   231  				Expected: "ACTIVE",
   232  			},
   233  		},
   234  		Logger: c.Config.Logger,
   235  		NewRequest: func(opts []request.Option) (*request.Request, error) {
   236  			var inCpy *DescribePortalInput
   237  			if input != nil {
   238  				tmp := *input
   239  				inCpy = &tmp
   240  			}
   241  			req, _ := c.DescribePortalRequest(inCpy)
   242  			req.SetContext(ctx)
   243  			req.ApplyOptions(opts...)
   244  			return req, nil
   245  		},
   246  	}
   247  	w.ApplyOptions(opts...)
   248  
   249  	return w.WaitWithContext(ctx)
   250  }
   251  
   252  // WaitUntilPortalNotExists uses the AWS IoT SiteWise API operation
   253  // DescribePortal to wait for a condition to be met before returning.
   254  // If the condition is not met within the max attempt window, an error will
   255  // be returned.
   256  func (c *IoTSiteWise) WaitUntilPortalNotExists(input *DescribePortalInput) error {
   257  	return c.WaitUntilPortalNotExistsWithContext(aws.BackgroundContext(), input)
   258  }
   259  
   260  // WaitUntilPortalNotExistsWithContext is an extended version of WaitUntilPortalNotExists.
   261  // With the support for passing in a context and options to configure the
   262  // Waiter and the underlying request options.
   263  //
   264  // The context must be non-nil and will be used for request cancellation. If
   265  // the context is nil a panic will occur. In the future the SDK may create
   266  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
   267  // for more information on using Contexts.
   268  func (c *IoTSiteWise) WaitUntilPortalNotExistsWithContext(ctx aws.Context, input *DescribePortalInput, opts ...request.WaiterOption) error {
   269  	w := request.Waiter{
   270  		Name:        "WaitUntilPortalNotExists",
   271  		MaxAttempts: 20,
   272  		Delay:       request.ConstantWaiterDelay(3 * time.Second),
   273  		Acceptors: []request.WaiterAcceptor{
   274  			{
   275  				State:    request.SuccessWaiterState,
   276  				Matcher:  request.ErrorWaiterMatch,
   277  				Expected: "ResourceNotFoundException",
   278  			},
   279  		},
   280  		Logger: c.Config.Logger,
   281  		NewRequest: func(opts []request.Option) (*request.Request, error) {
   282  			var inCpy *DescribePortalInput
   283  			if input != nil {
   284  				tmp := *input
   285  				inCpy = &tmp
   286  			}
   287  			req, _ := c.DescribePortalRequest(inCpy)
   288  			req.SetContext(ctx)
   289  			req.ApplyOptions(opts...)
   290  			return req, nil
   291  		},
   292  	}
   293  	w.ApplyOptions(opts...)
   294  
   295  	return w.WaitWithContext(ctx)
   296  }