Sha256: e32452785f08fa4596267b63222b5f146b5613428c03e5ead2c56941508e217c

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

require 'rubygems'
require 'cli/command'

module Factor
  module CLI
    class CredentialTask < Command

    
      desc "create SERVICE NAME VALUE", "add a key and value for the credential"
      method_option :key, :type=>:string, :desc=>"File reference containing the symmetric key for encryption"
      method_option :organization, :type=>:string, :desc=>"Organizoation to which this credential belongs"
      def create(service,name,value)
        secret=nil
        if options[:key]
          secret=File.read(options[:key])
        end
        puts @client.create_credential(service,name,value,secret,options[:organization])
      end

      desc "list", "get all of the credential"
      def list()
        @client.get_credentials["value"].each do |service,values|
          # puts "#{credential['service']} : #{credential['name']} (#{credential['slug']}): #{credential['value']}"
          puts "#{service}:"
          values.each do |key,values|
          #   puts "#{key['value']} (#{value['slug']}) : #{value}"
            puts "  #{key} (#{values['slug']}): ***"
          end
        end
      end
    
      desc "delete SERVICE NAME", "remove a value from the credentials bag"
      def delete(service,name)
        puts @client.delete_credential(service,name)
      end
    
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
factor-0.3.1 lib/cli/credential_task.rb