1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00
fog--fog-aws/lib/fog/aws/requests/kinesis/delete_stream.rb
Michael Hale 0a8e3575a3 Cleanup
2015-07-02 12:02:39 -04:00

46 lines
1.3 KiB
Ruby

module Fog
module AWS
class Kinesis
class Real
# Deletes a stream and all its shards and data.
#
# ==== Options
# * StreamName<~String>: A name to identify the stream.
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# https://docs.aws.amazon.com/kinesis/latest/APIReference/API_DeleteStream.html
#
def delete_stream(options={})
body = {
"StreamName" => options.delete("StreamName")
}.reject{ |_,v| v.nil? }
response = request({
'X-Amz-Target' => "Kinesis_#{@version}.DeleteStream",
:body => body,
}.merge(options))
response
end
end
class Mock
def delete_stream(options={})
stream_name = options.delete("StreamName")
unless stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
raise 'unknown stream'
end
data[:kinesis_streams].delete(stream)
response = Excon::Response.new
response.status = 200
response.body = ""
response
end
end
end
end
end