Module: Chef::Knife::RackspaceLoadBalancerBase

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/chef/knife/rackspace_load_balancer_base.rb', line 4

def self.included(base)
  base.class_eval do
    option :rackspace_api_region,
      :short => "-R REGION",
      :long => "--rackspace-api-region REGION",
      :description => "Your rackspace API region. IE: ord, dfw",
      :proc => Proc.new {|region| Chef::Config[:knife][:rackspace_api_region] = region}
  end
end

Instance Method Details

#lb_connectionObject



21
22
23
# File 'lib/chef/knife/rackspace_load_balancer_base.rb', line 21

def lb_connection
  @lb_connection ||= CloudLB::Connection.new(rackspace_api_credentials)
end

#rackspace_api_credentialsObject



13
14
15
16
17
18
19
# File 'lib/chef/knife/rackspace_load_balancer_base.rb', line 13

def rackspace_api_credentials
  {
    :username => Chef::Config[:knife][:rackspace_api_username],
    :api_key => Chef::Config[:knife][:rackspace_api_key],
    :region => Chef::Config[:knife][:rackspace_api_region]
  }
end