class Rancher::Client

The Main Client for talking with Rancher

Constants

CONVENIENCE_HEADERS

Header keys that can be passed in options hash to {#get},{#head}

Attributes

types[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/rancher/client.rb, line 20
def initialize(options = {})
  # Use options passed in, but fall back to module defaults
  @types = {}
  Rancher::Configurable.keys.each do |key|
    instance_variable_set(
      :"@#{key}",
      options[key] || Rancher.instance_variable_get(:"@#{key}")
    )
  end

  load_schema
end

Public Instance Methods

access_key=(value) click to toggle source

Set Rancher access_key

@param value [String] Rancher access_key

# File lib/rancher/client.rb, line 57
def access_key=(value)
  reset_agent
  @access_key = value
end
inspect() click to toggle source

Text representation of the client, masking tokens and passwords

@return [String]

Calls superclass method
# File lib/rancher/client.rb, line 44
def inspect
  inspected = super

  if @secret_key
    inspected = inspected.gsub! @secret_key, "#{'*'*36}#{@secret_key[36..-1]}"
  end

  inspected
end
load_schema() click to toggle source
# File lib/rancher/client.rb, line 33
def load_schema
  response = get 'schema'

  response.each do |res|
    @types[res.get_id.to_sym] = Rancher::Type.new(res)
  end if response.is_a?(Rancher::Collection)
end
method_missing(method_name, *args, &block) click to toggle source
Calls superclass method
# File lib/rancher/client.rb, line 74
def method_missing(method_name, *args, &block)
  return @types[method_name] if respond_to?(method_name)

  super
end
respond_to_missing?(method_name, _include_private = false) click to toggle source
# File lib/rancher/client.rb, line 70
def respond_to_missing?(method_name, _include_private = false)
  (@types.key?(method_name))
end
secret_key=(value) click to toggle source

Set Rancher secret_key

@param value [String] Rancher secret_key

# File lib/rancher/client.rb, line 65
def secret_key=(value)
  reset_agent
  @secret_key = value
end