Sha256: 1341f7d3d58c7eebe7963e1705f372bfe4175a773c806f15e95a31fec3edb940

Contents?: true

Size: 878 Bytes

Versions: 4

Compression:

Stored size: 878 Bytes

Contents

module Brightbox
  desc "Manages an account's cloud IP addresses"
  command [:cloudips] do |cmd|

    cmd.desc "Create a new Cloud IP address"
    cmd.command [:create] do |c|

      c.desc "Number of Cloud IPs to create"
      c.default_value 1
      c.flag [:i, "count"]

      c.desc "Friendly name of the Cloud IP"
      c.flag [:n, :name]

      c.desc "Cloud IP translators. Format: in-port:out-port:protocol. Comma separate multiple translators. Protocol can be tcp or udp."
      c.flag [:t, :"port-translators"]

      c.action do |global_options, options, args|

        if options[:i].to_s !~ /^[0-9]+$/
          raise "count must be a number"
        end

        options[:i] = options[:i].to_i

        ips = []
        options[:i].times do
          ips << CloudIP.create(options)
        end
        render_table(ips, global_options)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
brightbox-cli-1.1.0 lib/brightbox-cli/commands/cloudips-create.rb
brightbox-cli-1.0.0 lib/brightbox-cli/commands/cloudips-create.rb
brightbox-cli-1.0.0.rc2 lib/brightbox-cli/commands/cloudips-create.rb
brightbox-cli-1.0.0.rc1 lib/brightbox-cli/commands/cloudips-create.rb