Class: Conjur::Deployment
- Inherits:
-
RestClient::Resource
- Object
- RestClient::Resource
- Conjur::Deployment
- Includes:
- ActsAsAsset
- Defined in:
- lib/conjur/deployment.rb
Instance Method Summary collapse
- #add_child(childid) ⇒ Object
- #add_host(hostid) ⇒ Object
- #children ⇒ Object
- #hosts ⇒ Object
- #remove_child(childid) ⇒ Object
- #remove_host(hostid) ⇒ Object
Instance Method Details
#add_child(childid) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/conjur/deployment.rb', line 23 def add_child(childid) log do |logger| logger << "Adding child #{childid} to deployment #{id}" end invalidate do RestClient::Resource.new(self['children'].url, ).post(id: childid) end end |
#add_host(hostid) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/conjur/deployment.rb', line 5 def add_host(hostid) log do |logger| logger << "Adding host #{hostid} to deployment #{id}" end invalidate do RestClient::Resource.new(self['hosts'].url, ).post(hostid: hostid) end end |
#children ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/conjur/deployment.rb', line 47 def children self.attributes['children'].values.collect do |attrs| Conjur::Deployment.new("#{Conjur::Dep::API.host}/deployments/#{path_escape attrs['id']}", ).tap do |d| d.attributes = attrs end end end |
#hosts ⇒ Object
41 42 43 44 45 |
# File 'lib/conjur/deployment.rb', line 41 def hosts self.attributes['hosts'].values.collect do |id| Conjur::Host.new("#{Conjur::Dep::API.host}/hosts/#{path_escape id}", ) end end |
#remove_child(childid) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/conjur/deployment.rb', line 32 def remove_child(childid) log do |logger| logger << "Removing child #{childid} from deployment #{id}" end invalidate do RestClient::Resource.new(self["children/#{path_escape childid}"].url, ).delete end end |
#remove_host(hostid) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/conjur/deployment.rb', line 14 def remove_host(hostid) log do |logger| logger << "Removing host #{name} from deployment #{id}" end invalidate do RestClient::Resource.new(self["hosts/#{path_escape hostid}"].url, ).delete end end |