| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408 |
- // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
- package firehose_test
- import (
- "bytes"
- "fmt"
- "time"
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/session"
- "github.com/aws/aws-sdk-go/service/firehose"
- )
- var _ time.Duration
- var _ bytes.Buffer
- func ExampleFirehose_CreateDeliveryStream() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := firehose.New(sess)
- params := &firehose.CreateDeliveryStreamInput{
- DeliveryStreamName: aws.String("DeliveryStreamName"), // Required
- ElasticsearchDestinationConfiguration: &firehose.ElasticsearchDestinationConfiguration{
- DomainARN: aws.String("ElasticsearchDomainARN"), // Required
- IndexName: aws.String("ElasticsearchIndexName"), // Required
- RoleARN: aws.String("RoleARN"), // Required
- S3Configuration: &firehose.S3DestinationConfiguration{ // Required
- BucketARN: aws.String("BucketARN"), // Required
- RoleARN: aws.String("RoleARN"), // Required
- BufferingHints: &firehose.BufferingHints{
- IntervalInSeconds: aws.Int64(1),
- SizeInMBs: aws.Int64(1),
- },
- CloudWatchLoggingOptions: &firehose.CloudWatchLoggingOptions{
- Enabled: aws.Bool(true),
- LogGroupName: aws.String("LogGroupName"),
- LogStreamName: aws.String("LogStreamName"),
- },
- CompressionFormat: aws.String("CompressionFormat"),
- EncryptionConfiguration: &firehose.EncryptionConfiguration{
- KMSEncryptionConfig: &firehose.KMSEncryptionConfig{
- AWSKMSKeyARN: aws.String("AWSKMSKeyARN"), // Required
- },
- NoEncryptionConfig: aws.String("NoEncryptionConfig"),
- },
- Prefix: aws.String("Prefix"),
- },
- TypeName: aws.String("ElasticsearchTypeName"), // Required
- BufferingHints: &firehose.ElasticsearchBufferingHints{
- IntervalInSeconds: aws.Int64(1),
- SizeInMBs: aws.Int64(1),
- },
- CloudWatchLoggingOptions: &firehose.CloudWatchLoggingOptions{
- Enabled: aws.Bool(true),
- LogGroupName: aws.String("LogGroupName"),
- LogStreamName: aws.String("LogStreamName"),
- },
- IndexRotationPeriod: aws.String("ElasticsearchIndexRotationPeriod"),
- RetryOptions: &firehose.ElasticsearchRetryOptions{
- DurationInSeconds: aws.Int64(1),
- },
- S3BackupMode: aws.String("ElasticsearchS3BackupMode"),
- },
- RedshiftDestinationConfiguration: &firehose.RedshiftDestinationConfiguration{
- ClusterJDBCURL: aws.String("ClusterJDBCURL"), // Required
- CopyCommand: &firehose.CopyCommand{ // Required
- DataTableName: aws.String("DataTableName"), // Required
- CopyOptions: aws.String("CopyOptions"),
- DataTableColumns: aws.String("DataTableColumns"),
- },
- Password: aws.String("Password"), // Required
- RoleARN: aws.String("RoleARN"), // Required
- S3Configuration: &firehose.S3DestinationConfiguration{ // Required
- BucketARN: aws.String("BucketARN"), // Required
- RoleARN: aws.String("RoleARN"), // Required
- BufferingHints: &firehose.BufferingHints{
- IntervalInSeconds: aws.Int64(1),
- SizeInMBs: aws.Int64(1),
- },
- CloudWatchLoggingOptions: &firehose.CloudWatchLoggingOptions{
- Enabled: aws.Bool(true),
- LogGroupName: aws.String("LogGroupName"),
- LogStreamName: aws.String("LogStreamName"),
- },
- CompressionFormat: aws.String("CompressionFormat"),
- EncryptionConfiguration: &firehose.EncryptionConfiguration{
- KMSEncryptionConfig: &firehose.KMSEncryptionConfig{
- AWSKMSKeyARN: aws.String("AWSKMSKeyARN"), // Required
- },
- NoEncryptionConfig: aws.String("NoEncryptionConfig"),
- },
- Prefix: aws.String("Prefix"),
- },
- Username: aws.String("Username"), // Required
- CloudWatchLoggingOptions: &firehose.CloudWatchLoggingOptions{
- Enabled: aws.Bool(true),
- LogGroupName: aws.String("LogGroupName"),
- LogStreamName: aws.String("LogStreamName"),
- },
- RetryOptions: &firehose.RedshiftRetryOptions{
- DurationInSeconds: aws.Int64(1),
- },
- },
- S3DestinationConfiguration: &firehose.S3DestinationConfiguration{
- BucketARN: aws.String("BucketARN"), // Required
- RoleARN: aws.String("RoleARN"), // Required
- BufferingHints: &firehose.BufferingHints{
- IntervalInSeconds: aws.Int64(1),
- SizeInMBs: aws.Int64(1),
- },
- CloudWatchLoggingOptions: &firehose.CloudWatchLoggingOptions{
- Enabled: aws.Bool(true),
- LogGroupName: aws.String("LogGroupName"),
- LogStreamName: aws.String("LogStreamName"),
- },
- CompressionFormat: aws.String("CompressionFormat"),
- EncryptionConfiguration: &firehose.EncryptionConfiguration{
- KMSEncryptionConfig: &firehose.KMSEncryptionConfig{
- AWSKMSKeyARN: aws.String("AWSKMSKeyARN"), // Required
- },
- NoEncryptionConfig: aws.String("NoEncryptionConfig"),
- },
- Prefix: aws.String("Prefix"),
- },
- }
- resp, err := svc.CreateDeliveryStream(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleFirehose_DeleteDeliveryStream() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := firehose.New(sess)
- params := &firehose.DeleteDeliveryStreamInput{
- DeliveryStreamName: aws.String("DeliveryStreamName"), // Required
- }
- resp, err := svc.DeleteDeliveryStream(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleFirehose_DescribeDeliveryStream() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := firehose.New(sess)
- params := &firehose.DescribeDeliveryStreamInput{
- DeliveryStreamName: aws.String("DeliveryStreamName"), // Required
- ExclusiveStartDestinationId: aws.String("DestinationId"),
- Limit: aws.Int64(1),
- }
- resp, err := svc.DescribeDeliveryStream(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleFirehose_ListDeliveryStreams() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := firehose.New(sess)
- params := &firehose.ListDeliveryStreamsInput{
- ExclusiveStartDeliveryStreamName: aws.String("DeliveryStreamName"),
- Limit: aws.Int64(1),
- }
- resp, err := svc.ListDeliveryStreams(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleFirehose_PutRecord() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := firehose.New(sess)
- params := &firehose.PutRecordInput{
- DeliveryStreamName: aws.String("DeliveryStreamName"), // Required
- Record: &firehose.Record{ // Required
- Data: []byte("PAYLOAD"), // Required
- },
- }
- resp, err := svc.PutRecord(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleFirehose_PutRecordBatch() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := firehose.New(sess)
- params := &firehose.PutRecordBatchInput{
- DeliveryStreamName: aws.String("DeliveryStreamName"), // Required
- Records: []*firehose.Record{ // Required
- { // Required
- Data: []byte("PAYLOAD"), // Required
- },
- // More values...
- },
- }
- resp, err := svc.PutRecordBatch(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleFirehose_UpdateDestination() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := firehose.New(sess)
- params := &firehose.UpdateDestinationInput{
- CurrentDeliveryStreamVersionId: aws.String("DeliveryStreamVersionId"), // Required
- DeliveryStreamName: aws.String("DeliveryStreamName"), // Required
- DestinationId: aws.String("DestinationId"), // Required
- ElasticsearchDestinationUpdate: &firehose.ElasticsearchDestinationUpdate{
- BufferingHints: &firehose.ElasticsearchBufferingHints{
- IntervalInSeconds: aws.Int64(1),
- SizeInMBs: aws.Int64(1),
- },
- CloudWatchLoggingOptions: &firehose.CloudWatchLoggingOptions{
- Enabled: aws.Bool(true),
- LogGroupName: aws.String("LogGroupName"),
- LogStreamName: aws.String("LogStreamName"),
- },
- DomainARN: aws.String("ElasticsearchDomainARN"),
- IndexName: aws.String("ElasticsearchIndexName"),
- IndexRotationPeriod: aws.String("ElasticsearchIndexRotationPeriod"),
- RetryOptions: &firehose.ElasticsearchRetryOptions{
- DurationInSeconds: aws.Int64(1),
- },
- RoleARN: aws.String("RoleARN"),
- S3Update: &firehose.S3DestinationUpdate{
- BucketARN: aws.String("BucketARN"),
- BufferingHints: &firehose.BufferingHints{
- IntervalInSeconds: aws.Int64(1),
- SizeInMBs: aws.Int64(1),
- },
- CloudWatchLoggingOptions: &firehose.CloudWatchLoggingOptions{
- Enabled: aws.Bool(true),
- LogGroupName: aws.String("LogGroupName"),
- LogStreamName: aws.String("LogStreamName"),
- },
- CompressionFormat: aws.String("CompressionFormat"),
- EncryptionConfiguration: &firehose.EncryptionConfiguration{
- KMSEncryptionConfig: &firehose.KMSEncryptionConfig{
- AWSKMSKeyARN: aws.String("AWSKMSKeyARN"), // Required
- },
- NoEncryptionConfig: aws.String("NoEncryptionConfig"),
- },
- Prefix: aws.String("Prefix"),
- RoleARN: aws.String("RoleARN"),
- },
- TypeName: aws.String("ElasticsearchTypeName"),
- },
- RedshiftDestinationUpdate: &firehose.RedshiftDestinationUpdate{
- CloudWatchLoggingOptions: &firehose.CloudWatchLoggingOptions{
- Enabled: aws.Bool(true),
- LogGroupName: aws.String("LogGroupName"),
- LogStreamName: aws.String("LogStreamName"),
- },
- ClusterJDBCURL: aws.String("ClusterJDBCURL"),
- CopyCommand: &firehose.CopyCommand{
- DataTableName: aws.String("DataTableName"), // Required
- CopyOptions: aws.String("CopyOptions"),
- DataTableColumns: aws.String("DataTableColumns"),
- },
- Password: aws.String("Password"),
- RetryOptions: &firehose.RedshiftRetryOptions{
- DurationInSeconds: aws.Int64(1),
- },
- RoleARN: aws.String("RoleARN"),
- S3Update: &firehose.S3DestinationUpdate{
- BucketARN: aws.String("BucketARN"),
- BufferingHints: &firehose.BufferingHints{
- IntervalInSeconds: aws.Int64(1),
- SizeInMBs: aws.Int64(1),
- },
- CloudWatchLoggingOptions: &firehose.CloudWatchLoggingOptions{
- Enabled: aws.Bool(true),
- LogGroupName: aws.String("LogGroupName"),
- LogStreamName: aws.String("LogStreamName"),
- },
- CompressionFormat: aws.String("CompressionFormat"),
- EncryptionConfiguration: &firehose.EncryptionConfiguration{
- KMSEncryptionConfig: &firehose.KMSEncryptionConfig{
- AWSKMSKeyARN: aws.String("AWSKMSKeyARN"), // Required
- },
- NoEncryptionConfig: aws.String("NoEncryptionConfig"),
- },
- Prefix: aws.String("Prefix"),
- RoleARN: aws.String("RoleARN"),
- },
- Username: aws.String("Username"),
- },
- S3DestinationUpdate: &firehose.S3DestinationUpdate{
- BucketARN: aws.String("BucketARN"),
- BufferingHints: &firehose.BufferingHints{
- IntervalInSeconds: aws.Int64(1),
- SizeInMBs: aws.Int64(1),
- },
- CloudWatchLoggingOptions: &firehose.CloudWatchLoggingOptions{
- Enabled: aws.Bool(true),
- LogGroupName: aws.String("LogGroupName"),
- LogStreamName: aws.String("LogStreamName"),
- },
- CompressionFormat: aws.String("CompressionFormat"),
- EncryptionConfiguration: &firehose.EncryptionConfiguration{
- KMSEncryptionConfig: &firehose.KMSEncryptionConfig{
- AWSKMSKeyARN: aws.String("AWSKMSKeyARN"), // Required
- },
- NoEncryptionConfig: aws.String("NoEncryptionConfig"),
- },
- Prefix: aws.String("Prefix"),
- RoleARN: aws.String("RoleARN"),
- },
- }
- resp, err := svc.UpdateDestination(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
|