module Rancher::Configurable

Configuration options for {Client}, defaulting to values in {Default}

Attributes

access_key[RW]

@!attribute api_endpoint

@return [String] Base URL for API requests. default: http://localhost:8080/v1/projects/1p1

@!attribute access_key

@return [String] Access Key from inside rancher

@!attribute [w] secret_key

@return [String] Secrete Key form inside rancher

@!attribute connection_options

@see https://github.com/lostisland/faraday
@return [Hash] Configure connection options for Faraday

@!attribute middleware

@see https://Rancher.com/lostisland/faraday
@return [Faraday::Builder or Faraday::RackBuilder] Configure middleware for Faraday

@!attribute proxy

@see https://Rancher.com/lostisland/faraday
@return [String] URI for proxy server

@!attribute user_agent

@return [String] Configure User-Agent header for requests.
api_endpoint[W]
connection_options[RW]

@!attribute api_endpoint

@return [String] Base URL for API requests. default: http://localhost:8080/v1/projects/1p1

@!attribute access_key

@return [String] Access Key from inside rancher

@!attribute [w] secret_key

@return [String] Secrete Key form inside rancher

@!attribute connection_options

@see https://github.com/lostisland/faraday
@return [Hash] Configure connection options for Faraday

@!attribute middleware

@see https://Rancher.com/lostisland/faraday
@return [Faraday::Builder or Faraday::RackBuilder] Configure middleware for Faraday

@!attribute proxy

@see https://Rancher.com/lostisland/faraday
@return [String] URI for proxy server

@!attribute user_agent

@return [String] Configure User-Agent header for requests.
default_media_type[RW]

@!attribute api_endpoint

@return [String] Base URL for API requests. default: http://localhost:8080/v1/projects/1p1

@!attribute access_key

@return [String] Access Key from inside rancher

@!attribute [w] secret_key

@return [String] Secrete Key form inside rancher

@!attribute connection_options

@see https://github.com/lostisland/faraday
@return [Hash] Configure connection options for Faraday

@!attribute middleware

@see https://Rancher.com/lostisland/faraday
@return [Faraday::Builder or Faraday::RackBuilder] Configure middleware for Faraday

@!attribute proxy

@see https://Rancher.com/lostisland/faraday
@return [String] URI for proxy server

@!attribute user_agent

@return [String] Configure User-Agent header for requests.
middleware[RW]

@!attribute api_endpoint

@return [String] Base URL for API requests. default: http://localhost:8080/v1/projects/1p1

@!attribute access_key

@return [String] Access Key from inside rancher

@!attribute [w] secret_key

@return [String] Secrete Key form inside rancher

@!attribute connection_options

@see https://github.com/lostisland/faraday
@return [Hash] Configure connection options for Faraday

@!attribute middleware

@see https://Rancher.com/lostisland/faraday
@return [Faraday::Builder or Faraday::RackBuilder] Configure middleware for Faraday

@!attribute proxy

@see https://Rancher.com/lostisland/faraday
@return [String] URI for proxy server

@!attribute user_agent

@return [String] Configure User-Agent header for requests.
proxy[RW]

@!attribute api_endpoint

@return [String] Base URL for API requests. default: http://localhost:8080/v1/projects/1p1

@!attribute access_key

@return [String] Access Key from inside rancher

@!attribute [w] secret_key

@return [String] Secrete Key form inside rancher

@!attribute connection_options

@see https://github.com/lostisland/faraday
@return [Hash] Configure connection options for Faraday

@!attribute middleware

@see https://Rancher.com/lostisland/faraday
@return [Faraday::Builder or Faraday::RackBuilder] Configure middleware for Faraday

@!attribute proxy

@see https://Rancher.com/lostisland/faraday
@return [String] URI for proxy server

@!attribute user_agent

@return [String] Configure User-Agent header for requests.
secret_key[RW]

@!attribute api_endpoint

@return [String] Base URL for API requests. default: http://localhost:8080/v1/projects/1p1

@!attribute access_key

@return [String] Access Key from inside rancher

@!attribute [w] secret_key

@return [String] Secrete Key form inside rancher

@!attribute connection_options

@see https://github.com/lostisland/faraday
@return [Hash] Configure connection options for Faraday

@!attribute middleware

@see https://Rancher.com/lostisland/faraday
@return [Faraday::Builder or Faraday::RackBuilder] Configure middleware for Faraday

@!attribute proxy

@see https://Rancher.com/lostisland/faraday
@return [String] URI for proxy server

@!attribute user_agent

@return [String] Configure User-Agent header for requests.
user_agent[RW]

@!attribute api_endpoint

@return [String] Base URL for API requests. default: http://localhost:8080/v1/projects/1p1

@!attribute access_key

@return [String] Access Key from inside rancher

@!attribute [w] secret_key

@return [String] Secrete Key form inside rancher

@!attribute connection_options

@see https://github.com/lostisland/faraday
@return [Hash] Configure connection options for Faraday

@!attribute middleware

@see https://Rancher.com/lostisland/faraday
@return [Faraday::Builder or Faraday::RackBuilder] Configure middleware for Faraday

@!attribute proxy

@see https://Rancher.com/lostisland/faraday
@return [String] URI for proxy server

@!attribute user_agent

@return [String] Configure User-Agent header for requests.

Public Class Methods

keys() click to toggle source

List of configurable keys for {Rancher::Client} @return [Array] of option keys

# File lib/rancher/configurable.rb, line 30
def keys
  @keys ||= [
    :api_endpoint,
    :access_key,
    :secret_key,
    :connection_options,
    :default_media_type,
    :middleware,
    :proxy,
    :user_agent
  ]
end

Public Instance Methods

api_endpoint() click to toggle source
# File lib/rancher/configurable.rb, line 66
def api_endpoint
  File.join(@api_endpoint, '')
end
configure() { |self| ... } click to toggle source

Set configuration options using a block

# File lib/rancher/configurable.rb, line 45
def configure
  yield self
end
reset!() click to toggle source

Reset configuration options to default values

# File lib/rancher/configurable.rb, line 50
def reset!
  Rancher::Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", Rancher::Default.options[key])
  end
  self
end
Also aliased as: setup
same_options?(opts) click to toggle source

Compares client options to a Hash of requested options

@param opts [Hash] Options to compare with current client options @return [Boolean]

# File lib/rancher/configurable.rb, line 62
def same_options?(opts)
  opts.hash == options.hash
end
setup()
Alias for: reset!

Private Instance Methods

fetch_access_key_and_secret(overrides = {}) click to toggle source
# File lib/rancher/configurable.rb, line 79
def fetch_access_key_and_secret(overrides = {})
  opts = options.merge(overrides)
  opts.values_at :access_key, :secret_key
end
options() click to toggle source
# File lib/rancher/configurable.rb, line 72
def options
  Hash[Rancher::Configurable.keys.map do |key|
    [key, instance_variable_get(:"@#{key}")]
    end
  ]
end