Sha256: 628300c60d15ae65ab96fed70e1cd4dc445dfb9747a8c6915ec0b808542db7b1

Contents?: true

Size: 806 Bytes

Versions: 5

Compression:

Stored size: 806 Bytes

Contents

require_relative 'common'

module Kontena::Cli::Grids
  class CreateCommand < Kontena::Command
    include Kontena::Cli::Common
    include Common

    parameter "NAME", "Grid name"

    option "--initial-size", "INITIAL_SIZE", "Initial grid size (number of nodes)", default: 1
    option "--skip-use", :flag, "Do not switch to the created grid"
    option "--silent", :flag, "Reduce output verbosity"

    def execute
      require_api_url

      token = require_token
      payload = {
        name: name
      }
      payload[:initial_size] = initial_size if initial_size
      grid = client(token).post('grids', payload)
      if grid && !self.skip_use?
        config.current_grid = grid['name']
        config.write
        puts "Using grid: #{pastel.cyan(grid['name'])}"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kontena-cli-0.16.0.pre5 lib/kontena/cli/grids/create_command.rb
kontena-cli-0.16.0.pre4 lib/kontena/cli/grids/create_command.rb
kontena-cli-0.16.0.pre3 lib/kontena/cli/grids/create_command.rb
kontena-cli-0.16.0.pre2 lib/kontena/cli/grids/create_command.rb
kontena-cli-0.16.0.pre1 lib/kontena/cli/grids/create_command.rb