Sha256: 4554256f2ebe342ec6dac1e53f36a69f19e4885c44c8700ec6489e712a0da5a4

Contents?: true

Size: 1.85 KB

Versions: 3

Compression:

Stored size: 1.85 KB

Contents

require 'conjur/command'

class Conjur::Command::ServiceGateways < Conjur::Command
  self.prefix = :"service-gateway"

  desc "Add a proxy to a service gateway. The proxy is identified by role."
  arg_name "service-gateway role"
  command :"proxies:add" do |c|
    c.action do |global_options, options, args|
      id = require_arg(args, 'service-gateway')
      role = require_arg(args, 'role')
      
      api.service_gateway(id).add_proxy role
      puts "Proxy added"
    end
  end

  desc "Remove a host from an service gateway"
  arg_name "service-gateway role"
  command :"proxies:remove" do |c|
    c.action do |global_options, options, args|
      id = require_arg(args, 'service-gateway')
      role = require_arg(args, 'role')
      
      api.service_gateway(id).remove_proxy role
      puts "Proxy removed"
    end
  end

  desc "Remove a web service from an service gateway"
  arg_name "service-gateway web-service"
  command :"web-services:remove" do |c|
    c.action do |global_options, options, args|
      id = require_arg(args, 'service-gateway')
      web_service = require_arg(args, 'web-service')
      
      api.service_gateway(id).remove_web_service web_service
      puts "WebService removed"
    end
  end

  desc "Encrypt a web service credential"
  arg_name "service-gateway (value | STDIN)"
  command :"encrypt" do |c|
    c.action do |global_options, options, args|
      id = require_arg(args, 'service-gateway')
      value = args.shift || STDIN.read
      
      $stdout.write api.service_gateway(id).encrypt value
    end
  end

  desc "Decrypt a web service credential"
  arg_name "service-gateway (value | STDIN)"
  command :"decrypt" do |c|
    c.action do |global_options, options, args|
      id = require_arg(args, 'service-gateway')
      value = args.shift || STDIN.read
      
      $stdout.write api.service_gateway(id).decrypt value
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
conjur-asset-service-gateway-api-0.6.0 lib/conjur/command/service_gateways.rb
conjur-asset-service-gateway-api-0.5.3 lib/conjur/command/service_gateways.rb
conjur-asset-service-gateway-api-0.5.2 lib/conjur/command/service_gateways.rb