Class: Yao::Cli::LBaaS::PoolMember

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

Instance Method Summary collapse

Methods inherited from Base

banner

Instance Method Details

#add(pool) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/yao/cli/lbaas/pool_member.rb', line 34

def add(pool)
  params = generate_params
  result = Yao::Resources::LoadBalancerPoolMember.create(Yao::Resources::LoadBalancerPool.new({"id" => pool}), params)

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

#list(pool) ⇒ Object



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

def list(pool)
  result = Yao::Resources::LoadBalancerPoolMember.list(Yao::Resources::LoadBalancerPool.find pool)

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

#remove(pool, uuid) ⇒ Object



55
56
57
# File 'lib/yao/cli/lbaas/pool_member.rb', line 55

def remove(pool, uuid)
  Yao::Resources::LoadBalancerPoolMember.destroy(Yao::Resources::LoadBalancerPool.new({"id" => pool}), uuid)
end

#show(pool, id_or_name) ⇒ Object



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

def show(pool, id_or_name)
  if is_uuid?(id_or_name)
    result = Yao::Resources::LoadBalancerPoolMember.find(Yao::Resources::LoadBalancerPool.new({"id" => pool}), id_or_name)
  else
    result = Yao::Resources::LoadBalancerPoolMember.list(Yao::Resources::LoadBalancerPool.new({"id" => pool})).select do |lb|
      lb.name == id_or_name
    end
  end
  pretty_output(Yao::Resources::Dumper::LoadBalancerPoolMember.dump(result))
end

#update(pool, uuid) ⇒ Object



48
49
50
51
52
# File 'lib/yao/cli/lbaas/pool_member.rb', line 48

def update(pool, uuid)
  params = generate_params
  result = Yao::Resources::LoadBalancerPoolMember.update(Yao::Resources::LoadBalancerPool.new({"id" => pool}), uuid, params)
  pretty_output(Yao::Resources::Dumper::LoadBalancerPoolMember.dump(result))
end