Switch to using the dep tool and update all the dependencies

This commit is contained in:
Nick Craig-Wood
2017-05-11 15:39:54 +01:00
parent 5135ff73cb
commit 98c2d2c41b
5321 changed files with 4483197 additions and 5918 deletions
File diff suppressed because it is too large Load Diff
+22
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))
}
}
}
}
@@ -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)
}
}
+81
View File
@@ -0,0 +1,81 @@
// 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 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 use the client for Amazon Kinesis you will first need
// to create a new instance of it.
//
// When creating a client for an AWS service you'll first need to have a Session
// already created. The Session provides configuration that can be shared
// between multiple service clients. Additional configuration can be applied to
// the Session and service's client when they are constructed. The aws package's
// Config type contains several fields such as Region for the AWS Region the
// client should make API requests too. The optional Config value can be provided
// as the variadic argument for Sessions and client creation.
//
// Once the service's client is created you can use it to make API requests the
// AWS service. These clients are safe to use concurrently.
//
// // Create a session to share configuration, and load external configuration.
// sess := session.Must(session.NewSession())
//
// // Create the service's client with the session.
// svc := kinesis.New(sess)
//
// See the SDK's documentation for more information on how to use service clients.
// https://docs.aws.amazon.com/sdk-for-go/api/
//
// See aws package's Config type for more information on configuration options.
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
//
// See the Amazon Kinesis client Kinesis for more
// information on creating the service's client.
// https://docs.aws.amazon.com/sdk-for-go/api/service/kinesis/#New
//
// Once the client is created you can make an API request to the service.
// Each API method takes a input parameter, and returns the service response
// and an error.
//
// The API method will document which error codes the service can be returned
// by the operation if the service models the API operation's errors. These
// errors will also be available as const strings prefixed with "ErrCode".
//
// result, err := svc.AddTagsToStream(params)
// if err != nil {
// // Cast err to awserr.Error to handle specific error codes.
// aerr, ok := err.(awserr.Error)
// if ok && aerr.Code() == <error code to check for> {
// // Specific error code handling
// }
// return err
// }
//
// fmt.Println("AddTagsToStream result:")
// fmt.Println(result)
//
// Using the Client with Context
//
// The service's client also provides methods to make API requests with a Context
// value. This allows you to control the timeout, and cancellation of pending
// requests. These methods also take request Option as variadic parameter to apply
// additional configuration to the API request.
//
// ctx := context.Background()
//
// result, err := svc.AddTagsToStreamWithContext(ctx, params)
//
// See the request package documentation for more information on using Context pattern
// with the SDK.
// https://docs.aws.amazon.com/sdk-for-go/api/aws/request/
package kinesis
+51
View File
@@ -0,0 +1,51 @@
// 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"
// 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"
// 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 (5).
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 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 needs to 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"
)
+460
View File
@@ -0,0 +1,460 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package kinesis_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/kinesis"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleKinesis_AddTagsToStream() {
sess := session.Must(session.NewSession())
svc := kinesis.New(sess)
params := &kinesis.AddTagsToStreamInput{
StreamName: aws.String("StreamName"), // Required
Tags: map[string]*string{ // Required
"Key": aws.String("TagValue"), // Required
// More values...
},
}
resp, err := svc.AddTagsToStream(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleKinesis_CreateStream() {
sess := session.Must(session.NewSession())
svc := kinesis.New(sess)
params := &kinesis.CreateStreamInput{
ShardCount: aws.Int64(1), // Required
StreamName: aws.String("StreamName"), // Required
}
resp, err := svc.CreateStream(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleKinesis_DecreaseStreamRetentionPeriod() {
sess := session.Must(session.NewSession())
svc := kinesis.New(sess)
params := &kinesis.DecreaseStreamRetentionPeriodInput{
RetentionPeriodHours: aws.Int64(1), // Required
StreamName: aws.String("StreamName"), // Required
}
resp, err := svc.DecreaseStreamRetentionPeriod(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleKinesis_DeleteStream() {
sess := session.Must(session.NewSession())
svc := kinesis.New(sess)
params := &kinesis.DeleteStreamInput{
StreamName: aws.String("StreamName"), // Required
}
resp, err := svc.DeleteStream(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleKinesis_DescribeLimits() {
sess := session.Must(session.NewSession())
svc := kinesis.New(sess)
var params *kinesis.DescribeLimitsInput
resp, err := svc.DescribeLimits(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleKinesis_DescribeStream() {
sess := session.Must(session.NewSession())
svc := kinesis.New(sess)
params := &kinesis.DescribeStreamInput{
StreamName: aws.String("StreamName"), // Required
ExclusiveStartShardId: aws.String("ShardId"),
Limit: aws.Int64(1),
}
resp, err := svc.DescribeStream(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleKinesis_DisableEnhancedMonitoring() {
sess := session.Must(session.NewSession())
svc := kinesis.New(sess)
params := &kinesis.DisableEnhancedMonitoringInput{
ShardLevelMetrics: []*string{ // Required
aws.String("MetricsName"), // Required
// More values...
},
StreamName: aws.String("StreamName"), // Required
}
resp, err := svc.DisableEnhancedMonitoring(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleKinesis_EnableEnhancedMonitoring() {
sess := session.Must(session.NewSession())
svc := kinesis.New(sess)
params := &kinesis.EnableEnhancedMonitoringInput{
ShardLevelMetrics: []*string{ // Required
aws.String("MetricsName"), // Required
// More values...
},
StreamName: aws.String("StreamName"), // Required
}
resp, err := svc.EnableEnhancedMonitoring(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleKinesis_GetRecords() {
sess := session.Must(session.NewSession())
svc := kinesis.New(sess)
params := &kinesis.GetRecordsInput{
ShardIterator: aws.String("ShardIterator"), // Required
Limit: aws.Int64(1),
}
resp, err := svc.GetRecords(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleKinesis_GetShardIterator() {
sess := session.Must(session.NewSession())
svc := kinesis.New(sess)
params := &kinesis.GetShardIteratorInput{
ShardId: aws.String("ShardId"), // Required
ShardIteratorType: aws.String("ShardIteratorType"), // Required
StreamName: aws.String("StreamName"), // Required
StartingSequenceNumber: aws.String("SequenceNumber"),
Timestamp: aws.Time(time.Now()),
}
resp, err := svc.GetShardIterator(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleKinesis_IncreaseStreamRetentionPeriod() {
sess := session.Must(session.NewSession())
svc := kinesis.New(sess)
params := &kinesis.IncreaseStreamRetentionPeriodInput{
RetentionPeriodHours: aws.Int64(1), // Required
StreamName: aws.String("StreamName"), // Required
}
resp, err := svc.IncreaseStreamRetentionPeriod(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleKinesis_ListStreams() {
sess := session.Must(session.NewSession())
svc := kinesis.New(sess)
params := &kinesis.ListStreamsInput{
ExclusiveStartStreamName: aws.String("StreamName"),
Limit: aws.Int64(1),
}
resp, err := svc.ListStreams(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleKinesis_ListTagsForStream() {
sess := session.Must(session.NewSession())
svc := kinesis.New(sess)
params := &kinesis.ListTagsForStreamInput{
StreamName: aws.String("StreamName"), // Required
ExclusiveStartTagKey: aws.String("TagKey"),
Limit: aws.Int64(1),
}
resp, err := svc.ListTagsForStream(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleKinesis_MergeShards() {
sess := session.Must(session.NewSession())
svc := kinesis.New(sess)
params := &kinesis.MergeShardsInput{
AdjacentShardToMerge: aws.String("ShardId"), // Required
ShardToMerge: aws.String("ShardId"), // Required
StreamName: aws.String("StreamName"), // Required
}
resp, err := svc.MergeShards(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleKinesis_PutRecord() {
sess := session.Must(session.NewSession())
svc := kinesis.New(sess)
params := &kinesis.PutRecordInput{
Data: []byte("PAYLOAD"), // Required
PartitionKey: aws.String("PartitionKey"), // Required
StreamName: aws.String("StreamName"), // Required
ExplicitHashKey: aws.String("HashKey"),
SequenceNumberForOrdering: aws.String("SequenceNumber"),
}
resp, err := svc.PutRecord(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleKinesis_PutRecords() {
sess := session.Must(session.NewSession())
svc := kinesis.New(sess)
params := &kinesis.PutRecordsInput{
Records: []*kinesis.PutRecordsRequestEntry{ // Required
{ // Required
Data: []byte("PAYLOAD"), // Required
PartitionKey: aws.String("PartitionKey"), // Required
ExplicitHashKey: aws.String("HashKey"),
},
// More values...
},
StreamName: aws.String("StreamName"), // Required
}
resp, err := svc.PutRecords(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleKinesis_RemoveTagsFromStream() {
sess := session.Must(session.NewSession())
svc := kinesis.New(sess)
params := &kinesis.RemoveTagsFromStreamInput{
StreamName: aws.String("StreamName"), // Required
TagKeys: []*string{ // Required
aws.String("TagKey"), // Required
// More values...
},
}
resp, err := svc.RemoveTagsFromStream(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleKinesis_SplitShard() {
sess := session.Must(session.NewSession())
svc := kinesis.New(sess)
params := &kinesis.SplitShardInput{
NewStartingHashKey: aws.String("HashKey"), // Required
ShardToSplit: aws.String("ShardId"), // Required
StreamName: aws.String("StreamName"), // Required
}
resp, err := svc.SplitShard(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleKinesis_UpdateShardCount() {
sess := session.Must(session.NewSession())
svc := kinesis.New(sess)
params := &kinesis.UpdateShardCountInput{
ScalingType: aws.String("ScalingType"), // Required
StreamName: aws.String("StreamName"), // Required
TargetShardCount: aws.Int64(1), // Required
}
resp, err := svc.UpdateShardCount(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
@@ -0,0 +1,152 @@
// 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 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
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)
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)
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)
+95
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
}
+102
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 meet 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 meet 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)
}