module Conjur::DSL2::Types::ActsAsResource

Public Class Methods

included(base) click to toggle source
# File lib/conjur/dsl2/types/records.rb, line 15
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
new(id = nil) click to toggle source
# File lib/conjur/dsl2/types/records.rb, line 34
def initialize id = nil
  self.id = id if id
end

Public Instance Methods

action() click to toggle source
# File lib/conjur/dsl2/types/records.rb, line 54
def action
  :create
end
annotation(name, value) click to toggle source
# File lib/conjur/dsl2/types/records.rb, line 27
def annotation name, value
  self.annotations ||= {}
  self.annotations[name] = value
end
description(value) click to toggle source
# File lib/conjur/dsl2/types/records.rb, line 23
def description value
  annotation 'description', value
end
immutable_attribute_names() click to toggle source
# File lib/conjur/dsl2/types/records.rb, line 62
def immutable_attribute_names
  []
end
resource?() click to toggle source
# File lib/conjur/dsl2/types/records.rb, line 58
def resource?
  true
end
resource_id() click to toggle source
# File lib/conjur/dsl2/types/records.rb, line 50
def resource_id
  id
end
resource_kind() click to toggle source
# File lib/conjur/dsl2/types/records.rb, line 46
def resource_kind
  self.class.name.split("::")[-1].underscore
end
resourceid(default_account = nil) click to toggle source
# File lib/conjur/dsl2/types/records.rb, line 42
def resourceid default_account = nil
  [ account || default_account, resource_kind, id ].join(":")
end
to_s() click to toggle source
# File lib/conjur/dsl2/types/records.rb, line 38
def to_s
  "#{resource_kind.gsub('_', ' ')} '#{id}'#{account && account != Conjur.configuration.account ? ' in account \'' + account + '\'': ''}"
end