Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Chris Marchesi
committed
Sep 18, 2015
1 parent
bd3f27f
commit ce01eab
Showing
5 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require File.join(File.dirname(__FILE__), 'ec2') | ||
|
||
module Opscode | ||
module Aws | ||
module Kinesis | ||
include Opscode::Aws::Ec2 | ||
|
||
def kinesis | ||
@kinesis ||= create_aws_interface(::Aws::Kinesis::Client) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
include Opscode::Aws::Kinesis | ||
|
||
def whyrun_supported? | ||
true | ||
end | ||
|
||
# does_stream_exist - logic for checking if the stream exists | ||
def stream_exists? | ||
resp = kinesis.describe_stream(stream_name: new_resource.stream_name) | ||
if resp.length > 0 | ||
true | ||
else | ||
false | ||
end | ||
rescue ::Aws::Kinesis::Errors::ResourceNotFoundException | ||
false | ||
end | ||
|
||
action :create do | ||
unless stream_exists? | ||
converge_by("create Kinesis stream #{new_resource.stream_name}") do | ||
kinesis.create_stream( | ||
stream_name: new_resource.stream_name, | ||
shard_count: new_resource.starting_shard_count | ||
) | ||
end | ||
end | ||
end | ||
|
||
action :delete do | ||
if stream_exists? | ||
converge_by("delete Kinesis stream #{new_resource.stream_name}") do | ||
kinesis.delete_stream(stream_name: new_resource.stream_name) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
default_action :create | ||
actions :create, :delete | ||
|
||
attribute :stream_name, kind_of: String, name_attribute: true | ||
attribute :starting_shard_count, kind_of: Integer, required: true | ||
# AWS common attributes | ||
attribute :region, kind_of: String, default: nil | ||
attribute :aws_access_key, kind_of: String, default: nil | ||
attribute :aws_secret_access_key, kind_of: String, default: nil | ||
attribute :aws_session_token, kind_of: String, default: nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
aws_kinesis_stream 'kitchen-test-stream' do | ||
action :create | ||
starting_shard_count 2 | ||
end |