Class: TwistlockControl::ProvisionerAPI

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#urlObject (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