kinesis

package module
v0.0.0-...-bb4f876 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2014 License: MIT Imports: 15 Imported by: 0

README

go-kinesis

Build Status

GO-lang library for AWS Kinesis API.

API Documentation

Example

Example you can find in folder examples.

Command line interface

You can find a tool for interacting with kinesis from the command line in folder kinesis-cli.

Documentation

Overview

Package provide GOlang API for http://aws.amazon.com/kinesis/

Index

Constants

View Source
const (
	ACCESS_ENV_KEY  = "AWS_ACCESS_KEY"
	SECRET_ENV_KEY  = "AWS_SECRET_KEY"
	REGION_ENV_NAME = "AWS_REGION_NAME"
)
View Source
const (
	ACTION_KEY = "Action"
)
View Source
const (
	AWS4_URL = "aws4_request"
)

Variables

View Source
var EUWest = Region{"eu-west-1"}
View Source
var USEast = Region{"us-east-1"}
View Source
var USWest2 = Region{"us-west-2"}

Functions

func GetRegion

func GetRegion(region Region) string

func Sign

func Sign(authKeys *Auth, r *http.Request) error

Sign signs a request with a Service derived from r.Host

Types

type Auth

type Auth struct {
	AccessKey, SecretKey, Token string
}

Auth store information about AWS Credentials

type Client

type Client struct {
	Auth *Auth
	// The http client to make requests with. If nil, http.DefaultClient is used.
	Client *http.Client
}

Client is like http.Client, but signs all requests using Auth.

func NewClient

func NewClient(auth *Auth) *Client

New creates a new Client.

func (*Client) Do

func (c *Client) Do(req *http.Request) (resp *http.Response, err error)

do some request, but sign it before sending

type DescribeStreamResp

type DescribeStreamResp struct {
	StreamDescription struct {
		HasMoreShards bool
		Shards        []DescribeStreamShards
		StreamARN     string
		StreamName    string
		StreamStatus  string
	}
}

DescribeStreamResp stores the information that provides by DescribeStream API call

type DescribeStreamShards

type DescribeStreamShards struct {
	AdjacentParentShardId string
	HashKeyRange          struct {
		EndingHashKey   string
		StartingHashKey string
	}
	ParentShardId       string
	SequenceNumberRange struct {
		EndingSequenceNumber   string
		StartingSequenceNumber string
	}
	ShardId string
}

DescribeStreamShards stores the information about list of shards inside DescribeStreamResp

type Error

type Error struct {
	// HTTP status code (200, 403, ...)
	StatusCode int
	// error code ("UnsupportedOperation", ...)
	Code string
	// The human-oriented error message
	Message   string
	RequestId string
}

Error represent error from Kinesis API

func (*Error) Error

func (err *Error) Error() string

Return error message from error object

type GetRecordsRecords

type GetRecordsRecords struct {
	Data           []byte
	PartitionKey   string
	SequenceNumber string
}

GetNextRecordsRecords stores the information that provides by GetNextRecordsResp

func (GetRecordsRecords) GetData

func (r GetRecordsRecords) GetData() ([]byte, error)

type GetRecordsResp

type GetRecordsResp struct {
	NextShardIterator string
	Records           []GetRecordsRecords
}

GetNextRecordsResp stores the information that provides by GetNextRecords API call

type GetShardIteratorResp

type GetShardIteratorResp struct {
	ShardIterator string
}

GetShardIteratorResp stores the information that provides by GetShardIterator API call

type Kinesis

type Kinesis struct {
	Region  string
	Version string
	// contains filtered or unexported fields
}

Structure for kinesis client

func New

func New(access_key string, secret_key string, region Region) *Kinesis

Initialize new client for AWS Kinesis

func (*Kinesis) CreateStream

func (kinesis *Kinesis) CreateStream(StreamName string, ShardCount int) error

CreateStream adds a new Amazon Kinesis stream to your AWS account StreamName is a name of stream, ShardCount is number of shards more info http://docs.aws.amazon.com/kinesis/latest/APIReference/API_CreateStream.html

func (*Kinesis) DeleteStream

func (kinesis *Kinesis) DeleteStream(StreamName string) error

DeleteStream deletes a stream and all of its shards and data from your AWS account StreamName is a name of stream more info http://docs.aws.amazon.com/kinesis/latest/APIReference/API_DeleteStream.html

