Completed
Push — master ( bae8a7...4dfc70 )
by Ken’ichiro
13s
created

Firehose.initialize()   A

Complexity

Conditions 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
c 2
b 0
f 0
dl 0
loc 4
rs 10
1
module Awspec::Type
2
  class Firehose < ResourceBase
3
    def initialize(name)
4
      super
5
      @delivery_stream_name = name
6
    end
7
8
    def resource_via_client
9
      @resource_via_client ||= find_delivery_stream(@delivery_stream_name)
10
    end
11
12
    def id
13
      @id ||= @delivery_stream_name if resource_via_client
14
    end
15
16
    STATES = %w(ACTIVE CREATING DELETING)
17
18
    STATES.each do |state|
19
      define_method state.downcase + '?' do
20
        resource_via_client.delivery_stream_status == state
21
      end
22
    end
23
24
    # TODO: Add one per destination type
25
    def has_splunk_destination?
26
      resource_via_client.destinations[0] &&
27
        resource_via_client.destinations[0].splunk_destination_description
28
    end
29
  end
30
end
31