Class: Conjur::Policy::Planner::Policy

Inherits:
Base show all
Defined in:
lib/conjur/policy/planner/record.rb

Instance Attribute Summary

Attributes inherited from Base

#api, #plan, #record

Instance Method Summary collapse

Methods inherited from Base

#account, #action, #create_record, #error, #initialize, #log, #resource, #resource_exists?, #resource_record, #role, #role_exists?, #role_record, #update_record

Methods included from Logger

included

Constructor Details

This class inherits a constructor from Conjur::Policy::Planner::Base

Instance Method Details

#do_planObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/conjur/policy/planner/record.rb', line 45

def do_plan
  unless record.body.nil?
    error('Not expecting a body element in policy')
  end
  
  # Create the role
  Role.new(record.role, api).tap do |role|
    role.plan = plan
    role.do_plan
  end

  # Copy the annotations
  Hash(record.annotations).each do |k,v|
    record.resource.annotations ||= {}
    record.resource.annotations[k] = v
  end

  # Create the resource
  Resource.new(record.resource, api).tap do |resource|
    resource.plan = plan
    resource.do_plan
  end
end