module Kontena::Plugin::Upcloud::Prompts::Common

Public Class Methods

included(base) click to toggle source
# File lib/kontena/plugin/upcloud/prompts.rb, line 8
def self.included(base)
  base.prepend Defaults
  base.option "--username", "USER", "Upcloud username", required: true, environment_variable: 'UPCLOUD_USERNAME'
  base.option "--password", "PASS", "Upcloud password", required: true, environment_variable: 'UPCLOUD_PASSWORD'
end

Public Instance Methods

abort_unless_api_access() click to toggle source
# File lib/kontena/plugin/upcloud/prompts.rb, line 18
def abort_unless_api_access
  unless upcloud_client.api_access?
    exit_with_error('Upcloud API authentication failed. Check that API access is enabled for the user.')
  end
end
upcloud_client() click to toggle source
# File lib/kontena/plugin/upcloud/prompts.rb, line 14
def upcloud_client
  @upcloud_client ||=  Kontena::Machine::Upcloud::Client.new(username, password)
end