func (*Kinesis) DescribeStream

func (kinesis *Kinesis) DescribeStream(args *RequestArgs) (resp *DescribeStreamResp, err error)

DescribeStream returns the following information about the stream: the current status of the stream, the stream Amazon Resource Name (ARN), and an array of shard objects that comprise the stream. For each shard object there is information about the hash key and sequence number ranges that the shard spans, and the IDs of any earlier shards that played in a role in a MergeShards or SplitShard operation that created the shard more info http://docs.aws.amazon.com/kinesis/latest/APIReference/API_DescribeStream.html

func (*Kinesis) GetRecords

func (kinesis *Kinesis) GetRecords(args *RequestArgs) (resp *GetRecordsResp, err error)

GetRecords returns one or more data records from a shard more info http://docs.aws.amazon.com/kinesis/latest/APIReference/API_GetRecords.html

func (*Kinesis) GetShardIterator

func (kinesis *Kinesis) GetShardIterator(args *RequestArgs) (resp *GetShardIteratorResp, err error)

GetShardIterator returns a shard iterator more info http://docs.aws.amazon.com/kinesis/latest/APIReference/API_GetShardIterator.html

func (*Kinesis) ListStreams

func (kinesis *Kinesis) ListStreams(args *RequestArgs) (resp *ListStreamsResp, err error)

ListStreams returns an array of the names of all the streams that are associated with the AWS account making the ListStreams request more info http://docs.aws.amazon.com/kinesis/latest/APIReference/API_ListStreams.html

func (*Kinesis) MergeShards

func (kinesis *Kinesis) MergeShards(args *RequestArgs) error

MergeShards merges two adjacent shards in a stream and combines them into a single shard to reduce the stream's capacity to ingest and transport data more info http://docs.aws.amazon.com/kinesis/latest/APIReference/API_MergeShards.html

func (*Kinesis) PutRecord

func (kinesis *Kinesis) PutRecord(args *RequestArgs) (resp *PutRecordResp, err error)

PutRecord puts a data record into an Amazon Kinesis stream from a producer more info http://docs.aws.amazon.com/kinesis/latest/APIReference/API_PutRecord.html

func (*Kinesis) SplitShard

func (kinesis *Kinesis) SplitShard(args *RequestArgs) error

SplitShard splits a shard into two new shards in the stream, to increase the stream's capacity to ingest and transport data more info http://docs.aws.amazon.com/kinesis/latest/APIReference/API_SplitShard.html

type KinesisClient

type KinesisClient interface {
	CreateStream(StreamName string, ShardCount int) error
	DeleteStream(StreamName string) error
	MergeShards(args *RequestArgs) error
	SplitShard(args *RequestArgs) error
	ListStreams(args *RequestArgs) (resp *ListStreamsResp, err error)
	DescribeStream(args *RequestArgs) (resp *DescribeStreamResp, err error)
	GetShardIterator(args *RequestArgs) (resp *GetShardIteratorResp, err error)
	GetRecords(args *RequestArgs) (resp *GetRecordsResp, err error)
	PutRecord(args *RequestArgs) (resp *PutRecordResp, err error)
}

Interface implemented by Kinesis

type ListStreamsResp

type ListStreamsResp struct {
	HasMoreStreams bool
	StreamNames    []string
}

ListStreamsResp stores the information that provides by ListStreams API call

type PutRecordResp

type PutRecordResp struct {
	SequenceNumber string
	ShardId        string
}

PutRecordResp stores the information that provides by PutRecord API call

type Region

type Region struct {
	Name string
}

type RequestArgs

type RequestArgs struct {
	// contains filtered or unexported fields
}

RequestArgs store params for request

func NewArgs

func NewArgs() *RequestArgs

NewFilter creates a new Filter.

func (*RequestArgs) Add

func (f *RequestArgs) Add(name string, value interface{})

Add appends a filtering parameter with the given name and value(s).

func (*RequestArgs) AddData

func (f *RequestArgs) AddData(value []byte)

type Service

type Service struct {
	// Name is the name of the service being used (i.e. iam, etc)
	Name string

	// Region is the region you want to communicate with the service through. (i.e. us-east-1)
	Region string
}

Service represents an AWS-compatible service.

func (*Service) Sign

func (s *Service) Sign(authKeys *Auth, r *http.Request) error

Sign signs an HTTP request with the given AWS keys for use on service s.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL