当前位置: 首页>>代码示例>>Golang>>正文


Golang kinesis.New函数代码示例

本文整理汇总了Golang中github.com/awslabs/aws-sdk-go/service/kinesis.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了New函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: ExampleKinesis_DeleteStream

func ExampleKinesis_DeleteStream() {
	svc := kinesis.New(nil)

	params := &kinesis.DeleteStreamInput{
		StreamName: aws.String("StreamName"), // Required
	}
	resp, err := svc.DeleteStream(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS Error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, The SDK should alwsy return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:26,代码来源:examples_test.go

示例2: ExampleKinesis_PutRecords

func ExampleKinesis_PutRecords() {
	svc := kinesis.New(nil)

	params := &kinesis.PutRecordsInput{
		Records: []*kinesis.PutRecordsRequestEntry{ // Required
			&kinesis.PutRecordsRequestEntry{ // 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 {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS Error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, The SDK should alwsy return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:34,代码来源:examples_test.go

示例3: TestMigrateStreams

func TestMigrateStreams(t *testing.T) {
	if os.Getenv("AWS_ACCESS_KEY_ID") == "" || os.Getenv("AWS_SECRET_ACCESS_KEY") == "" {
		log.Printf("WARNING: NO AWS CREDS SPECIFIED, SKIPPING MIGRATIONS TEST")
		return
	}

	config := &aws.Config{
		Credentials: credentials.NewEnvCredentials(),
		Region:      "us-east-1",
	}
	client := kinesis.New(config)

	sm := StreamMigrator{
		Streams: []kinesis.CreateStreamInput{
			kinesis.CreateStreamInput{
				StreamName: aws.String(testDomain),
				ShardCount: aws.Long(1),
			},
		},
		Client:  client,
		Timeout: 30,
	}

	sm.Migrate()
	sm.Migrate()

}
开发者ID:freeformz,项目名称:swfsm,代码行数:27,代码来源:migrator_test.go

示例4: NewStreamProducer

// NewStreamProducer TODO
func NewStreamProducer(opts *KinesisProducerConfig) (producer *KinesisStreamProducer) {
	producer = &KinesisStreamProducer{
		client:    kinesis.New(getAWSConfig(opts.AWSDebugMode)),
		successes: make(chan *KinesisMessage, opts.BufferSize),
		errors:    make(chan *KinesisError, opts.BufferSize),
		input:     make(chan *KinesisMessage, opts.BufferSize),
		killInput: make(chan bool, 1),
		config:    opts,
		isManaged: false,
	}
	go producer.getMessages()
	return
}
开发者ID:delicioussandwiches,项目名称:kinesis_producer,代码行数:14,代码来源:kinesis_producer.go

示例5: NewStreamConsumer

// NewStreamConsumer TODO
func NewStreamConsumer(opts *Config) (consumer *StreamConsumer, err error) {
	if opts, err = validateConfig(opts); err != nil {
		return
	}

	dynamo := newDynamo(opts.ConsumerGroup, opts.ReadCapacity, opts.WriteCapacity)
	if err = dynamo.ValidateTable(); err != nil {
		return
	}

	consumer = &StreamConsumer{
		client: kinesis.New(getAWSConfig(opts.AWSDebugMode)),
		config: opts,
		data:   make(chan *KinesisRecord, opts.BufferSize),
		numRecordsPerIteration: aws.Long(opts.NumRecords),
		dynamo:                 dynamo,
		ownedShards:            make([]string, 0),
		checkpoints:            make(map[string]string),
	}
	return
}
开发者ID:delicioussandwiches,项目名称:kinesis_client_library,代码行数:22,代码来源:kinesis_stream_consumer.go

示例6: init

func init() {
	Before("@kinesis", func() {
		World["client"] = kinesis.New(nil)
	})
}
开发者ID:ninefive,项目名称:confd,代码行数:5,代码来源:client.go

示例7: TestInterface

func TestInterface(t *testing.T) {
	assert.Implements(t, (*kinesisiface.KinesisAPI)(nil), kinesis.New(nil))
}
开发者ID:freeformz,项目名称:swfsm,代码行数:3,代码来源:interface_test.go


注:本文中的github.com/awslabs/aws-sdk-go/service/kinesis.New函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。