Sha256: 7fd516e355ac47f308939dad0ce5dff0e783ebb3a11dc3d219d627063232e534

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

require 'conjur/authn'
require 'conjur/command'

class Conjur::Command::Variables < Conjur::Command
  self.prefix = :variable
  
  desc "Create and store a variable"
  command :create do |c|
    c.arg_name "mime_type"
    c.flag [:m, :"mime-type"]
    
    c.arg_name "kind"
    c.flag [:k, :"kind"]
    
    acting_as_option(c)
    
    c.action do |global_options,options,args|
      var = api.create_variable(options[:m], options[:k], options)
      display(var, options)
    end
  end

  desc "Show a variable"
  arg_name "id"
  command :show do |c|
    c.action do |global_options,options,args|
      id = require_arg(args, 'id')
      display(api.variable(id), options)
    end
  end

  desc "Add a value"
  arg_name "variable value"
  command :"values:add" do |c|
    c.action do |global_options,options,args|
      id = require_arg(args, 'variable')
      value = args.shift || STDIN.read
      
      api.variable(id).add_value(value)
    end
  end

  desc "Get a value"
  arg_name "variable"
  command :value do |c|
    c.desc "Version number"
    c.flag [:v, :version]
    
    c.action do |global_options,options,args|
      id = require_arg(args, 'variable')
      puts api.variable(id).value(options[:version])
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
conjur-cli-2.1.2 lib/conjur/command/variables.rb
conjur-cli-2.1.1 lib/conjur/command/variables.rb