Class: Rivet::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/rivet/client.rb

Instance Method Summary collapse

Constructor Details

#initializeClient

Returns a new instance of Client.



3
4
# File 'lib/rivet/client.rb', line 3

def initialize
end

Instance Method Details

#run(options) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rivet/client.rb', line 6

def run(options)
  AwsUtils.set_aws_credentials(options[:profile])
  Rivet::Log.level(options[:log_level])

  unless Dir.exists?(options[:definitions_directory])
    Rivet::Utils.die("The autoscale definitions directory doesn't exist")
  end

  group_def = Rivet::Utils.get_definition(
    options[:group],
    options[:definitions_directory])

  unless group_def
    Rivet::Utils.die "The #{options[:group]} definition doesn't exist"
  end

  Rivet::Log.info("Checking #{options[:group]} autoscaling definition")
  autoscale_def = Rivet::Autoscale.new(options[:group],group_def)
  autoscale_def.show_differences

  if options[:sync]
    autoscale_def.sync
  else
    Rivet::Log.info("use the -s [--sync] flag to sync changes")
  end

end