Module: Conjur::Policy::Types::ActsAsResource
- Included in:
- Ruby::Policy, Group, Host, HostFactory, Layer, Policy, Resource, User, Variable, Webservice
- Defined in:
- lib/conjur/policy/types/records.rb
Class Method Summary collapse
Instance Method Summary collapse
- #action ⇒ Object
- #immutable_attribute_names ⇒ Object
- #initialize(id = nil) ⇒ Object
- #resource? ⇒ Boolean
- #resource_id ⇒ Object
- #resource_kind ⇒ Object
- #resourceid(default_account = nil) ⇒ Object
- #to_s ⇒ Object
Class Method Details
.included(base) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/conjur/policy/types/records.rb', line 16 def self.included(base) base.module_eval do attribute :id, kind: :string, singular: true, dsl_accessor: true attribute :account, kind: :string, singular: true attribute :owner, kind: :role, singular: true, dsl_accessor: true attribute :annotations, kind: :hash, type: Hash, singular: true def description value annotation 'description', value end def annotation name, value self.annotations ||= {} self.annotations[name] = value end end end |
Instance Method Details
#action ⇒ Object
55 56 57 |
# File 'lib/conjur/policy/types/records.rb', line 55 def action :create end |
#immutable_attribute_names ⇒ Object
63 64 65 |
# File 'lib/conjur/policy/types/records.rb', line 63 def immutable_attribute_names [] end |
#initialize(id = nil) ⇒ Object
35 36 37 |
# File 'lib/conjur/policy/types/records.rb', line 35 def initialize id = nil self.id = id if id end |
#resource? ⇒ Boolean
59 60 61 |
# File 'lib/conjur/policy/types/records.rb', line 59 def resource? true end |
#resource_id ⇒ Object
51 52 53 |
# File 'lib/conjur/policy/types/records.rb', line 51 def resource_id id end |
#resource_kind ⇒ Object
47 48 49 |
# File 'lib/conjur/policy/types/records.rb', line 47 def resource_kind self.class.name.split("::")[-1].underscore end |
#resourceid(default_account = nil) ⇒ Object
43 44 45 |
# File 'lib/conjur/policy/types/records.rb', line 43 def resourceid default_account = nil [ account || default_account, resource_kind, id ].join(":") end |