Vendor aws-sdk-go (dep ensure) (#178)

This commit is contained in:
Onur Filiz
2018-04-27 18:18:36 -07:00
committed by Robbie Zhang
parent 228a1f7a5f
commit 8d67098d06
2785 changed files with 1973570 additions and 25 deletions

5830
vendor/github.com/aws/aws-sdk-go/service/kinesis/api.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,22 @@
package kinesis
import (
"time"
"github.com/aws/aws-sdk-go/aws/request"
)
var readDuration = 5 * time.Second
func init() {
ops := []string{
opGetRecords,
}
initRequest = func(r *request.Request) {
for _, operation := range ops {
if r.Operation.Name == operation {
r.ApplyOptions(request.WithResponseReadTimeout(readDuration))
}
}
}
}

View File

@@ -0,0 +1,89 @@
package kinesis
import (
"io"
"net/http"
"testing"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/awstesting/unit"
)
type testReader struct {
duration time.Duration
}
func (r *testReader) Read(b []byte) (int, error) {
time.Sleep(r.duration)
return 0, io.EOF
}
func (r *testReader) Close() error {
return nil
}
// GetRecords will hang unexpectedly during reads.
// See https://github.com/aws/aws-sdk-go/issues/1141
func TestKinesisGetRecordsCustomization(t *testing.T) {
readDuration = time.Millisecond
retryCount := 0
svc := New(unit.Session, &aws.Config{
MaxRetries: aws.Int(4),
})
req, _ := svc.GetRecordsRequest(&GetRecordsInput{
ShardIterator: aws.String("foo"),
})
req.Handlers.Send.Clear()
req.Handlers.Send.PushBack(func(r *request.Request) {
r.HTTPResponse = &http.Response{
StatusCode: 200,
Header: http.Header{
"X-Amz-Request-Id": []string{"abc123"},
},
Body: &testReader{duration: 10 * time.Second},
ContentLength: -1,
}
r.HTTPResponse.Status = http.StatusText(r.HTTPResponse.StatusCode)
retryCount++
})
req.ApplyOptions(request.WithResponseReadTimeout(time.Second))
err := req.Send()
if err == nil {
t.Errorf("Expected error, but received nil")
} else if v, ok := err.(awserr.Error); !ok {
t.Errorf("Expected awserr.Error but received %v", err)
} else if v.Code() != request.ErrCodeResponseTimeout {
t.Errorf("Expected 'RequestTimeout' error, but received %s instead", v.Code())
}
if retryCount != 5 {
t.Errorf("Expected '5' retries, but received %d", retryCount)
}
}
func TestKinesisGetRecordsNoTimeout(t *testing.T) {
readDuration = time.Second
svc := New(unit.Session)
req, _ := svc.GetRecordsRequest(&GetRecordsInput{
ShardIterator: aws.String("foo"),
})
req.Handlers.Send.Clear()
req.Handlers.Send.PushBack(func(r *request.Request) {
r.HTTPResponse = &http.Response{
StatusCode: 200,
Header: http.Header{
"X-Amz-Request-Id": []string{"abc123"},
},
Body: &testReader{duration: time.Duration(0)},
ContentLength: -1,
}
r.HTTPResponse.Status = http.StatusText(r.HTTPResponse.StatusCode)
})
req.ApplyOptions(request.WithResponseReadTimeout(time.Second))
err := req.Send()
if err != nil {
t.Errorf("Expected no error, but received %v", err)
}
}

View File

@@ -0,0 +1,29 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package kinesis provides the client and types for making API
// requests to Amazon Kinesis.
//
// Amazon Kinesis Data Streams is a managed service that scales elastically
// for real-time processing of streaming big data.
//
// See https://docs.aws.amazon.com/goto/WebAPI/kinesis-2013-12-02 for more information on this service.
//
// See kinesis package documentation for more information.
// https://docs.aws.amazon.com/sdk-for-go/api/service/kinesis/
//
// Using the Client
//
// To contact Amazon Kinesis with the SDK use the New function to create
// a new service client. With that client you can make API requests to the service.
// These clients are safe to use concurrently.
//
// See the SDK's documentation for more information on how to use the SDK.
// https://docs.aws.amazon.com/sdk-for-go/api/
//
// See aws.Config documentation for more information on configuring SDK clients.
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
//
// See the Amazon Kinesis client Kinesis for more
// information on creating client for this service.
// https://docs.aws.amazon.com/sdk-for-go/api/service/kinesis/#New
package kinesis

View File

@@ -0,0 +1,102 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package kinesis
const (
// ErrCodeExpiredIteratorException for service response error code
// "ExpiredIteratorException".
//
// The provided iterator exceeds the maximum age allowed.
ErrCodeExpiredIteratorException = "ExpiredIteratorException"
// ErrCodeExpiredNextTokenException for service response error code
// "ExpiredNextTokenException".
//
// The pagination token passed to the ListShards operation is expired. For more
// information, see ListShardsInput$NextToken.
ErrCodeExpiredNextTokenException = "ExpiredNextTokenException"
// ErrCodeInvalidArgumentException for service response error code
// "InvalidArgumentException".
//
// A specified parameter exceeds its restrictions, is not supported, or can't
// be used. For more information, see the returned message.
ErrCodeInvalidArgumentException = "InvalidArgumentException"
// ErrCodeKMSAccessDeniedException for service response error code
// "KMSAccessDeniedException".
//
// The ciphertext references a key that doesn't exist or that you don't have
// access to.
ErrCodeKMSAccessDeniedException = "KMSAccessDeniedException"
// ErrCodeKMSDisabledException for service response error code
// "KMSDisabledException".
//
// The request was rejected because the specified customer master key (CMK)
// isn't enabled.
ErrCodeKMSDisabledException = "KMSDisabledException"
// ErrCodeKMSInvalidStateException for service response error code
// "KMSInvalidStateException".
//
// The request was rejected because the state of the specified resource isn't
// valid for this request. For more information, see How Key State Affects Use
// of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
// in the AWS Key Management Service Developer Guide.
ErrCodeKMSInvalidStateException = "KMSInvalidStateException"
// ErrCodeKMSNotFoundException for service response error code
// "KMSNotFoundException".
//
// The request was rejected because the specified entity or resource can't be
// found.
ErrCodeKMSNotFoundException = "KMSNotFoundException"
// ErrCodeKMSOptInRequired for service response error code
// "KMSOptInRequired".
//
// The AWS access key ID needs a subscription for the service.
ErrCodeKMSOptInRequired = "KMSOptInRequired"
// ErrCodeKMSThrottlingException for service response error code
// "KMSThrottlingException".
//
// The request was denied due to request throttling. For more information about
// throttling, see Limits (http://docs.aws.amazon.com/kms/latest/developerguide/limits.html#requests-per-second)
// in the AWS Key Management Service Developer Guide.
ErrCodeKMSThrottlingException = "KMSThrottlingException"
// ErrCodeLimitExceededException for service response error code
// "LimitExceededException".
//
// The requested resource exceeds the maximum number allowed, or the number
// of concurrent stream requests exceeds the maximum number allowed.
ErrCodeLimitExceededException = "LimitExceededException"
// ErrCodeProvisionedThroughputExceededException for service response error code
// "ProvisionedThroughputExceededException".
//
// The request rate for the stream is too high, or the requested data is too
// large for the available throughput. Reduce the frequency or size of your
// requests. For more information, see Streams Limits (http://docs.aws.amazon.com/kinesis/latest/dev/service-sizes-and-limits.html)
// in the Amazon Kinesis Data Streams Developer Guide, and Error Retries and
// Exponential Backoff in AWS (http://docs.aws.amazon.com/general/latest/gr/api-retries.html)
// in the AWS General Reference.
ErrCodeProvisionedThroughputExceededException = "ProvisionedThroughputExceededException"
// ErrCodeResourceInUseException for service response error code
// "ResourceInUseException".
//
// The resource is not available for this operation. For successful operation,
// the resource must be in the ACTIVE state.
ErrCodeResourceInUseException = "ResourceInUseException"
// ErrCodeResourceNotFoundException for service response error code
// "ResourceNotFoundException".
//
// The requested resource could not be found. The stream might not be specified
// correctly.
ErrCodeResourceNotFoundException = "ResourceNotFoundException"
)

View File

@@ -0,0 +1,168 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package kinesisiface provides an interface to enable mocking the Amazon Kinesis service client
// for testing your code.
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters.
package kinesisiface
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/kinesis"
)
// KinesisAPI provides an interface to enable mocking the
// kinesis.Kinesis service client's API operation,
// paginators, and waiters. This make unit testing your code that calls out
// to the SDK's service client's calls easier.
//
// The best way to use this interface is so the SDK's service client's calls
// can be stubbed out for unit testing your code with the SDK without needing
// to inject custom request handlers into the SDK's request pipeline.
//
// // myFunc uses an SDK service client to make a request to
// // Amazon Kinesis.
// func myFunc(svc kinesisiface.KinesisAPI) bool {
// // Make svc.AddTagsToStream request
// }
//
// func main() {
// sess := session.New()
// svc := kinesis.New(sess)
//
// myFunc(svc)
// }
//
// In your _test.go file:
//
// // Define a mock struct to be used in your unit tests of myFunc.
// type mockKinesisClient struct {
// kinesisiface.KinesisAPI
// }
// func (m *mockKinesisClient) AddTagsToStream(input *kinesis.AddTagsToStreamInput) (*kinesis.AddTagsToStreamOutput, error) {
// // mock response/functionality
// }
//
// func TestMyFunc(t *testing.T) {
// // Setup Test
// mockSvc := &mockKinesisClient{}
//
// myfunc(mockSvc)
//
// // Verify myFunc's functionality
// }
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters. Its suggested to use the pattern above for testing, or using
// tooling to generate mocks to satisfy the interfaces.
type KinesisAPI interface {
AddTagsToStream(*kinesis.AddTagsToStreamInput) (*kinesis.AddTagsToStreamOutput, error)
AddTagsToStreamWithContext(aws.Context, *kinesis.AddTagsToStreamInput, ...request.Option) (*kinesis.AddTagsToStreamOutput, error)
AddTagsToStreamRequest(*kinesis.AddTagsToStreamInput) (*request.Request, *kinesis.AddTagsToStreamOutput)
CreateStream(*kinesis.CreateStreamInput) (*kinesis.CreateStreamOutput, error)
CreateStreamWithContext(aws.Context, *kinesis.CreateStreamInput, ...request.Option) (*kinesis.CreateStreamOutput, error)
CreateStreamRequest(*kinesis.CreateStreamInput) (*request.Request, *kinesis.CreateStreamOutput)
DecreaseStreamRetentionPeriod(*kinesis.DecreaseStreamRetentionPeriodInput) (*kinesis.DecreaseStreamRetentionPeriodOutput, error)
DecreaseStreamRetentionPeriodWithContext(aws.Context, *kinesis.DecreaseStreamRetentionPeriodInput, ...request.Option) (*kinesis.DecreaseStreamRetentionPeriodOutput, error)
DecreaseStreamRetentionPeriodRequest(*kinesis.DecreaseStreamRetentionPeriodInput) (*request.Request, *kinesis.DecreaseStreamRetentionPeriodOutput)
DeleteStream(*kinesis.DeleteStreamInput) (*kinesis.DeleteStreamOutput, error)
DeleteStreamWithContext(aws.Context, *kinesis.DeleteStreamInput, ...request.Option) (*kinesis.DeleteStreamOutput, error)
DeleteStreamRequest(*kinesis.DeleteStreamInput) (*request.Request, *kinesis.DeleteStreamOutput)
DescribeLimits(*kinesis.DescribeLimitsInput) (*kinesis.DescribeLimitsOutput, error)
DescribeLimitsWithContext(aws.Context, *kinesis.DescribeLimitsInput, ...request.Option) (*kinesis.DescribeLimitsOutput, error)
DescribeLimitsRequest(*kinesis.DescribeLimitsInput) (*request.Request, *kinesis.DescribeLimitsOutput)
DescribeStream(*kinesis.DescribeStreamInput) (*kinesis.DescribeStreamOutput, error)
DescribeStreamWithContext(aws.Context, *kinesis.DescribeStreamInput, ...request.Option) (*kinesis.DescribeStreamOutput, error)
DescribeStreamRequest(*kinesis.DescribeStreamInput) (*request.Request, *kinesis.DescribeStreamOutput)
DescribeStreamPages(*kinesis.DescribeStreamInput, func(*kinesis.DescribeStreamOutput, bool) bool) error
DescribeStreamPagesWithContext(aws.Context, *kinesis.DescribeStreamInput, func(*kinesis.DescribeStreamOutput, bool) bool, ...request.Option) error
DescribeStreamSummary(*kinesis.DescribeStreamSummaryInput) (*kinesis.DescribeStreamSummaryOutput, error)
DescribeStreamSummaryWithContext(aws.Context, *kinesis.DescribeStreamSummaryInput, ...request.Option) (*kinesis.DescribeStreamSummaryOutput, error)
DescribeStreamSummaryRequest(*kinesis.DescribeStreamSummaryInput) (*request.Request, *kinesis.DescribeStreamSummaryOutput)
DisableEnhancedMonitoring(*kinesis.DisableEnhancedMonitoringInput) (*kinesis.EnhancedMonitoringOutput, error)
DisableEnhancedMonitoringWithContext(aws.Context, *kinesis.DisableEnhancedMonitoringInput, ...request.Option) (*kinesis.EnhancedMonitoringOutput, error)
DisableEnhancedMonitoringRequest(*kinesis.DisableEnhancedMonitoringInput) (*request.Request, *kinesis.EnhancedMonitoringOutput)
EnableEnhancedMonitoring(*kinesis.EnableEnhancedMonitoringInput) (*kinesis.EnhancedMonitoringOutput, error)
EnableEnhancedMonitoringWithContext(aws.Context, *kinesis.EnableEnhancedMonitoringInput, ...request.Option) (*kinesis.EnhancedMonitoringOutput, error)
EnableEnhancedMonitoringRequest(*kinesis.EnableEnhancedMonitoringInput) (*request.Request, *kinesis.EnhancedMonitoringOutput)
GetRecords(*kinesis.GetRecordsInput) (*kinesis.GetRecordsOutput, error)
GetRecordsWithContext(aws.Context, *kinesis.GetRecordsInput, ...request.Option) (*kinesis.GetRecordsOutput, error)
GetRecordsRequest(*kinesis.GetRecordsInput) (*request.Request, *kinesis.GetRecordsOutput)
GetShardIterator(*kinesis.GetShardIteratorInput) (*kinesis.GetShardIteratorOutput, error)
GetShardIteratorWithContext(aws.Context, *kinesis.GetShardIteratorInput, ...request.Option) (*kinesis.GetShardIteratorOutput, error)
GetShardIteratorRequest(*kinesis.GetShardIteratorInput) (*request.Request, *kinesis.GetShardIteratorOutput)
IncreaseStreamRetentionPeriod(*kinesis.IncreaseStreamRetentionPeriodInput) (*kinesis.IncreaseStreamRetentionPeriodOutput, error)
IncreaseStreamRetentionPeriodWithContext(aws.Context, *kinesis.IncreaseStreamRetentionPeriodInput, ...request.Option) (*kinesis.IncreaseStreamRetentionPeriodOutput, error)
IncreaseStreamRetentionPeriodRequest(*kinesis.IncreaseStreamRetentionPeriodInput) (*request.Request, *kinesis.IncreaseStreamRetentionPeriodOutput)
ListShards(*kinesis.ListShardsInput) (*kinesis.ListShardsOutput, error)
ListShardsWithContext(aws.Context, *kinesis.ListShardsInput, ...request.Option) (*kinesis.ListShardsOutput, error)
ListShardsRequest(*kinesis.ListShardsInput) (*request.Request, *kinesis.ListShardsOutput)
ListStreams(*kinesis.ListStreamsInput) (*kinesis.ListStreamsOutput, error)
ListStreamsWithContext(aws.Context, *kinesis.ListStreamsInput, ...request.Option) (*kinesis.ListStreamsOutput, error)
ListStreamsRequest(*kinesis.ListStreamsInput) (*request.Request, *kinesis.ListStreamsOutput)
ListStreamsPages(*kinesis.ListStreamsInput, func(*kinesis.ListStreamsOutput, bool) bool) error
ListStreamsPagesWithContext(aws.Context, *kinesis.ListStreamsInput, func(*kinesis.ListStreamsOutput, bool) bool, ...request.Option) error
ListTagsForStream(*kinesis.ListTagsForStreamInput) (*kinesis.ListTagsForStreamOutput, error)
ListTagsForStreamWithContext(aws.Context, *kinesis.ListTagsForStreamInput, ...request.Option) (*kinesis.ListTagsForStreamOutput, error)
ListTagsForStreamRequest(*kinesis.ListTagsForStreamInput) (*request.Request, *kinesis.ListTagsForStreamOutput)
MergeShards(*kinesis.MergeShardsInput) (*kinesis.MergeShardsOutput, error)
MergeShardsWithContext(aws.Context, *kinesis.MergeShardsInput, ...request.Option) (*kinesis.MergeShardsOutput, error)
MergeShardsRequest(*kinesis.MergeShardsInput) (*request.Request, *kinesis.MergeShardsOutput)
PutRecord(*kinesis.PutRecordInput) (*kinesis.PutRecordOutput, error)
PutRecordWithContext(aws.Context, *kinesis.PutRecordInput, ...request.Option) (*kinesis.PutRecordOutput, error)
PutRecordRequest(*kinesis.PutRecordInput) (*request.Request, *kinesis.PutRecordOutput)
PutRecords(*kinesis.PutRecordsInput) (*kinesis.PutRecordsOutput, error)
PutRecordsWithContext(aws.Context, *kinesis.PutRecordsInput, ...request.Option) (*kinesis.PutRecordsOutput, error)
PutRecordsRequest(*kinesis.PutRecordsInput) (*request.Request, *kinesis.PutRecordsOutput)
RemoveTagsFromStream(*kinesis.RemoveTagsFromStreamInput) (*kinesis.RemoveTagsFromStreamOutput, error)
RemoveTagsFromStreamWithContext(aws.Context, *kinesis.RemoveTagsFromStreamInput, ...request.Option) (*kinesis.RemoveTagsFromStreamOutput, error)
RemoveTagsFromStreamRequest(*kinesis.RemoveTagsFromStreamInput) (*request.Request, *kinesis.RemoveTagsFromStreamOutput)
SplitShard(*kinesis.SplitShardInput) (*kinesis.SplitShardOutput, error)
SplitShardWithContext(aws.Context, *kinesis.SplitShardInput, ...request.Option) (*kinesis.SplitShardOutput, error)
SplitShardRequest(*kinesis.SplitShardInput) (*request.Request, *kinesis.SplitShardOutput)
StartStreamEncryption(*kinesis.StartStreamEncryptionInput) (*kinesis.StartStreamEncryptionOutput, error)
StartStreamEncryptionWithContext(aws.Context, *kinesis.StartStreamEncryptionInput, ...request.Option) (*kinesis.StartStreamEncryptionOutput, error)
StartStreamEncryptionRequest(*kinesis.StartStreamEncryptionInput) (*request.Request, *kinesis.StartStreamEncryptionOutput)
StopStreamEncryption(*kinesis.StopStreamEncryptionInput) (*kinesis.StopStreamEncryptionOutput, error)
StopStreamEncryptionWithContext(aws.Context, *kinesis.StopStreamEncryptionInput, ...request.Option) (*kinesis.StopStreamEncryptionOutput, error)
StopStreamEncryptionRequest(*kinesis.StopStreamEncryptionInput) (*request.Request, *kinesis.StopStreamEncryptionOutput)
UpdateShardCount(*kinesis.UpdateShardCountInput) (*kinesis.UpdateShardCountOutput, error)
UpdateShardCountWithContext(aws.Context, *kinesis.UpdateShardCountInput, ...request.Option) (*kinesis.UpdateShardCountOutput, error)
UpdateShardCountRequest(*kinesis.UpdateShardCountInput) (*request.Request, *kinesis.UpdateShardCountOutput)
WaitUntilStreamExists(*kinesis.DescribeStreamInput) error
WaitUntilStreamExistsWithContext(aws.Context, *kinesis.DescribeStreamInput, ...request.WaiterOption) error
WaitUntilStreamNotExists(*kinesis.DescribeStreamInput) error
WaitUntilStreamNotExistsWithContext(aws.Context, *kinesis.DescribeStreamInput, ...request.WaiterOption) error
}
var _ KinesisAPI = (*kinesis.Kinesis)(nil)

