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

47 lines
1.3 KiB
Ruby
Raw Normal View History

2015-06-19 16:55:32 -04:00
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({
2015-06-24 17:10:55 -04:00
'X-Amz-Target' => "Kinesis_#{@version}.DeleteStream",
2015-06-19 16:55:32 -04:00
:body => body,
}.merge(options))
response
end
end
class Mock
2015-06-30 18:15:14 -04:00
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
2015-06-19 16:55:32 -04:00
end
end
end
end
end