Module: Conjur::PathBased

Included in:
Resource, Role
Defined in:
lib/conjur/path_based.rb

Overview

This module provides methods for determining Conjur id components from an asset's REST URL.

Instance Method Summary collapse

Instance Method Details

#accountString

Return the Conjur organizational account for this role or resource. The account is the first token in a fully qualified Conjur id, like "account:kind:identifier"

Examples:

role = api.role 'foo:bar:baz'
role. # => 'foo'


34
35
36
# File 'lib/conjur/path_based.rb', line 34

def 
  match_path(0..0)
end

#kindString

Return the kind for this role or resource. The kind partitions the space of roles and resources, generally according to their purpose (for example, roles representing users have kind 'user'). The kind of a role or resource is the second token of a fully qualified Conjur id, like "account:kind:identifier".

Examples:

Get the kind of a role

role = api.host('postgres-1').role
role.kind # => 'host'

Get the kind of a resource

res  = api.host('postgres-1').resource
res.kind # => 'host'


51
52
53
# File 'lib/conjur/path_based.rb', line 51

def kind
  match_path(2..2)
end