Class: FaaStRuby::Command::Workspace::Update

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/faastruby/cli/commands/workspace/update.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseCommand

#has_user_logged_in?, #help, #load_credentials, #load_yaml, #say, spin, #spin, #write_file

Constructor Details

#initialize(args) ⇒ Update

Returns a new instance of Update.



7
8
9
10
11
12
13
14
15
# File 'lib/faastruby/cli/commands/workspace/update.rb', line 7

def initialize(args)
  @args = args
  help
  @missing_args = []
  FaaStRuby::CLI.error(@missing_args, color: nil) if missing_args.any?
  @workspace_name = @args.shift
  parse_options
  load_credentials
end

Class Method Details

.helpObject



25
26
27
# File 'lib/faastruby/cli/commands/workspace/update.rb', line 25

def self.help
  "update-workspace WORKSPACE_NAME ARGS"
end

Instance Method Details

#runObject



17
18
19
20
21
22
23
# File 'lib/faastruby/cli/commands/workspace/update.rb', line 17

def run
  spinner = spin("Updating the number of runners to #{@options['runners_max']}...")
  workspace = FaaStRuby::Workspace.new(name: @workspace_name)
  workspace.update_runners(@options['runners_max'])
  FaaStRuby::CLI.error(workspace.errors) if workspace.errors.any?
  spinner.success
end

#usageObject



29
30
31
32
33
34
35
36
37
38
# File 'lib/faastruby/cli/commands/workspace/update.rb', line 29

def usage
  puts "\nUsage: faastruby #{self.class.help}"
  puts %(
--runners N   # Assign N runners to the workspace.
      #  N must be an integer between 0 and 100.
      #  When set to 0, requests to any functions
      #  whithin the workspace will return HTTP error
      #  429 - Too Many Requests.
  )
end