@@ -2,7 +2,6 @@ package kinesis
22
33import (
44 "log"
5- "os"
65 "time"
76
87 "github.com/aws/aws-sdk-go/aws"
@@ -115,17 +114,11 @@ func (k *KinesisOutput) Description() string {
115114 return "Configuration for the AWS Kinesis output."
116115}
117116
118- func checkstream (l []* string , s string ) bool {
119- // Check if the StreamName exists in the slice returned from the ListStreams API request.
120- for _ , stream := range l {
121- if * stream == s {
122- return true
123- }
117+ func (k * KinesisOutput ) Connect () error {
118+ if k .Partition == nil {
119+ log .Print ("E! kinesis : Deprecated paritionkey configuration in use, please consider using outputs.kinesis.partition" )
124120 }
125- return false
126- }
127121
128- func (k * KinesisOutput ) Connect () error {
129122 // We attempt first to create a session to Kinesis using an IAMS role, if that fails it will fall through to using
130123 // environment variables, and then Shared Credentials.
131124 if k .Debug {
@@ -145,29 +138,10 @@ func (k *KinesisOutput) Connect() error {
145138 configProvider := credentialConfig .Credentials ()
146139 svc := kinesis .New (configProvider )
147140
148- KinesisParams := & kinesis.ListStreamsInput {
149- Limit : aws .Int64 (100 ),
150- }
151-
152- resp , err := svc .ListStreams (KinesisParams )
153-
154- if err != nil {
155- log .Printf ("E! kinesis: Error in ListSteams API call : %+v \n " , err )
156- }
157-
158- if checkstream (resp .StreamNames , k .StreamName ) {
159- if k .Debug {
160- log .Printf ("E! kinesis: Stream Exists" )
161- }
162- k .svc = svc
163- return nil
164- } else {
165- log .Printf ("E! kinesis : You have configured a StreamName %+v which does not exist. exiting." , k .StreamName )
166- os .Exit (1 )
167- }
168- if k .Partition == nil {
169- log .Print ("E! kinesis : Deprecated paritionkey configuration in use, please consider using outputs.kinesis.partition" )
170- }
141+ _ , err := svc .DescribeStreamSummary (& kinesis.DescribeStreamSummaryInput {
142+ StreamName : aws .String (k .StreamName ),
143+ })
144+ k .svc = svc
171145 return err
172146}
173147
0 commit comments