Sha256: b2139aec8e3ba50ba2c443483f40a5d88bc9d175e4c2f9070c95f68e7251aca8

Contents?: true

Size: 917 Bytes

Versions: 8

Compression:

Stored size: 917 Bytes

Contents

module Brightbox
  desc 'update Cloud IPs'
  arg_name 'cloudip-id'
  command [:update] do |c|
    c.desc "Set reverse DNS for this cloud ip"
    c.flag [:r, "reverse-dns"]

    c.desc "Delete the reverse DNS for this cloud ip"
    c.switch ["delete-reverse-dns"]

    c.action do |global_options,options,args|
      cip_id = args.shift
      raise "You must specify the cloud ip id as the first argument" unless cip_id =~ /^cip-/

      if options[:r] && options[:r] != "" && options[:"delete-reverse-dns"]
        raise "You must either specify a reverse DNS record or --delete-reverse-dns"
      end

      cip = CloudIP.find cip_id

      params = {}
      if options[:r]
        params[:reverse_dns] = options[:r]
      end

      if options[:"delete-reverse-dns"]
        params[:reverse_dns] = ""
      end

      cip.update(params)
      cip.reload

      render_table([cip], global_options)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
brightbox-cli-0.17.5 lib/brightbox-cli/commands/cloudips-update.rb
brightbox-cli-0.17.4 lib/brightbox-cli/commands/cloudips-update.rb
brightbox-cli-0.17.3 lib/brightbox-cli/commands/cloudips-update.rb
brightbox-cli-0.17.2 lib/brightbox-cli/commands/cloudips-update.rb
brightbox-cli-0.17.1 lib/brightbox-cli/commands/cloudips-update.rb
brightbox-cli-0.17.0 lib/brightbox-cli/commands/cloudips-update.rb
brightbox-cli-0.16.0 lib/brightbox-cli/commands/cloudips-update.rb
brightbox-cli-0.15.0 lib/brightbox-cli/commands/cloudips-update.rb