Module: Tapjoy::AutoscalingBootstrap::AWS::Autoscaling::Group
- Defined in:
- lib/tapjoy/autoscaling_bootstrap/AWS/Autoscaling/group.rb
Overview
This module includes autoscaling group calls to AWS
Class Method Summary collapse
- .attach_elb(elb_list) ⇒ Object
- .client ⇒ Object
- .create(zones:, health_check_type: nil, tags:, vpc_subnets: nil, termination_policies:, **unused_values) ⇒ Object
- .delete(force_delete: true) ⇒ Object
- .describe ⇒ Object
- .detach ⇒ Object
- .resize(min: 0, max: 0, desired: 0) ⇒ Object
Class Method Details
.attach_elb(elb_list) ⇒ Object
56 57 58 59 60 61 |
# File 'lib/tapjoy/autoscaling_bootstrap/AWS/Autoscaling/group.rb', line 56 def attach_elb(elb_list) self.client.attach_load_balancers({ auto_scaling_group_name: Tapjoy::AutoscalingBootstrap.scaler_name, load_balancer_names: elb_list.split(','), }) end |
.client ⇒ Object
8 9 10 |
# File 'lib/tapjoy/autoscaling_bootstrap/AWS/Autoscaling/group.rb', line 8 def client @client ||= Tapjoy::AutoscalingBootstrap::AWS::Autoscaling.client end |
.create(zones:, health_check_type: nil, tags:, vpc_subnets: nil, termination_policies:, **unused_values) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/tapjoy/autoscaling_bootstrap/AWS/Autoscaling/group.rb', line 40 def create(zones:, health_check_type: nil, tags:, vpc_subnets: nil, termination_policies: , **unused_values) group_hash = { auto_scaling_group_name: Tapjoy::AutoscalingBootstrap.scaler_name, availability_zones: zones, launch_configuration_name: Tapjoy::AutoscalingBootstrap.config_name, min_size: 0, max_size: 0, desired_capacity: 0, termination_policies: termination_policies, vpc_zone_identifier: vpc_subnets, tags: Tapjoy::AutoscalingBootstrap::Autoscaling::Group.new.() } self.client.create_auto_scaling_group(**group_hash) end |
.delete(force_delete: true) ⇒ Object
18 19 20 21 22 |
# File 'lib/tapjoy/autoscaling_bootstrap/AWS/Autoscaling/group.rb', line 18 def delete(force_delete: true) self.client.delete_auto_scaling_group( auto_scaling_group_name: Tapjoy::AutoscalingBootstrap.scaler_name, force_delete: force_delete) end |
.describe ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/tapjoy/autoscaling_bootstrap/AWS/Autoscaling/group.rb', line 24 def describe self.client.describe_auto_scaling_groups( auto_scaling_group_names: [ Tapjoy::AutoscalingBootstrap.scaler_name ] )[0][0] end |
.detach ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/tapjoy/autoscaling_bootstrap/AWS/Autoscaling/group.rb', line 32 def detach self.client.detach_instances( instance_ids: describe.instances.map(&:instance_id), auto_scaling_group_name: Tapjoy::AutoscalingBootstrap.scaler_name, should_decrement_desired_capacity: true, ) end |
.resize(min: 0, max: 0, desired: 0) ⇒ Object
12 13 14 15 16 |
# File 'lib/tapjoy/autoscaling_bootstrap/AWS/Autoscaling/group.rb', line 12 def resize(min: 0, max: 0, desired:0) self.client.update_auto_scaling_group( auto_scaling_group_name: Tapjoy::AutoscalingBootstrap.scaler_name, min_size: min, max_size: max, desired_capacity: desired) end |