View File

@@ -0,0 +1,95 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package kinesis
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
)
// Kinesis provides the API operation methods for making requests to
// Amazon Kinesis. See this package's package overview docs
// for details on the service.
//
// Kinesis methods are safe to use concurrently. It is not safe to
// modify mutate any of the struct's properties though.
type Kinesis struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// Service information constants
const (
ServiceName = "kinesis" // Service endpoint prefix API calls made to.
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
)
// New creates a new instance of the Kinesis client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a Kinesis client from just a session.
// svc := kinesis.New(mySession)
//
// // Create a Kinesis client with additional configuration
// svc := kinesis.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *Kinesis {
c := p.ClientConfig(EndpointsID, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *Kinesis {
svc := &Kinesis{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningName: signingName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2013-12-02",
JSONVersion: "1.1",
TargetPrefix: "Kinesis_20131202",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a Kinesis operation and runs any
// custom request initialization.
func (c *Kinesis) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}

View File

@@ -0,0 +1,102 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package kinesis
import (
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
)
// WaitUntilStreamExists uses the Kinesis API operation
// DescribeStream to wait for a condition to be met before returning.
// If the condition is not met within the max attempt window, an error will
// be returned.
func (c *Kinesis) WaitUntilStreamExists(input *DescribeStreamInput) error {
return c.WaitUntilStreamExistsWithContext(aws.BackgroundContext(), input)
}
// WaitUntilStreamExistsWithContext is an extended version of WaitUntilStreamExists.
// With the support for passing in a context and options to configure the
// Waiter and the underlying request options.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *Kinesis) WaitUntilStreamExistsWithContext(ctx aws.Context, input *DescribeStreamInput, opts ...request.WaiterOption) error {
w := request.Waiter{
Name: "WaitUntilStreamExists",
MaxAttempts: 18,
Delay: request.ConstantWaiterDelay(10 * time.Second),
Acceptors: []request.WaiterAcceptor{
{
State: request.SuccessWaiterState,
Matcher: request.PathWaiterMatch, Argument: "StreamDescription.StreamStatus",
Expected: "ACTIVE",
},
},
Logger: c.Config.Logger,
NewRequest: func(opts []request.Option) (*request.Request, error) {
var inCpy *DescribeStreamInput
if input != nil {
tmp := *input
inCpy = &tmp
}
req, _ := c.DescribeStreamRequest(inCpy)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return req, nil
},
}
w.ApplyOptions(opts...)
return w.WaitWithContext(ctx)
}
// WaitUntilStreamNotExists uses the Kinesis API operation
// DescribeStream to wait for a condition to be met before returning.
// If the condition is not met within the max attempt window, an error will
// be returned.
func (c *Kinesis) WaitUntilStreamNotExists(input *DescribeStreamInput) error {
return c.WaitUntilStreamNotExistsWithContext(aws.BackgroundContext(), input)
}
// WaitUntilStreamNotExistsWithContext is an extended version of WaitUntilStreamNotExists.
// With the support for passing in a context and options to configure the
// Waiter and the underlying request options.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *Kinesis) WaitUntilStreamNotExistsWithContext(ctx aws.Context, input *DescribeStreamInput, opts ...request.WaiterOption) error {
w := request.Waiter{
Name: "WaitUntilStreamNotExists",
MaxAttempts: 18,
Delay: request.ConstantWaiterDelay(10 * time.Second),
Acceptors: []request.WaiterAcceptor{
{
State: request.SuccessWaiterState,
Matcher: request.ErrorWaiterMatch,
Expected: "ResourceNotFoundException",
},
},
Logger: c.Config.Logger,
NewRequest: func(opts []request.Option) (*request.Request, error) {
var inCpy *DescribeStreamInput
if input != nil {
tmp := *input
inCpy = &tmp
}
req, _ := c.DescribeStreamRequest(inCpy)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return req, nil
},
}
w.ApplyOptions(opts...)
return w.WaitWithContext(ctx)
}