當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。