Sha256: 4699b2ef71338001dfa242e3f0e4c59b0b31e4f1d2e8740b1afcc9629ca422b0

Contents?: true

Size: 1.47 KB

Versions: 1

Compression:

Stored size: 1.47 KB

Contents

module Balancer
  class CLI < Command
    class_option :verbose, type: :boolean
    class_option :noop, type: :boolean

    desc "create NAME", "Create Load Balancer."
    long_desc Help.text(:create)
    # create_load_balancer options
    option :subnets, type: :array, desc: "Subnets"
    option :security_groups, type: :array, desc: "Security groups"
    # create_target_group options
    option :vpc_id, type: :array, desc: "Vpc id"
    option :target_group_name, desc: "Target group name"
    # security_group options
    option :sg_cidr, default: "0.0.0.0/0", desc: "Security group cidr range"
    def create(name)
      Create.new(options.merge(name: name)).run
    end

    desc "destroy NAME", "Destroy Load Balancer and associated target group."
    long_desc Help.text(:destroy)
    def destroy(name)
      Destroy.new(options.merge(name: name)).run
    end

    long_desc Help.text(:init)
    Init.cli_options.each do |args|
      option *args
    end
    register(Init, "init", "init", "Sets up balancer for project")

    desc "completion *PARAMS", "Prints words for auto-completion."
    long_desc Help.text("completion")
    def completion(*params)
      Completer.new(CLI, *params).run
    end

    desc "completion_script", "Generates a script that can be eval to setup auto-completion."
    long_desc Help.text("completion_script")
    def completion_script
      Completer::Script.generate
    end

    desc "version", "prints version"
    def version
      puts VERSION
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
balancer-0.2.0 lib/balancer/cli.rb