Class: Cumulus::AutoScaling::PolicyDiff
- Inherits:
-
Common::Diff
- Object
- Common::Diff
- Cumulus::AutoScaling::PolicyDiff
- Includes:
- PolicyChange
- Defined in:
- lib/autoscaling/models/PolicyDiff.rb
Overview
Public: Represents a single difference between local configuration and AWS configuration of scaling policies
Constant Summary
Constants included from PolicyChange
Cumulus::AutoScaling::PolicyChange::ADJUSTMENT, Cumulus::AutoScaling::PolicyChange::ADJUSTMENT_TYPE, Cumulus::AutoScaling::PolicyChange::ALARM, Cumulus::AutoScaling::PolicyChange::COOLDOWN, Cumulus::AutoScaling::PolicyChange::MIN_ADJUSTMENT
Constants included from Common::DiffChange
Common::DiffChange::ADD, Common::DiffChange::MODIFIED, Common::DiffChange::UNMANAGED
Instance Attribute Summary collapse
-
#alarm_diffs ⇒ Object
Returns the value of attribute alarm_diffs.
-
#policy_arn ⇒ Object
Returns the value of attribute policy_arn.
Attributes inherited from Common::Diff
#aws, #changes, #info_only, #local, #type
Class Method Summary collapse
-
.alarms(alarm_diffs, local, policy_arn) ⇒ Object
Public: Static method that will produce a diff that contains changes in cloudwatch alarms.
Instance Method Summary collapse
Methods included from Common::DiffChange
Methods inherited from Common::Diff
#add_string, added, #initialize, #local_name, modified, #to_s, unmanaged, #unmanaged_string
Constructor Details
This class inherits a constructor from Cumulus::Common::Diff
Instance Attribute Details
#alarm_diffs ⇒ Object
Returns the value of attribute alarm_diffs.
22 23 24 |
# File 'lib/autoscaling/models/PolicyDiff.rb', line 22 def alarm_diffs @alarm_diffs end |
#policy_arn ⇒ Object
Returns the value of attribute policy_arn.
23 24 25 |
# File 'lib/autoscaling/models/PolicyDiff.rb', line 23 def policy_arn @policy_arn end |
Class Method Details
.alarms(alarm_diffs, local, policy_arn) ⇒ Object
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
33 34 35 36 37 38 |
# 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 |
Instance Method Details
#asset_type ⇒ Object
63 64 65 |
# File 'lib/autoscaling/models/PolicyDiff.rb', line 63 def asset_type "Scaling policy" end |
#aws_name ⇒ Object
67 68 69 |
# File 'lib/autoscaling/models/PolicyDiff.rb', line 67 def aws_name @aws.policy_name end |
#diff_string ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# 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 |