Class: Ufo::Scale

Inherits:
Base
  • Object
show all
Defined in:
lib/ufo/scale.rb

Instance Method Summary collapse

Methods inherited from Base

#full_service, #info, #no_service_message, #switch_current

Methods included from Ufo::Stack::Helper

#adjust_stack_name, #find_stack, #status

Methods included from Settings

#cfn, #network, #settings

Methods included from Util

#default_cluster, #display_params, #execute, #pretty_time, #settings, #task_definition_arns, #user_params

Methods included from AwsService

#cloudformation, #cloudwatchlogs, #ec2, #ecr, #ecs, #elb

Constructor Details

#initialize(service, count, options = {}) ⇒ Scale

Returns a new instance of Scale.



5
6
7
8
# File 'lib/ufo/scale.rb', line 5

def initialize(service, count, options={})
  super(service, options)
  @count = count
end

Instance Method Details

#service_exists?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/ufo/scale.rb', line 24

def service_exists?
  !!service
end

#updateObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ufo/scale.rb', line 10

def update
  unless service_exists?
    puts "Unable to find the #{@service.color(:green)} service on the #{@cluster.color(:green)} cluster."
    puts "Are you sure you are trying to scale the right service on the right cluster?"
    exit
  end
  ecs.update_service(
    service: service.service_name,
    cluster: @cluster,
    desired_count: @count
  )
  puts "Scale #{full_service.color(:green)} service in #{@cluster.color(:green)} to #{@count}" unless @options[:mute]
end