File: list_streams.rb

package info (click to toggle)
ruby-fog-aws 3.3.0-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,816 kB
  • sloc: ruby: 68,587; makefile: 6
file content (40 lines) | stat: -rw-r--r-- 1,276 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
module Fog
  module AWS
    class Kinesis
      class Real
        # List availabe streams
        #
        # ==== Options
        # * ExclusiveStartStreamName<~String>: The name of the stream to start the list with.
        # * Limit<~Number>: The maximum number of streams to list.
        # ==== Returns
        # * response<~Excon::Response>:
        #
        # ==== See Also
        # https://docs.aws.amazon.com/kinesis/latest/APIReference/API_ListStreams.html
        #
        def list_streams(options={})
          response = request({
                               :idempotent    => true,
                               'X-Amz-Target' => "Kinesis_#{@version}.ListStreams",
                               :body          => {},
                             }.merge(options))
          response.body = Fog::JSON.decode(response.body) unless response.body.nil?
          response
        end
      end

      class Mock
        def list_streams(options={})
          response = Excon::Response.new
          response.status = 200
          response.body =           {
            "HasMoreStreams" => false,
            "StreamNames" => data[:kinesis_streams].map{ |stream| stream["StreamName"] }
          }
          response
        end
      end
    end
  end
end