Class: Appfront::Command::Providers

Inherits:
Base
  • Object
show all
Defined in:
lib/appfront/command/providers.rb

Class Method Summary collapse

Class Method Details

.connect(opts) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/appfront/command/providers.rb', line 25

def self.connect(opts)
  exit 1 unless opts[:provider] and opts[:access] and opts[:secret]
  provider = opts[:provider]
  spinner "Connecting your account with #{provider.capitalize}... " do
    api.post "/provider/#{provider}", access_key: opts[:access], secret_key: opts[:secret]
  end
  puts "\n"
end

.disconnect(args, opts) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/appfront/command/providers.rb', line 15

def self.disconnect(args, opts)
  provider = opts[:provider]
  exit 1 unless provider == 'amazon' or provider == 'digitalocean'

  spinner "Disconnecting #{provider.capitalize}... " do
    api.delete "/provider/#{provider}"
  end
  puts "\n"
end

.listObject



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/appfront/command/providers.rb', line 3

def self.list
  providers = api.get "/providers"
  unless providers.count == 0
    puts '=== Providers Connection Status:'
    providers.each do |p| 
      puts "\t#{p['tier'].capitalize} ---> Connected"
    end
  else
    puts '=== No Providers connected with this account'
  end
end