Class: TwistlockControl::ProvisionerAPI
- Inherits:
-
Object
- Object
- TwistlockControl::ProvisionerAPI
- Defined in:
- lib/twistlock_control/provisioner_api.rb
Overview
The provisioner api provides a direct synchronous interface to a provisioner at the url it is initialized with.
Instance Attribute Summary collapse
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #add_container(name, url) ⇒ Object
- #container_description(name) ⇒ Object
-
#initialize(url) ⇒ ProvisionerAPI
constructor
A new instance of ProvisionerAPI.
- #provision_container(container_configuration) ⇒ Object
Constructor Details
#initialize(url) ⇒ ProvisionerAPI
Returns a new instance of ProvisionerAPI.
10 11 12 |
# File 'lib/twistlock_control/provisioner_api.rb', line 10 def initialize(url) @url = url end |
Instance Attribute Details
#url ⇒ Object (readonly)
Returns the value of attribute url.
8 9 10 |
# File 'lib/twistlock_control/provisioner_api.rb', line 8 def url @url end |
Instance Method Details
#add_container(name, url) ⇒ Object
24 25 26 |
# File 'lib/twistlock_control/provisioner_api.rb', line 24 def add_container(name, url) JSON.parse post('templates', name: name, url: url) end |
#container_description(name) ⇒ Object
20 21 22 |
# File 'lib/twistlock_control/provisioner_api.rb', line 20 def container_description(name) JSON.parse get("templates/#{name}") end |
#provision_container(container_configuration) ⇒ Object
14 15 16 17 18 |
# File 'lib/twistlock_control/provisioner_api.rb', line 14 def provision_container(container_configuration) container = container_configuration.container add_container(container.name, container.url) JSON.parse post('containers', name: container.name) end |