Sha256: 09b4e06e4c136d3c312867b42daaca63db8e5fbea1f0afd419cd57ad6281f742

Contents?: true

Size: 873 Bytes

Versions: 8

Compression:

Stored size: 873 Bytes

Contents

module Kontena::Cli::ExternalRegistries
  class AddCommand < Kontena::Command
    include Kontena::Cli::Common
    include Kontena::Cli::GridOptions

    parameter '[URL]', 'Docker Registry url', default: 'https://index.docker.io/v2/'

    option ['-u', '--username'], 'USERNAME', 'Username', required: true
    option ['-e', '--email'], 'EMAIL', 'Email', required: true
    option ['-p', '--password'], 'PASSWORD', 'Password', required: true

    def execute
      require_api_url
      require_current_grid
      token = require_token

      self.url = "https://#{self.url}" unless self.url.start_with?('http')

      data = { username: username, password: password, email: email, url: url }
      spinner "Adding #{url.colorize(:cyan)} to external registries " do
        client(token).post("grids/#{current_grid}/external_registries", data)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
kontena-cli-1.4.3 lib/kontena/cli/external_registries/add_command.rb
kontena-cli-1.4.3.rc1 lib/kontena/cli/external_registries/add_command.rb
kontena-cli-1.4.2 lib/kontena/cli/external_registries/add_command.rb
kontena-cli-1.4.2.rc1 lib/kontena/cli/external_registries/add_command.rb
kontena-cli-1.4.2.pre1 lib/kontena/cli/external_registries/add_command.rb
kontena-cli-1.4.1 lib/kontena/cli/external_registries/add_command.rb
kontena-cli-1.4.1.rc1 lib/kontena/cli/external_registries/add_command.rb
kontena-cli-1.4.1.pre1 lib/kontena/cli/external_registries/add_command.rb