Class: Fog::AWS::AutoScaling::Group
- Inherits:
-
Model
- Object
- Model
- Fog::AWS::AutoScaling::Group
- Defined in:
- lib/fog/aws/models/auto_scaling/group.rb
Instance Method Summary collapse
- #activities ⇒ Object
- #configuration ⇒ Object
-
#destroy(options = { :force => false }) ⇒ Object
def reload super self end.
- #disable_metrics_collection(metrics = {}) ⇒ Object
- #enable_metrics_collection(granularity = '1Minute', metrics = {}) ⇒ Object
- #filtered_options(method) ⇒ Object
-
#initialize(attributes = {}) ⇒ Group
constructor
A new instance of Group.
- #instances ⇒ Object
- #instances_in_service ⇒ Object
- #instances_out_service ⇒ Object
- #options ⇒ Object
- #ready? ⇒ Boolean
- #resume_processes(processes = []) ⇒ Object
- #save ⇒ Object
- #suspend_processes(processes = []) ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Group
Returns a new instance of Group.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/fog/aws/models/auto_scaling/group.rb', line 27 def initialize(attributes={}) self.instances = [] self.default_cooldown = 300 self.desired_capacity = 0 self.enabled_metrics = [] self.health_check_grace_period = 0 self.health_check_type = 'EC2' self.load_balancer_names = [] self.max_size = 0 self.min_size = 0 self.suspended_processes = [] self. = {} self.termination_policies = ['Default'] super end |
Instance Method Details
#activities ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/fog/aws/models/auto_scaling/group.rb', line 43 def activities requires :id data = [] next_token = nil loop do result = service.describe_scaling_activities('AutoScalingGroupName' => id, 'NextToken' => next_token).body['DescribeScalingActivitiesResult'] data += result['Activities'] next_token = result['NextToken'] break if next_token.nil? end Fog::AWS::AutoScaling::Activities.new({ :data => data, :service => service, #:load_balancer => self }) end |
#configuration ⇒ Object
60 61 62 63 |
# File 'lib/fog/aws/models/auto_scaling/group.rb', line 60 def configuration requires :launch_configuration_name service.configurations.get(launch_configuration_name) end |
#destroy(options = { :force => false }) ⇒ Object
def reload
super
self
end
123 124 125 126 127 128 129 130 |
# File 'lib/fog/aws/models/auto_scaling/group.rb', line 123 def destroy( = { :force => false }) requires :id opts = {} opts.merge!({'ForceDelete' => true}) if [:force] service.delete_auto_scaling_group(id, opts) end |
#disable_metrics_collection(metrics = {}) ⇒ Object
65 66 67 68 69 |
# File 'lib/fog/aws/models/auto_scaling/group.rb', line 65 def disable_metrics_collection(metrics = {}) requires :id service.disable_metrics_collection(id, 'Metrics' => metrics) reload end |
#enable_metrics_collection(granularity = '1Minute', metrics = {}) ⇒ Object
71 72 73 74 75 |
# File 'lib/fog/aws/models/auto_scaling/group.rb', line 71 def enable_metrics_collection(granularity = '1Minute', metrics = {}) requires :id service.enable_metrics_collection(id, granularity, 'Metrics' => metrics) reload end |
#filtered_options(method) ⇒ Object
138 139 140 |
# File 'lib/fog/aws/models/auto_scaling/group.rb', line 138 def (method) Hash[.select{|k,_| ExpectedOptions[method].include?(k)}] end |
#instances ⇒ Object
77 78 79 |
# File 'lib/fog/aws/models/auto_scaling/group.rb', line 77 def instances Fog::AWS::AutoScaling::Instances.new(:service => service).load(attributes[:instances]) end |
#instances_in_service ⇒ Object
81 82 83 |
# File 'lib/fog/aws/models/auto_scaling/group.rb', line 81 def instances_in_service attributes[:instances].select {|hash| hash['LifecycleState'] == 'InService'}.map {|hash| hash['InstanceId']} end |
#instances_out_service ⇒ Object
85 86 87 |
# File 'lib/fog/aws/models/auto_scaling/group.rb', line 85 def instances_out_service attributes[:instances].select {|hash| hash['LifecycleState'] == 'OutOfService'}.map {|hash| hash['InstanceId']} end |
#options ⇒ Object
142 143 144 145 146 |
# File 'lib/fog/aws/models/auto_scaling/group.rb', line 142 def ret = Hash[self.class.aliases.map { |key, value| [key, send(value)] }] ret.delete_if { |key, value| value.nil? } ret end |
#ready? ⇒ Boolean
101 102 103 104 105 106 |
# File 'lib/fog/aws/models/auto_scaling/group.rb', line 101 def ready? # Is this useful? #instances_in_service.length == desired_capacity #instances_in_service.length >= min_size true end |
#resume_processes(processes = []) ⇒ Object
89 90 91 92 93 |
# File 'lib/fog/aws/models/auto_scaling/group.rb', line 89 def resume_processes(processes = []) requires :id service.resume_processes(id, 'ScalingProcesses' => processes) reload end |
#save ⇒ Object
108 109 110 111 112 113 114 115 116 |
# File 'lib/fog/aws/models/auto_scaling/group.rb', line 108 def save requires :id requires :availability_zones requires :launch_configuration_name requires :max_size requires :min_size service.create_auto_scaling_group(id, availability_zones, launch_configuration_name, max_size, min_size, (:create_auto_scaling_group)) reload end |
#suspend_processes(processes = []) ⇒ Object
95 96 97 98 99 |
# File 'lib/fog/aws/models/auto_scaling/group.rb', line 95 def suspend_processes(processes = []) requires :id service.suspend_processes(id, 'ScalingProcesses' => processes) reload end |
#update ⇒ Object
132 133 134 135 136 |
# File 'lib/fog/aws/models/auto_scaling/group.rb', line 132 def update requires :id service.update_auto_scaling_group(id, (:update_auto_scaling_group) ) reload end |