Module: Jets::Stack::Main::Dsl::Cloudwatch

Defined in:
lib/jets/stack/main/dsl/cloudwatch.rb

Instance Method Summary collapse

Instance Method Details

#cloudwatch_alarm(id, hash = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/jets/stack/main/dsl/cloudwatch.rb', line 3

def cloudwatch_alarm(id, hash={})
  if hash.key?(:depends_on)
    attributes = hash # leave structure alone and add type only
    attributes[:type] = "AWS::CloudWatch::Alarm"
  else
    # the attributes are properties
    properties = hash
    attributes = {
      type: "AWS::CloudWatch::Alarm",
      properties: properties,
    }
  end
  resource(id, attributes)
  output(id)
end