Completed
Pull Request — master (#372)
by
unknown
03:39
created

Firehose   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
dl 0
loc 32
rs 10
c 3
b 0
f 0
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A id() 0 3 2
A resource_via_client() 0 3 1
A initialize() 0 4 1
A has_source_type? 0 3 1
A has_splunk_destination? 0 4 1
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
    def has_source_type?(type)
25
      resource_via_client.delivery_stream_type == type
26
    end
27
28
    # TODO: Add one per destination type
29
    def has_splunk_destination?
30
      resource_via_client.destinations[0] &&
31
        resource_via_client.destinations[0].splunk_destination_description
32
    end
33
  end
34
end
35