AWS SDK for Go (PILOT)
API Reference

PREVIEW DOCUMENTATION - This is a preview of a new format for the AWS SDK for Go API Reference documentation. For the current AWS SDK for Go API Reference, see https://docs.aws.amazon.com/sdk-for-go/api/.

We welcome your feedback on this new version of the documentation. Send your comments to aws-sdkdocs-feedback@amazon.com.

DynamoDBStreams

import "github.com/aws/aws-sdk-go/service/dynamodbstreams"

type DynamoDBStreams struct { *client.Client }

DynamoDBStreams provides the API operation methods for making requests to Amazon DynamoDB Streams. See this package's package overview docs for details on the service.

DynamoDBStreams methods are safe to use concurrently. It is not safe to modify mutate any of the struct's properties though.

Client

Type: *client.Client

Method

DescribeStream

func (c *DynamoDBStreams) DescribeStream(input *DescribeStreamInput) (*DescribeStreamOutput, error)

DescribeStream API operation for Amazon DynamoDB Streams.

Returns information about a stream, including the current status of the stream, its Amazon Resource Name (ARN), the composition of its shards, and its corresponding DynamoDB table.

You can call DescribeStream at a maximum rate of 10 times per second.

Each shard in the stream has a SequenceNumberRange associated with it. If the SequenceNumberRange has a StartingSequenceNumber but no EndingSequenceNumber, then the shard is still open (able to receive more stream records). If both StartingSequenceNumber and EndingSequenceNumber are present, then that shard is closed and can no longer receive more data.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Amazon DynamoDB Streams's API operation DescribeStream for usage and error information.

Returned Error Codes:

  • ErrCodeResourceNotFoundException "ResourceNotFoundException" The operation tried to access a nonexistent stream.

  • ErrCodeInternalServerError "InternalServerError" An error occurred on the server side.

See also, https://docs.aws.amazon.com/goto/WebAPI/streams-dynamodb-2012-08-10/DescribeStream

Example

DynamoDBStreams DescribeStream shared00

To describe a stream with a given stream ARN

The following example describes a stream with a given stream ARN.

