Class: Convection::Model::Template::Resource::CloudWatchAlarm

Inherits:
Convection::Model::Template::Resource show all
Defined in:
lib/convection/model/template/resource/aws_cloud_watch_alarm.rb

Overview

AWS::CloudWatch::Alarm

Instance Attribute Summary

Attributes inherited from Convection::Model::Template::Resource

#exist, #name, #parent, #properties, #resource_attributes, #template

Instance Method Summary collapse

Methods inherited from Convection::Model::Template::Resource

#as_attribute, attach_method, #deletion_policy, #depends_on, #initialize, properties, property, #property, #reference, #render, type, #type, #with_output

Methods included from Mixin::Conditional

#condition, #render_condition

Methods included from DSL::Template::Resource

#_terraform_module_dir_to_flag, #_terraform_module_flag_to_dir, attach_resource, attach_resource_collection, resource_collection_dsl_methods, resource_dsl_methods

Methods included from DSL::Helpers

#camel_case, included, method_name, #screaming_snake_case, #snake_case

Methods included from DSL::IntrinsicFunctions

#base64, #find_in_map, #fn_and, #fn_equals, #fn_if, #fn_import_value, #fn_not, #fn_or, #fn_ref, #fn_sub, #get_att, #get_azs, included, #join, mixers, #select

Constructor Details

This class inherits a constructor from Convection::Model::Template::Resource

Instance Method Details

#actions_enabledObject #actions_enabled(value) ⇒ Object

Overloads:

  • #actions_enabledObject

    Returns the value of the ‘ActionsEnabled’ CloudFormation property.

  • #actions_enabled(value) ⇒ Object

    Sets the ‘ActionsEnabled’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘ActionsEnabled’ CloudFormation property to.



12
# File 'lib/convection/model/template/resource/aws_cloud_watch_alarm.rb', line 12

property :actions_enabled, 'ActionsEnabled', :default => true

#alarm_actionObject #alarm_action(value) ⇒ Object

Overloads:

  • #alarm_actionObject

    Returns the value of the ‘AlarmActions’ CloudFormation property.

  • #alarm_action(value) ⇒ Object

    Sets the ‘AlarmActions’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘AlarmActions’ CloudFormation property to.



13
# File 'lib/convection/model/template/resource/aws_cloud_watch_alarm.rb', line 13

property :alarm_action, 'AlarmActions', :type => :list

#alarm_descriptionObject #alarm_description(value) ⇒ Object

Overloads:

  • #alarm_descriptionObject

    Returns the value of the ‘AlarmDescription’ CloudFormation property.

  • #alarm_description(value) ⇒ Object

    Sets the ‘AlarmDescription’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘AlarmDescription’ CloudFormation property to.



14
# File 'lib/convection/model/template/resource/aws_cloud_watch_alarm.rb', line 14

property :alarm_description, 'AlarmDescription'

#alarm_nameObject #alarm_name(value) ⇒ Object

Overloads:

  • #alarm_nameObject

    Returns the value of the ‘AlarmName’ CloudFormation property.

  • #alarm_name(value) ⇒ Object

    Sets the ‘AlarmName’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘AlarmName’ CloudFormation property to.



15
# File 'lib/convection/model/template/resource/aws_cloud_watch_alarm.rb', line 15

property :alarm_name, 'AlarmName'

#comparison_operatorObject #comparison_operator(value) ⇒ Object

Overloads:

  • #comparison_operatorObject

    Returns the value of the ‘ComparisonOperator’ CloudFormation property.

  • #comparison_operator(value) ⇒ Object

    Sets the ‘ComparisonOperator’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘ComparisonOperator’ CloudFormation property to.



16
# File 'lib/convection/model/template/resource/aws_cloud_watch_alarm.rb', line 16

property :comparison_operator, 'ComparisonOperator'

#dimensionObject #dimension(value) ⇒ Object

Overloads:

  • #dimensionObject

    Returns the value of the ‘Dimensions’ CloudFormation property.

  • #dimension(value) ⇒ Object

    Sets the ‘Dimensions’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘Dimensions’ CloudFormation property to.



17
# File 'lib/convection/model/template/resource/aws_cloud_watch_alarm.rb', line 17

property :dimension, 'Dimensions', :type => :list

#evaluation_periodsObject #evaluation_periods(value) ⇒ Object

Overloads:

  • #evaluation_periodsObject

    Returns the value of the ‘EvaluationPeriods’ CloudFormation property.

  • #evaluation_periods(value) ⇒ Object

    Sets the ‘EvaluationPeriods’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘EvaluationPeriods’ CloudFormation property to.



18
# File 'lib/convection/model/template/resource/aws_cloud_watch_alarm.rb', line 18

property :evaluation_periods, 'EvaluationPeriods'

#insufficient_data_actionObject #insufficient_data_action(value) ⇒ Object

