Class: Yao::Cli::LBaaS::Pool

Inherits:
Base
  • Object
show all
Defined in:
lib/yao/cli/lbaas/pool.rb

Instance Method Summary collapse

Methods inherited from Base

banner

Instance Method Details

#createObject



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/yao/cli/lbaas/pool.rb', line 34

def create
  unless [options[:listener_id], options[:loadbalancer_id]].one?
    puts "Error: Either listener_id or loadbalancer_id must be specified."
    exit 1
  end

  params = generate_params
  result = Yao::Resources::LoadBalancerPool.create params

  # fix: すぐに出力するとvip_port_idがnullなのでエラーになる
  #pretty_output(Yao::Resources::Dumper::LoadBalancerPool.dump(result))
end

#listObject



9
10
11
12
13
# File 'lib/yao/cli/lbaas/pool.rb', line 9

def list
  result = Yao::Resources::LoadBalancerPool.list

  pretty_output(Yao::Resources::Dumper::LoadBalancerPool.dump(result))
end

#remove(uuid) ⇒ Object



59
60
61
# File 'lib/yao/cli/lbaas/pool.rb', line 59

def remove(uuid)
  Yao::Resources::LoadBalancerPool.destroy(uuid)
end

#show(id_or_name) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/yao/cli/lbaas/pool.rb', line 16

def show(id_or_name)
  if is_uuid?(id_or_name)
    result = Yao::Resources::LoadBalancerPool.find id_or_name
  else
    result = Yao::Resources::LoadBalancerPool.list.select do |lb|
      lb.name == id_or_name
    end
  end
  pretty_output(Yao::Resources::Dumper::LoadBalancerPool.dump(result))
end

#update(uuid) ⇒ Object



52
53
54
55
56
# File 'lib/yao/cli/lbaas/pool.rb', line 52

def update(uuid)
  params = generate_params
  result = Yao::Resources::LoadBalancerPool.update(uuid, params)
  pretty_output(Yao::Resources::Dumper::LoadBalancerPool.dump(result))
end