lib/conjur/command/resources.rb in conjur-cli-5.3.0 vs lib/conjur/command/resources.rb in conjur-cli-5.4.0

- old
+ new

@@ -21,16 +21,18 @@ class Conjur::Command::Resources < Conjur::Command desc "Manage resources" command :resource do |resource| - resource.desc "Create a new resource" + resource.desc "Create a new resource [DEPRECATED]" resource.arg_name "RESOURCE" resource.command :create do |c| acting_as_option(c) c.action do |global_options,options,args| + notify_deprecated + id = full_resource_id( require_arg(args, "RESOURCE") ) resource = api.resource(id) if ownerid = options.delete(:ownerid) options[:acting_as] = ownerid @@ -57,16 +59,18 @@ id = full_resource_id( require_arg(args, "RESOURCE") ) puts api.resource(id).exists? end end - resource.desc "Give a privilege on a resource" + resource.desc "Give a privilege on a resource [DEPRECATED]" resource.arg_name "RESOURCE ROLE PRIVILEGE" resource.command :permit do |c| c.desc "allow transfer to other roles" c.switch [:g, :grantable] c.action do |global_options,options,args| + notify_deprecated + id = full_resource_id( require_arg(args, "RESOURCE") ) role = require_arg(args, "ROLE") privilege = require_arg(args, "PRIVILEGE") $stderr.print "Granting #{role} permission to #{privilege} #{id}... " unless options[:g] @@ -77,14 +81,16 @@ puts "Permission granted" end end - resource.desc "Deny a privilege on a resource" + resource.desc "Deny a privilege on a resource [DEPRECATED]" resource.arg_name "RESOURCE ROLE PRIVILEGE" resource.command :deny do |c| c.action do |global_options,options,args| + notify_deprecated + id = full_resource_id( require_arg(args, "RESOURCE") ) role = require_arg(args, "ROLE") privilege = require_arg(args, "PRIVILEGE") api.resource(id).deny privilege, role puts "Permission revoked" @@ -113,14 +119,16 @@ puts api.resource(id).permitted? privilege end end end - resource.desc "Grant ownership on a resource to a new owner" + resource.desc "Grant ownership on a resource to a new owner [DEPRECATED]" resource.arg_name "RESOURCE USER" resource.command :give do |c| c.action do |global_options,options,args| + notify_deprecated + id = full_resource_id( require_arg(args, "RESOURCE") ) owner = require_arg(args, "USER") api.resource(id).give_to owner puts "Ownership granted" end @@ -134,15 +142,17 @@ permission = require_arg(args, "PERMISSION") display api.resource(id).permitted_roles(permission) end end - resource.desc "Set an annotation on a resource" + resource.desc "Set an annotation on a resource [DEPRECATED]" resource.arg_name "RESOURCE ANNOTATION value" resource.command :annotate do |c| interactive_option c c.action do |global_options, options, args| + notify_deprecated + id = full_resource_id require_arg(args, 'RESOURCE') annotations = if options[:interactive] prompt_for_annotations else