Class: Appfront::Command::Domains

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

Class Method Summary collapse

Class Method Details

.add(args, opts) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/appfront/command/domains.rb', line 12

def self.add(args, opts)
  exit 1 unless args[0]
  puts args[0]
  find_deploy! opts
  spinner "Adding domain..." do
    api.post "/domain/#{args[0]}/#{@deploy}"
  end
  puts "\n"
end

.info(opts) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/appfront/command/domains.rb', line 22

def self.info(opts)
  find_domain! opts

  h = api.get "/domain/#{@deploy}"
  
  puts "=== Domain: #{h['name']}"
  puts
  puts "\t Deploy uuid: #{h['uuid']}"
  puts "\t Status: #{h['status']} "
  puts "\t Running deploys: #{h['deploys']}"
  puts 
  puts "=== Cluster: #{h['cluster_name']} ---> #{h['cluster']}"
  
  puts "\n"    

end

.lsObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/appfront/command/domains.rb', line 39

def self.ls
  domains = api.get "/domains"
  unless domains.count == 0
    puts '=== Domains List'
    domains.each do |domain| 
      chars = 30 - domain['name'].chars.count
      output = "name: #{domain['name']}"
      for i in 0..chars 
        output = output + ' '
      end
      output = output + "---> Deploy uuid: #{domain['flow_uuid']}   name: #{domain['flow_name']}"
      puts output
    end
  else
    puts '=== You have no domains.'
  end
  puts "\n"
end

.rm(args, opts) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/appfront/command/domains.rb', line 3

def self.rm(args, opts)
  exit 1 unless args[0]
  find_deploy! opts
  spinner "Removing domain..." do
    api.delete "/domain/#{args[0]}/#{@deploy}"
  end
  puts "\n"
end