Module: Misty::Client
- Included in:
- ClientPack
- Defined in:
- lib/misty/client.rb
Defined Under Namespace
Classes: InvalidDataError, Options
Constant Summary collapse
- INTERFACES =
%w{admin public internal}
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#microversion ⇒ Object
readonly
Returns the value of attribute microversion.
Instance Method Summary collapse
-
#initialize(auth, config, options = {}) ⇒ Object
Options - Values shown are the default Base path can be forced (Not recommended, mainly used for test purposes) :base_path => nil URL can be forced (Helps when setup is broken) :base_url => nil Optional headers :headers => {} Endpoint type (admin, public or internal) :interface => “public” Region ID :region_id => “regionOne” Service name The Service names are pre defined but more can be added using this option.
-
#prefix_path_to_ignore ⇒ Object
Mixing classes to override When a catalog provides a base path and the Service API definition containts the generic equivalent as prefix then the preifx is redundant and must be removed from the path.
- #requests ⇒ Object
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
12 13 14 |
# File 'lib/misty/client.rb', line 12 def headers @headers end |
#microversion ⇒ Object (readonly)
Returns the value of attribute microversion.
12 13 14 |
# File 'lib/misty/client.rb', line 12 def microversion @microversion end |
Instance Method Details
#initialize(auth, config, options = {}) ⇒ Object
Options - Values shown are the default
Base path can be forced (Not recommended, mainly used for test purposes)
:base_path => nil
URL can be forced (Helps when setup is broken)
:base_url => nil
Optional headers
:headers => {}
Endpoint type (admin, public or internal)
:interface => "public"
Region ID
:region_id => "regionOne"
Service name
The Service names are pre defined but more can be added using this option.
:service_name
SSL Verify Mode
:ssl_verify_mode => true
(micro)version: Can be numbered (3.1) or by state (CURRENT, LATEST or SUPPORTED)
:version => "CURRENT"
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/misty/client.rb', line 32 def initialize(auth, config, = {}) @auth = auth @config = config @options = setup() @uri = URI.parse(@auth.get_url(@options.service_names, @options.region_id, @options.interface)) @base_path = @options.base_path ? @options.base_path : @uri.path @base_path = @base_path.chomp('/') @version = nil @microversion = false @headers = Misty::HTTP::Header.new(@config.headers.get.clone) @headers.add(microversion_header) if microversion @headers.add(@options.headers) unless @options.headers.empty? end |
#prefix_path_to_ignore ⇒ Object
Mixing classes to override When a catalog provides a base path and the Service API definition containts the generic equivalent as prefix then the preifx is redundant and must be removed from the path. For example: Catalog provides ‘192.0.2.21:8004/v1/48985e6b8da145699d411f12a3459fca’ and Service API has ‘/v1/tenant_id/stacks’ then the path prefix is ignored and path is only ‘/stacks’
53 54 55 |
# File 'lib/misty/client.rb', line 53 def prefix_path_to_ignore '' end |
#requests ⇒ Object
57 58 59 |
# File 'lib/misty/client.rb', line 57 def requests requests_api + requests_custom end |