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)) }
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)) }
func TestInterface(t *testing.T) { assert.Implements(t, (*kinesisiface.KinesisAPI)(nil), kinesis.New(nil)) }
func Kinesis() *kinesis.Kinesis { return kinesis.New(&aws.Config{ Credentials: credentials.NewCredentials(&AwsCredentials{}), Region: os.Getenv("AWS_REGION"), }) }