Shorten the CreateStream function name

This commit is contained in:
Harlow Ward 2014-12-20 18:55:13 -08:00
parent 05920cc5d3
commit 3d290c4512

View file

@ -89,9 +89,9 @@ func LoadConfig(config interface{}, filename string) error {
return nil return nil
} }
// CreateAndWaitForStreamToBecomeAvailable creates a new Kinesis stream (uses // CreateStream creates a new Kinesis stream (uses existing stream if exists) and
// existing stream if exists) and waits for it to become available. // waits for it to become available.
func CreateAndWaitForStreamToBecomeAvailable(k *kinesis.Kinesis, streamName string, shardCount int) { func CreateStream(k *kinesis.Kinesis, streamName string, shardCount int) {
if !StreamExists(k, streamName) { if !StreamExists(k, streamName) {
err := k.CreateStream(streamName, shardCount) err := k.CreateStream(streamName, shardCount)
@ -123,7 +123,11 @@ func CreateAndWaitForStreamToBecomeAvailable(k *kinesis.Kinesis, streamName stri
// StreamExists checks if a Kinesis stream exists. // StreamExists checks if a Kinesis stream exists.
func StreamExists(k *kinesis.Kinesis, streamName string) bool { func StreamExists(k *kinesis.Kinesis, streamName string) bool {
args := kinesis.NewArgs() args := kinesis.NewArgs()
resp, _ := k.ListStreams(args) resp, err := k.ListStreams(args)
if err != nil {
fmt.Printf("ListStream ERROR: %v\n", err)
return false
}
for _, s := range resp.StreamNames { for _, s := range resp.StreamNames {
if s == streamName { if s == streamName {
return true return true