Class: Puppet::DataBinding::Jerakia_rest
- Inherits:
-
Indirector::Code
- Object
- Indirector::Code
- Puppet::DataBinding::Jerakia_rest
- Defined in:
- lib/puppet/indirector/data_binding/jerakia_rest.rb
Instance Attribute Summary collapse
-
#jerakia ⇒ Object
readonly
Returns the value of attribute jerakia.
-
#jerakia_url ⇒ Object
readonly
Returns the value of attribute jerakia_url.
-
#policy ⇒ Object
readonly
Returns the value of attribute policy.
Instance Method Summary collapse
- #find(request) ⇒ Object
-
#initialize(*args) ⇒ Jerakia_rest
constructor
A new instance of Jerakia_rest.
Constructor Details
#initialize(*args) ⇒ Jerakia_rest
Returns a new instance of Jerakia_rest.
19 20 21 22 23 24 |
# File 'lib/puppet/indirector/data_binding/jerakia_rest.rb', line 19 def initialize(*args) @jerakia=::Jerakia.new @jerakia_url=@jerakia.config.server_url @policy = "puppet" super end |
Instance Attribute Details
#jerakia ⇒ Object (readonly)
Returns the value of attribute jerakia.
15 16 17 |
# File 'lib/puppet/indirector/data_binding/jerakia_rest.rb', line 15 def jerakia @jerakia end |
#jerakia_url ⇒ Object (readonly)
Returns the value of attribute jerakia_url.
16 17 18 |
# File 'lib/puppet/indirector/data_binding/jerakia_rest.rb', line 16 def jerakia_url @jerakia_url end |
#policy ⇒ Object (readonly)
Returns the value of attribute policy.
17 18 19 |
# File 'lib/puppet/indirector/data_binding/jerakia_rest.rb', line 17 def policy @policy end |
Instance Method Details
#find(request) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/puppet/indirector/data_binding/jerakia_rest.rb', line 26 def find(request) lookupdata=request.key.split(/::/) key=lookupdata.pop namespace=lookupdata #metadata = request.options[:variables].to_hash = { :environment => request.[:variables].environment, } payload={ :namespace => namespace, :lookup_type => :first, :metadata => , }.to_json response = RestClient.get "#{jerakia_url}/#{policy}/#{key}", :params => { :payload => payload } response end |