{ svc := dynamodbstreams.New(session.New()) input := &dynamodbstreams.DescribeStreamInput{ StreamArn: aws.String("arn:aws:dynamodb:us-west-2:111122223333:table/Forum/stream/2015-05-20T20:51:10.252"), } result, err := svc.DescribeStream(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case dynamodbstreams.ErrCodeResourceNotFoundException: fmt.Println(dynamodbstreams.ErrCodeResourceNotFoundException, aerr.Error()) case dynamodbstreams.ErrCodeInternalServerError: fmt.Println(dynamodbstreams.ErrCodeInternalServerError, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribeStreamRequest

func (c *DynamoDBStreams) DescribeStreamRequest(input *DescribeStreamInput) (req *request.Request, output *DescribeStreamOutput)

DescribeStreamRequest generates a "aws/request.Request" representing the client's request for the DescribeStream operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeStream for more information on using the DescribeStream API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DescribeStreamRequest method. req, resp := client.DescribeStreamRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/streams-dynamodb-2012-08-10/DescribeStream

DescribeStreamWithContext

func (c *DynamoDBStreams) DescribeStreamWithContext(ctx aws.Context, input *DescribeStreamInput, opts ...request.Option) (*DescribeStreamOutput, error)

DescribeStreamWithContext is the same as DescribeStream with the addition of the ability to pass a context and additional request options.

See DescribeStream for details on how to use this API operation.

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.

See Also

For more information about using this API, see AWS API Documentation.

GetRecords

func (c *DynamoDBStreams) GetRecords(input *GetRecordsInput) (*GetRecordsOutput, error)

GetRecords API operation for Amazon DynamoDB Streams.

Retrieves the stream records from a given shard.

Specify a shard iterator using the ShardIterator parameter. The shard iterator specifies the position in the shard from which you want to start reading stream records sequentially. If there are no stream records available in the portion of the shard that the iterator points to, GetRecords returns an empty list. Note that it might take multiple calls to get to a portion of the shard that contains stream records.

GetRecords can retrieve a maximum of 1 MB of data or 1000 stream records, whichever comes first.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Amazon DynamoDB Streams's API operation GetRecords for usage and error information.

Returned Error Codes:

  • ErrCodeResourceNotFoundException "ResourceNotFoundException" The operation tried to access a nonexistent stream.

  • ErrCodeLimitExceededException "LimitExceededException" Your request rate is too high. The AWS SDKs for DynamoDB automatically retry requests that receive this exception. Your request is eventually successful, unless your retry queue is too large to finish. Reduce the frequency of requests and use exponential backoff. For more information, go to Error Retries and Exponential Backoff (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ErrorHandling.html#APIRetries) in the Amazon DynamoDB Developer Guide.

  • ErrCodeInternalServerError "InternalServerError" An error occurred on the server side.

  • ErrCodeExpiredIteratorException "ExpiredIteratorException" The shard iterator has expired and can no longer be used to retrieve stream records. A shard iterator expires 15 minutes after it is retrieved using the GetShardIterator action.

  • ErrCodeTrimmedDataAccessException "TrimmedDataAccessException" The operation attempted to read past the oldest stream record in a shard.

In DynamoDB Streams, there is a 24 hour limit on data retention. Stream records whose age exceeds this limit are subject to removal (trimming) from the stream. You might receive a TrimmedDataAccessException if:
  • You request a shard iterator with a sequence number older than the trim point (24 hours).

  • You obtain a shard iterator, but before you use the iterator in a GetRecords request, a stream record in the shard exceeds the 24 hour period and is trimmed. This causes the iterator to access a record that no longer exists.

See also, https://docs.aws.amazon.com/goto/WebAPI/streams-dynamodb-2012-08-10/GetRecords

Example

DynamoDBStreams GetRecords shared00

To retrieve all the stream records from a shard

The following example retrieves all the stream records from a shard.

{ svc := dynamodbstreams.New(session.New()) input := &dynamodbstreams.GetRecordsInput{ ShardIterator: aws.String("arn:aws:dynamodb:us-west-2:111122223333:table/Forum/stream/2015-05-20T20:51:10.252|1|AAAAAAAAAAEvJp6D+zaQ... <remaining characters omitted> ..."), } result, err := svc.GetRecords(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case dynamodbstreams.ErrCodeResourceNotFoundException: fmt.Println(dynamodbstreams.ErrCodeResourceNotFoundException, aerr.Error()) case dynamodbstreams.ErrCodeLimitExceededException: fmt.Println(dynamodbstreams.ErrCodeLimitExceededException, aerr.Error()) case dynamodbstreams.ErrCodeInternalServerError: fmt.Println(dynamodbstreams.ErrCodeInternalServerError, aerr.Error()) case dynamodbstreams.ErrCodeExpiredIteratorException: fmt.Println(dynamodbstreams.ErrCodeExpiredIteratorException, aerr.Error()) case dynamodbstreams.ErrCodeTrimmedDataAccessException: fmt.Println(dynamodbstreams.ErrCodeTrimmedDataAccessException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

GetRecordsRequest

func (c *DynamoDBStreams) GetRecordsRequest(input *GetRecordsInput) (req *request.Request, output *GetRecordsOutput)

GetRecordsRequest generates a "aws/request.Request" representing the client's request for the GetRecords operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See GetRecords for more information on using the GetRecords API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the GetRecordsRequest method. req, resp := client.GetRecordsRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/streams-dynamodb-2012-08-10/GetRecords

GetRecordsWithContext

func (c *DynamoDBStreams) GetRecordsWithContext(ctx aws.Context, input *GetRecordsInput, opts ...request.Option) (*GetRecordsOutput, error)

GetRecordsWithContext is the same as GetRecords with the addition of the ability to pass a context and additional request options.

See GetRecords for details on how to use this API operation.

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.

See Also

For more information about using this API, see AWS API Documentation.

GetShardIterator

func (c *DynamoDBStreams) GetShardIterator(input *GetShardIteratorInput) (*GetShardIteratorOutput, error)

GetShardIterator API operation for Amazon DynamoDB Streams.

Returns a shard iterator. A shard iterator provides information about how to retrieve the stream records from within a shard. Use the shard iterator in a subsequent GetRecords request to read the stream records from the shard.

A shard iterator expires 15 minutes after it is returned to the requester.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Amazon DynamoDB Streams's API operation GetShardIterator for usage and error information.

Returned Error Codes:

  • ErrCodeResourceNotFoundException "ResourceNotFoundException" The operation tried to access a nonexistent stream.

  • ErrCodeInternalServerError "InternalServerError" An error occurred on the server side.

  • ErrCodeTrimmedDataAccessException "TrimmedDataAccessException" The operation attempted to read past the oldest stream record in a shard.

In DynamoDB Streams, there is a 24 hour limit on data retention. Stream records whose age exceeds this limit are subject to removal (trimming) from the stream. You might receive a TrimmedDataAccessException if:
  • You request a shard iterator with a sequence number older than the trim point (24 hours).

  • You obtain a shard iterator, but before you use the iterator in a GetRecords request, a stream record in the shard exceeds the 24 hour period and is trimmed. This causes the iterator to access a record that no longer exists.

See also, https://docs.aws.amazon.com/goto/WebAPI/streams-dynamodb-2012-08-10/GetShardIterator

Example

DynamoDBStreams GetShardIterator shared00

To obtain a shard iterator for the provided stream ARN and shard ID

The following example returns a shard iterator for the provided stream ARN and shard ID.

{ svc := dynamodbstreams.New(session.New()) input := &dynamodbstreams.GetShardIteratorInput{ ShardId: aws.String("00000001414576573621-f55eea83"), ShardIteratorType: aws.String("TRIM_HORIZON"), StreamArn: aws.String("arn:aws:dynamodb:us-west-2:111122223333:table/Forum/stream/2015-05-20T20:51:10.252"), } result, err := svc.GetShardIterator(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case dynamodbstreams.ErrCodeResourceNotFoundException: fmt.Println(dynamodbstreams.ErrCodeResourceNotFoundException, aerr.Error()) case dynamodbstreams.ErrCodeInternalServerError: fmt.Println(dynamodbstreams.ErrCodeInternalServerError, aerr.Error()) case dynamodbstreams.ErrCodeTrimmedDataAccessException: fmt.Println(dynamodbstreams.ErrCodeTrimmedDataAccessException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

GetShardIteratorRequest

func (c *DynamoDBStreams) GetShardIteratorRequest(input *GetShardIteratorInput) (req *request.Request, output *GetShardIteratorOutput)

GetShardIteratorRequest generates a "aws/request.Request" representing the client's request for the GetShardIterator operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See GetShardIterator for more information on using the GetShardIterator API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the GetShardIteratorRequest method. req, resp := client.GetShardIteratorRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/streams-dynamodb-2012-08-10/GetShardIterator

GetShardIteratorWithContext

func (c *DynamoDBStreams) GetShardIteratorWithContext(ctx aws.Context, input *GetShardIteratorInput, opts ...request.Option) (*GetShardIteratorOutput, error)

GetShardIteratorWithContext is the same as GetShardIterator with the addition of the ability to pass a context and additional request options.

See GetShardIterator for details on how to use this API operation.

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.

See Also

For more information about using this API, see AWS API Documentation.

ListStreams

func (c *DynamoDBStreams) ListStreams(input *ListStreamsInput) (*ListStreamsOutput, error)

ListStreams API operation for Amazon DynamoDB Streams.

Returns an array of stream ARNs associated with the current account and endpoint. If the TableName parameter is present, then ListStreams will return only the streams ARNs for that table.

You can call ListStreams at a maximum rate of 5 times per second.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Amazon DynamoDB Streams's API operation ListStreams for usage and error information.

Returned Error Codes:

  • ErrCodeResourceNotFoundException "ResourceNotFoundException" The operation tried to access a nonexistent stream.

  • ErrCodeInternalServerError "InternalServerError" An error occurred on the server side.

See also, https://docs.aws.amazon.com/goto/WebAPI/streams-dynamodb-2012-08-10/ListStreams

Example

DynamoDBStreams ListStreams shared00

To list all of the stream ARNs

The following example lists all of the stream ARNs.

{ svc := dynamodbstreams.New(session.New()) input := &dynamodbstreams.ListStreamsInput{} result, err := svc.ListStreams(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case dynamodbstreams.ErrCodeResourceNotFoundException: fmt.Println(dynamodbstreams.ErrCodeResourceNotFoundException, aerr.Error()) case dynamodbstreams.ErrCodeInternalServerError: fmt.Println(dynamodbstreams.ErrCodeInternalServerError, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

ListStreamsRequest

func (c *DynamoDBStreams) ListStreamsRequest(input *ListStreamsInput) (req *request.Request, output *ListStreamsOutput)

ListStreamsRequest generates a "aws/request.Request" representing the client's request for the ListStreams operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See ListStreams for more information on using the ListStreams API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the ListStreamsRequest method. req, resp := client.ListStreamsRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/streams-dynamodb-2012-08-10/ListStreams

ListStreamsWithContext

func (c *DynamoDBStreams) ListStreamsWithContext(ctx aws.Context, input *ListStreamsInput, opts ...request.Option) (*ListStreamsOutput, error)

ListStreamsWithContext is the same as ListStreams with the addition of the ability to pass a context and additional request options.

See ListStreams for details on how to use this API operation.

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.

See Also

For more information about using this API, see AWS API Documentation.

On this page: