module Rancher::Configurable
Configuration options for {Client}, defaulting to values in {Default}
Attributes
@!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.
@!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.
@!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.
@!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.
@!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.
@!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.
@!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
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
# File lib/rancher/configurable.rb, line 66 def api_endpoint File.join(@api_endpoint, '') end
Set configuration options using a block
# File lib/rancher/configurable.rb, line 45 def configure yield self end
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
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
Private Instance Methods
# 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
# File lib/rancher/configurable.rb, line 72 def options Hash[Rancher::Configurable.keys.map do |key| [key, instance_variable_get(:"@#{key}")] end ] end