Class: Skeme::Managers::RightScale

Inherits:
Object
  • Object
show all
Defined in:
lib/managers/rightscale.rb

Constant Summary collapse

@@region_hash =
{'us-east-1' => 1, 'eu-west-1' => 2, 'us-west-1' => 3, 'ap-northeast-1' => 4, 'ap-southeast-1' => 5}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ RightScale

Returns a new instance of RightScale.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/managers/rightscale.rb', line 24

def initialize(options={})
  @logger = options[:logger]
  if options[:rs_email] && options[:rs_pass] && options[:rs_acct_num]
    pass = options[:rs_pass].gsub('"', '\\"')

    @logger.info("RightScale credentials supplied. RightScale Tagging Enabled.")
    ::RightScale::Api::BaseExtend.class_eval "    @@connection ||= RestConnection::Connection.new\n      @@connection.settings = {\n        :user => \"\#{options[:rs_email]}\",\n        :pass => \"\#{pass}\",\n        :api_url => \"https://my.rightscale.com/api/acct/\#{options[:rs_acct_num]}\",\n        :common_headers => {\n          \"X_API_VERSION\" => \"1.0\"\n        }\n      }\n    EOF\n    ::RightScale::Api::Base.class_eval <<-EOF\n    @@connection ||= RestConnection::Connection.new\n      @@connection.settings = {\n        :user => \"\#{options[:rs_email]}\",\n        :pass => \"\#{pass}\",\n        :api_url => \"https://my.rightscale.com/api/acct/\#{options[:rs_acct_num]}\",\n        :common_headers => {\n          \"X_API_VERSION\" => \"1.0\"\n        }\n      }\n    EOF\n\n    @gotime = true\n  end\nend\n"

Instance Attribute Details

#gotimeObject

Returns the value of attribute gotime.



20
21
22
# File 'lib/managers/rightscale.rb', line 20

def gotime
  @gotime
end

#loggerObject

Returns the value of attribute logger.



20
21
22
# File 'lib/managers/rightscale.rb', line 20

def logger
  @logger
end

Instance Method Details

#set_tag(params = {}) ⇒ Object



57
58
59
# File 'lib/managers/rightscale.rb', line 57

def set_tag(params={})
  tag(params.merge({:action => "set"}))
end

#unset_tag(params = {}) ⇒ Object



61
62
63
# File 'lib/managers/rightscale.rb', line 61

def unset_tag(params={})
  tag(params.merge({:action => "unset"}))
end