Overloads:

  • #insufficient_data_actionObject

    Returns the value of the ‘InsufficientDataActions’ CloudFormation property.

  • #insufficient_data_action(value) ⇒ Object

    Sets the ‘InsufficientDataActions’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘InsufficientDataActions’ CloudFormation property to.



19
# File 'lib/convection/model/template/resource/aws_cloud_watch_alarm.rb', line 19

property :insufficient_data_action, 'InsufficientDataActions', :type => :list

#metric_nameObject #metric_name(value) ⇒ Object

Overloads:

  • #metric_nameObject

    Returns the value of the ‘MetricName’ CloudFormation property.

  • #metric_name(value) ⇒ Object

    Sets the ‘MetricName’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘MetricName’ CloudFormation property to.



20
# File 'lib/convection/model/template/resource/aws_cloud_watch_alarm.rb', line 20

property :metric_name, 'MetricName'

#namespaceObject #namespace(value) ⇒ Object

Overloads:

  • #namespaceObject

    Returns the value of the ‘Namespace’ CloudFormation property.

  • #namespace(value) ⇒ Object

    Sets the ‘Namespace’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘Namespace’ CloudFormation property to.



21
# File 'lib/convection/model/template/resource/aws_cloud_watch_alarm.rb', line 21

property :namespace, 'Namespace'

#ok_actionObject #ok_action(value) ⇒ Object

Overloads:

  • #ok_actionObject

    Returns the value of the ‘OKActions’ CloudFormation property.

  • #ok_action(value) ⇒ Object

    Sets the ‘OKActions’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘OKActions’ CloudFormation property to.



22
# File 'lib/convection/model/template/resource/aws_cloud_watch_alarm.rb', line 22

property :ok_action, 'OKActions', :type => :list

#periodObject #period(value) ⇒ Object

Overloads:

  • #periodObject

    Returns the value of the ‘Period’ CloudFormation property.

  • #period(value) ⇒ Object

    Sets the ‘Period’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘Period’ CloudFormation property to.



23
# File 'lib/convection/model/template/resource/aws_cloud_watch_alarm.rb', line 23

property :period, 'Period'

#statisticObject #statistic(value) ⇒ Object

Overloads:

  • #statisticObject

    Returns the value of the ‘Statistic’ CloudFormation property.

  • #statistic(value) ⇒ Object

    Sets the ‘Statistic’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘Statistic’ CloudFormation property to.



24
# File 'lib/convection/model/template/resource/aws_cloud_watch_alarm.rb', line 24

property :statistic, 'Statistic'

#terraform_import_commands(module_path: 'root') ⇒ Object



28
29
30
31
32
33
34
# File 'lib/convection/model/template/resource/aws_cloud_watch_alarm.rb', line 28

def terraform_import_commands(module_path: 'root')
  prefix = "#{module_path}." unless module_path == 'root'
  commands = ['# Run the following commands to import your infrastructure into terraform management.', '# ensure :module_path is set correctly', '']
  commands << "terraform import #{prefix}aws_cloudwatch_metric_alarm.#{name.underscore} #{stack.resources[name].physical_resource_id}"
  commands << ''
  commands
end

#thresholdObject #threshold(value) ⇒ Object

Overloads:

  • #thresholdObject

    Returns the value of the ‘Threshold’ CloudFormation property.

  • #threshold(value) ⇒ Object

    Sets the ‘Threshold’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘Threshold’ CloudFormation property to.



25
# File 'lib/convection/model/template/resource/aws_cloud_watch_alarm.rb', line 25

property :threshold, 'Threshold'

#to_hcl_jsonObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/convection/model/template/resource/aws_cloud_watch_alarm.rb', line 36

def to_hcl_json(*)
  tf_alarm_attrs = {
    alarm_name: alarm_name,
    comparison_operator: comparison_operator,
    evaluation_periods: evaluation_periods,
    metric_name: metric_name,
    namespace: namespace,
    period: period,
    statistic: statistic,
    threshold: threshold,
    actions_enabled: actions_enabled,
    alarm_actions: alarm_action,
    alarm_description: alarm_description,
    dimensions: dimension,
    insufficient_data_actions: insufficient_data_action,
    ok_actions: ok_action,
    unit: unit
  }

  tf_alarm_attrs.reject! { |_, v| v.nil? }

  tf_alarm = {
    aws_cloudwatch_metric_alarm: {
      name.underscore => tf_alarm_attrs
    }
  }

  { resource: [tf_alarm] }.to_json
end

#unitObject #unit(value) ⇒ Object

Overloads:

  • #unitObject

    Returns the value of the ‘Unit’ CloudFormation property.

  • #unit(value) ⇒ Object

    Sets the ‘Unit’ CloudFormation property.

    Parameters:

    • value

      the value to set the ‘Unit’ CloudFormation property to.



26
# File 'lib/convection/model/template/resource/aws_cloud_watch_alarm.rb', line 26

property :unit, 'Unit'