Class: OpenStax::Aws::Alarm
- Inherits:
-
Object
- Object
- OpenStax::Aws::Alarm
- Defined in:
- lib/openstax/aws/alarm.rb
Instance Attribute Summary collapse
-
#raw_alarm ⇒ Object
readonly
Returns the value of attribute raw_alarm.
Class Method Summary collapse
Instance Method Summary collapse
- #add_tags_not_handled_by_cloudformation(stack_tags) ⇒ Object
-
#initialize(region:, name:) ⇒ Alarm
constructor
A new instance of Alarm.
- #logger ⇒ Object
- #tag_resource(new_tags) ⇒ Object
- #tags ⇒ Object
Constructor Details
Instance Attribute Details
#raw_alarm ⇒ Object (readonly)
Returns the value of attribute raw_alarm.
3 4 5 |
# File 'lib/openstax/aws/alarm.rb', line 3 def raw_alarm @raw_alarm end |
Class Method Details
.physical_resource_id_attribute ⇒ Object
7 8 9 |
# File 'lib/openstax/aws/alarm.rb', line 7 def self.physical_resource_id_attribute :name end |
Instance Method Details
#add_tags_not_handled_by_cloudformation(stack_tags) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/openstax/aws/alarm.rb', line 30 def () = .map(&:to_h) - .map(&:to_h) return if .empty? logger.debug "Tagging #{name}..." attempt = 1 begin tag_resource rescue Aws::CloudWatch::Errors::Throttling retry_in = attempt**2 logger.debug "Tagging #{name} failed... retrying in #{retry_in} seconds" sleep retry_in attempt += 1 retry end end |
#logger ⇒ Object
26 27 28 |
# File 'lib/openstax/aws/alarm.rb', line 26 def logger OpenStax::Aws.configuration.logger end |
#tag_resource(new_tags) ⇒ Object
22 23 24 |
# File 'lib/openstax/aws/alarm.rb', line 22 def tag_resource() client.tag_resource resource_arn: raw_alarm.alarm_arn, tags: end |
#tags ⇒ Object
18 19 20 |
# File 'lib/openstax/aws/alarm.rb', line 18 def client.(resource_arn: raw_alarm.alarm_arn). end |