Class: Conjur::Layer
- Inherits:
-
RestClient::Resource
- Object
- RestClient::Resource
- Conjur::Layer
- Includes:
- ActsAsAsset, ActsAsRole
- Defined in:
- lib/conjur/layer.rb
Instance Method Summary collapse
- #add_host(hostid) ⇒ Object
- #hosts ⇒ Object
-
#hosts_members(role_name) ⇒ Object
Lists the roles that have been granted access to the hosts owned roles.
- #remove_host(hostid) ⇒ Object
Instance Method Details
#add_host(hostid) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/conjur/layer.rb', line 6 def add_host(hostid) hostid = cast(hostid, :roleid) log do |logger| logger << "Adding host #{hostid} to layer #{id}" end invalidate do RestClient::Resource.new(self['hosts'].url, ).post(hostid: hostid) end end |
#hosts ⇒ Object
31 32 33 34 35 |
# File 'lib/conjur/layer.rb', line 31 def hosts self.attributes['hosts'].collect do |id| Conjur::Host.new(Conjur::API.core_asset_host, )["hosts/#{fully_escape id}"] end end |
#hosts_members(role_name) ⇒ Object
Lists the roles that have been granted access to the hosts owned roles.
27 28 29 |
# File 'lib/conjur/layer.rb', line 27 def hosts_members(role_name) owned_role(role_name).members end |
#remove_host(hostid) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/conjur/layer.rb', line 16 def remove_host(hostid) hostid = cast(hostid, :roleid) log do |logger| logger << "Removing host #{hostid} from layer #{id}" end invalidate do RestClient::Resource.new(self["hosts/#{fully_escape hostid}"].url, ).delete end end |