class Cumulus::AutoScaling::PolicyDiff
Public: Represents a single difference between local configuration and AWS configuration of scaling policies
Attributes
alarm_diffs[RW]
policy_arn[RW]
Public Class Methods
alarms(alarm_diffs, local, policy_arn)
click to toggle source
Public: Static method that will produce a diff that contains changes in cloudwatch alarms
alarm_diffs
- the differences in alarms local - the local configuration for the change policy_arn
- the arn of the policy the alarms should be associated with
Returns the diff
# File lib/autoscaling/models/PolicyDiff.rb, line 33 def self.alarms(alarm_diffs, local, policy_arn) diff = PolicyDiff.new(ALARM, nil, local) diff.alarm_diffs = alarm_diffs diff.policy_arn = policy_arn diff end
Public Instance Methods
asset_type()
click to toggle source
# File lib/autoscaling/models/PolicyDiff.rb, line 63 def asset_type "Scaling policy" end
aws_name()
click to toggle source
# File lib/autoscaling/models/PolicyDiff.rb, line 67 def aws_name @aws.policy_name end
diff_string()
click to toggle source
# File lib/autoscaling/models/PolicyDiff.rb, line 40 def diff_string diff_lines = [@local.name] case @type when ADJUSTMENT_TYPE diff_lines << "\tAdjustment type: AWS - #{Colors.aws_changes(@aws.adjustment_type)}, Local - #{Colors.local_changes(@local.adjustment_type)}" when ADJUSTMENT diff_lines << "\tScaling adjustment: AWS - #{Colors.aws_changes(@aws.scaling_adjustment)}, Local - #{Colors.local_changes(@local.adjustment)}" when ALARM lines = ["\t\tCloudwatch alarms:"] lines << alarm_diffs.map do |diff| diff.to_s.lines.map {|s| "\t\t\t#{s}" }.join end diff_lines << lines.flatten.join("\n") when COOLDOWN diff_lines << "\tCooldown: AWS - #{Colors.aws_changes(@aws.cooldown)}, Local - #{Colors.local_changes(@local.cooldown)}" when MIN_ADJUSTMENT diff_lines << "\tMin adjustment step: AWS - #{Colors.aws_changes(@aws.min_adjustment_step)}, Local - #{Colors.local_changes(@local.min_adjustment)}" end diff_lines.flatten.join("\n") end