Class: Conjur::Command
Direct Known Subclasses
Assets, Audit, Authn, Field, Groups, Hosts, Id, Init, Resources, Roles, Secrets, Users, Variables, DSLCommand
Defined Under Namespace
Classes: Assets, Audit, Authn, Field, Groups, Hosts, Id, Init, Policy, Resources, Roles, Script, Secrets, Users, Variables
Constant Summary
collapse
- @@api =
nil
Class Attribute Summary collapse
Class Method Summary
collapse
conjur_account, full_resource_id, get_kind_and_id_from_args
Class Attribute Details
.prefix ⇒ Object
Returns the value of attribute prefix.
28
29
30
|
# File 'lib/conjur/command.rb', line 28
def prefix
@prefix
end
|
Class Method Details
.acting_as_option(command) ⇒ Object
46
47
48
49
50
51
52
|
# File 'lib/conjur/command.rb', line 46
def acting_as_option(command)
command.arg_name 'Perform all actions as the specified Group'
command.flag [:"as-group"]
command.arg_name 'Perform all actions as the specified Role'
command.flag [:"as-role"]
end
|
.api ⇒ Object
42
43
44
|
# File 'lib/conjur/command.rb', line 42
def api
@@api ||= Conjur::Authn.connect
end
|
.command(name, *a, &block) ⇒ Object
34
35
36
|
# File 'lib/conjur/command.rb', line 34
def command name, *a, &block
Conjur::CLI.command "#{prefix}:#{name}", *a, &block
end
|
.display(obj, options = {}) ⇒ Object
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/conjur/command.rb', line 54
def display(obj, options = {})
str = if obj.respond_to?(:attributes)
JSON.pretty_generate obj.attributes
elsif obj.respond_to?(:id)
obj.id
else
JSON.pretty_generate obj
end
puts str
end
|
.method_missing(*a) ⇒ Object
30
31
32
|
# File 'lib/conjur/command.rb', line 30
def method_missing *a
Conjur::CLI.send *a
end
|
.require_arg(args, name) ⇒ Object
38
39
40
|
# File 'lib/conjur/command.rb', line 38
def require_arg(args, name)
args.shift or raise "Missing parameter: #{name}"
end
|