Sha256: 85269d9c578c83201986ad4c2ae9e6a793973b32e7b315858b13cfec932f9653
Contents?: true
Size: 826 Bytes
Versions: 11
Compression:
Stored size: 826 Bytes
Contents
module Conjur module IdentifierManipulation # injects account into 2-tokens id def full_resource_id id parts = id.split(':') unless id.nil? if id.blank? or parts.size < 2 raise "Expecting at least two tokens in #{id}" end if parts.size == 2 id = [Conjur.configuration.account, parts].flatten.join(":") end id end alias full_role_id full_resource_id # removes accounts from 3+-tokens id, extracts kind def get_kind_and_id_from_args args, argname='id' flat_id = require_arg(args, argname) tokens=flat_id.split(':') raise "At least 2 tokens expected in #{flat_id}" if tokens.size<2 tokens.shift if tokens.size>=3 # get rid of account kind=tokens.shift.gsub('-','_') [kind, tokens.join(':')] end end end
Version data entries
11 entries across 11 versions & 1 rubygems