yao-cli 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/yao/cli/base.rb +26 -3
- data/lib/yao/cli/lbaas/healthmonitor.rb +66 -0
- data/lib/yao/cli/lbaas/lb.rb +62 -0
- data/lib/yao/cli/lbaas/listener.rb +56 -0
- data/lib/yao/cli/lbaas/main.rb +24 -0
- data/lib/yao/cli/lbaas/pool.rb +66 -0
- data/lib/yao/cli/lbaas/pool_member.rb +59 -0
- data/lib/yao/cli/lbaas.rb +7 -0
- data/lib/yao/cli/main.rb +3 -0
- data/lib/yao/cli/version.rb +1 -1
- data/lib/yao/cli.rb +1 -0
- data/lib/yao/resources/dumper/base.rb +5 -1
- data/lib/yao/resources/dumper/loadbalancer.rb +12 -0
- data/lib/yao/resources/dumper/loadbalancer_healthmonitor.rb +11 -0
- data/lib/yao/resources/dumper/loadbalancer_listener.rb +12 -0
- data/lib/yao/resources/dumper/loadbalancer_pool.rb +10 -0
- data/lib/yao/resources/dumper/loadbalancer_pool_member.rb +12 -0
- data/lib/yao/resources/dumper/network.rb +10 -0
- data/lib/yao/resources/dumper/port.rb +11 -0
- data/lib/yao/resources/dumper/subnet.rb +11 -0
- data/lib/yao/resources/dumper/tenant.rb +9 -0
- data/lib/yao/resources/dumper.rb +9 -0
- data/yao-cli.gemspec +3 -2
- metadata +23 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e84220ba074d4aa608f1aa23c6d4299261cc3ef9
|
|
4
|
+
data.tar.gz: c0a6b11b769e37d5306ebb9589356faea0d0c789
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 224518d47b5bd9ee0345feaf525754a3ca4796398ba86a0bbad719661199c4b4bb113602cfcae43cad1f4dbd78e0db9f6f614e45b6b212f9bbe2009983148667
|
|
7
|
+
data.tar.gz: cffc22dc6054d4abda619c9ea08e953fca0eaf0aed0e4a77e638e98cd9b27a508b1bad7412872afec262fa4662bb9d0ce7e0e1e55cce1c8b12e2c08846a917ad
|
data/lib/yao/cli/base.rb
CHANGED
|
@@ -3,12 +3,13 @@ require 'yao/cli/formatter'
|
|
|
3
3
|
|
|
4
4
|
module Yao::Cli
|
|
5
5
|
class Base < Thor
|
|
6
|
-
class_option :format, :type => :string, :
|
|
7
|
-
:enum => Yao::Cli::Formatter.formats, :desc => "Output format"
|
|
6
|
+
class_option :format, :type => :string, :aliases => :f,
|
|
7
|
+
:enum => Yao::Cli::Formatter.formats, :desc => "Output format (default: json)"
|
|
8
8
|
|
|
9
9
|
private
|
|
10
10
|
def pretty_output(obj)
|
|
11
|
-
|
|
11
|
+
format = options[:format] || "json"
|
|
12
|
+
puts Yao::Cli::Formatter.get(format).dump(obj)
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
def is_uuid?(str)
|
|
@@ -16,6 +17,28 @@ module Yao::Cli
|
|
|
16
17
|
/^[\da-f]{8}-([\da-f]{4}-){3}[\da-f]{12}$/ === str
|
|
17
18
|
end
|
|
18
19
|
|
|
20
|
+
def generate_params
|
|
21
|
+
command = caller.first.split(' ')[1].delete('`').delete("'")
|
|
22
|
+
command_options = self.class.commands[command].options.map do |opt|
|
|
23
|
+
opt.first.to_s
|
|
24
|
+
end
|
|
19
25
|
|
|
26
|
+
command_options.map do |name|
|
|
27
|
+
if opt = options[name]
|
|
28
|
+
[name, opt]
|
|
29
|
+
end
|
|
30
|
+
end.compact.to_h
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
class << self
|
|
34
|
+
def banner(command, namespace = nil, subcommand = false)
|
|
35
|
+
if namespace.nil? && !subcommand
|
|
36
|
+
# yao lbaas lb help <command> のときにUsageがおかしくなるので対処
|
|
37
|
+
super(command, false, true)
|
|
38
|
+
else
|
|
39
|
+
super
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
20
43
|
end
|
|
21
44
|
end
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
require 'yao/cli/base'
|
|
2
|
+
|
|
3
|
+
module Yao::Cli::LBaaS
|
|
4
|
+
class HealthMonitor < Yao::Cli::Base
|
|
5
|
+
namespace "lbaas healthmonitor"
|
|
6
|
+
|
|
7
|
+
desc "list", "list health monitors"
|
|
8
|
+
def list
|
|
9
|
+
result = Yao::Resources::LoadBalancerHealthMonitor.list
|
|
10
|
+
|
|
11
|
+
pretty_output(Yao::Resources::Dumper::LoadBalancerHealthMonitor.dump(result))
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
desc "show <uuid or name>", "show health monitor details"
|
|
15
|
+
def show(id_or_name)
|
|
16
|
+
if is_uuid?(id_or_name)
|
|
17
|
+
result = Yao::Resources::LoadBalancerHealthMonitor.find id_or_name
|
|
18
|
+
else
|
|
19
|
+
result = Yao::Resources::LoadBalancerHealthMonitor.list.select do |lb|
|
|
20
|
+
lb.name == id_or_name
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
pretty_output(Yao::Resources::Dumper::LoadBalancerHealthMonitor.dump(result))
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
desc "create", "create health monitor"
|
|
27
|
+
option :name, :type => :string
|
|
28
|
+
option :delay, :type => :numeric, :required => true
|
|
29
|
+
option :expected_codes, :type => :string
|
|
30
|
+
option :http_method, :type => :string, :default => "GET", :enum => %w(CONNECT DELETE GET HEAD OPTIONS PATCH POST PUT TRACE)
|
|
31
|
+
option :max_retries, :type => :numeric, :required => true, :enum => (1..10).to_a
|
|
32
|
+
option :max_retries_down, :type => :numeric, :default => 3, :enum => (1..10).to_a
|
|
33
|
+
option :pool_id, :type => :string, :required => true
|
|
34
|
+
option :timeout, :type => :numeric, :required => true
|
|
35
|
+
option :type, :type => :string, :required => true, :enum => %w(HTTP HTTPS PING TCP TLS-HELLO)
|
|
36
|
+
option :url_path, :type => :string
|
|
37
|
+
def create
|
|
38
|
+
params = generate_params
|
|
39
|
+
result = Yao::Resources::LoadBalancerHealthMonitor.create params
|
|
40
|
+
|
|
41
|
+
# fix: すぐに出力するとvip_port_idがnullなのでエラーになる
|
|
42
|
+
#pretty_output(Yao::Resources::Dumper::LoadBalancerHealthMonitor.dump(result))
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
desc "update <uuid>", "update health monitor"
|
|
46
|
+
option :admin_state_up, :type => :boolean
|
|
47
|
+
option :delay, :type => :numeric, :required => true
|
|
48
|
+
option :expected_codes, :type => :string
|
|
49
|
+
option :http_method, :type => :string, :default => "GET", :enum => %w(CONNECT DELETE GET HEAD OPTIONS PATCH POST PUT TRACE)
|
|
50
|
+
option :max_retries, :type => :numeric, :required => true, :enum => (1..10).to_a
|
|
51
|
+
option :max_retries_down, :type => :numeric, :default => 3, :enum => (1..10).to_a
|
|
52
|
+
option :name, :type => :string
|
|
53
|
+
option :timeout, :type => :numeric, :required => true
|
|
54
|
+
option :url_path, :type => :string
|
|
55
|
+
def update(uuid)
|
|
56
|
+
params = generate_params
|
|
57
|
+
result = Yao::Resources::LoadBalancerHealthMonitor.update(uuid, params)
|
|
58
|
+
pretty_output(Yao::Resources::Dumper::LoadBalancerHealthMonitor.dump(result))
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
desc "remove <uuid>", "remove loadbalancer"
|
|
62
|
+
def remove(uuid)
|
|
63
|
+
Yao::Resources::LoadBalancerHealthMonitor.destroy(uuid)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
require 'yao/cli/base'
|
|
2
|
+
|
|
3
|
+
module Yao::Cli::LBaaS
|
|
4
|
+
class LB < Yao::Cli::Base
|
|
5
|
+
namespace "lbaas lb"
|
|
6
|
+
|
|
7
|
+
desc "list", "list loadbalancers"
|
|
8
|
+
def list
|
|
9
|
+
result = Yao::Resources::LoadBalancer.list
|
|
10
|
+
|
|
11
|
+
pretty_output(Yao::Resources::Dumper::LoadBalancer.dump(result))
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
desc "show <uuid or name>", "show loadbalancer details"
|
|
15
|
+
def show(id_or_name)
|
|
16
|
+
if is_uuid?(id_or_name)
|
|
17
|
+
result = Yao::Resources::LoadBalancer.find id_or_name
|
|
18
|
+
else
|
|
19
|
+
result = Yao::Resources::LoadBalancer.list.select do |lb|
|
|
20
|
+
lb.name == id_or_name
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
pretty_output(Yao::Resources::Dumper::LoadBalancer.dump(result))
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
desc "create", "create loadbalancer"
|
|
27
|
+
option :name, :type => :string
|
|
28
|
+
option :description, :type => :string
|
|
29
|
+
option :vip_network_id, :type => :string
|
|
30
|
+
option :vip_port_id, :type => :string
|
|
31
|
+
option :vip_subnet_id, :type => :string
|
|
32
|
+
def create
|
|
33
|
+
vip_options = %w(vip_network_id vip_port_id vip_subnet_id)
|
|
34
|
+
unless vip_options.map{|s| options[s]}.one?
|
|
35
|
+
puts "Error: One of vip_network_id, vip_port_id, or vip_subnet_id must be specified."
|
|
36
|
+
exit 1
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
params = generate_params
|
|
40
|
+
result = Yao::Resources::LoadBalancer.create params
|
|
41
|
+
|
|
42
|
+
# fix: すぐに出力するとvip_port_idがnullなのでエラーになる
|
|
43
|
+
#pretty_output(Yao::Resources::Dumper::LoadBalancer.dump(result))
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
desc "update <uuid>", "update loadbalancer"
|
|
47
|
+
option :admin_state_up, :type => :boolean
|
|
48
|
+
option :description, :type => :string
|
|
49
|
+
option :name, :type => :string
|
|
50
|
+
def update(uuid)
|
|
51
|
+
params = generate_params
|
|
52
|
+
result = Yao::Resources::LoadBalancer.update(uuid, params)
|
|
53
|
+
pretty_output(Yao::Resources::Dumper::LoadBalancer.dump(result))
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
desc "remove <uuid>", "remove loadbalancer"
|
|
57
|
+
option :cascade, :type => :boolean
|
|
58
|
+
def remove(uuid)
|
|
59
|
+
Yao::Resources::LoadBalancer.delete(uuid)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
require 'yao/cli/base'
|
|
2
|
+
|
|
3
|
+
module Yao::Cli::LBaaS
|
|
4
|
+
class Listener < Yao::Cli::Base
|
|
5
|
+
namespace "lbaas listener"
|
|
6
|
+
|
|
7
|
+
desc "list", "list listeners"
|
|
8
|
+
def list
|
|
9
|
+
result = Yao::Resources::LoadBalancerListener.list
|
|
10
|
+
|
|
11
|
+
pretty_output(Yao::Resources::Dumper::LoadBalancerListener.dump(result))
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
desc "show <uuid or name>", "show listener details"
|
|
15
|
+
def show(id_or_name)
|
|
16
|
+
if is_uuid?(id_or_name)
|
|
17
|
+
result = Yao::Resources::LoadBalancerListener.find id_or_name
|
|
18
|
+
else
|
|
19
|
+
result = Yao::Resources::LoadBalancerListener.list.select do |lb|
|
|
20
|
+
lb.name == id_or_name
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
pretty_output(Yao::Resources::Dumper::LoadBalancerListener.dump(result))
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
desc "create", "create listener"
|
|
27
|
+
option :name, :type => :string
|
|
28
|
+
option :description, :type => :string
|
|
29
|
+
option :loadbalancer_id,:type => :string, :required => true
|
|
30
|
+
option :protocol, :type => :string, :required => true, :enum => %w(HTTP HTTPS TCP TERMINATED_HTTPS)
|
|
31
|
+
option :protocol_port, :type => :numeric,:required => true
|
|
32
|
+
def create
|
|
33
|
+
params = generate_params
|
|
34
|
+
result = Yao::Resources::LoadBalancerListener.create params
|
|
35
|
+
|
|
36
|
+
# fix: すぐに出力するとcreate_atがnullでエラーになる。直るまでコメントアウト
|
|
37
|
+
#pretty_output(Yao::Resources::Dumper::LoadBalancerListener.dump(result))
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
desc "update <uuid>", "update listener"
|
|
41
|
+
option :admin_state_up, :type => :boolean
|
|
42
|
+
option :description, :type => :string
|
|
43
|
+
option :name, :type => :string
|
|
44
|
+
def update(uuid)
|
|
45
|
+
params = generate_params
|
|
46
|
+
result = Yao::Resources::LoadBalancerListener.update(uuid, params)
|
|
47
|
+
pretty_output(Yao::Resources::Dumper::LoadBalancerListener.dump(result))
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
desc "remove <uuid>", "remove listener"
|
|
51
|
+
option :cascade, :type => :boolean
|
|
52
|
+
def remove(uuid)
|
|
53
|
+
Yao::Resources::LoadBalancerListener.destroy(uuid)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'thor'
|
|
2
|
+
require 'yao/cli/base'
|
|
3
|
+
require 'yao/cli/lbaas/lb'
|
|
4
|
+
require 'yao/cli/lbaas/listener'
|
|
5
|
+
require 'yao/cli/lbaas/pool'
|
|
6
|
+
require 'yao/cli/lbaas/healthmonitor'
|
|
7
|
+
|
|
8
|
+
module Yao::Cli::LBaaS
|
|
9
|
+
class Main < Thor
|
|
10
|
+
namespace :lbaas
|
|
11
|
+
|
|
12
|
+
desc "lb", "loadbalancer subcommands"
|
|
13
|
+
subcommand("lb", Yao::Cli::LBaaS::LB)
|
|
14
|
+
|
|
15
|
+
desc "listener", "listener subcommands"
|
|
16
|
+
subcommand("listener", Yao::Cli::LBaaS::Listener)
|
|
17
|
+
|
|
18
|
+
desc "pool", "pool subcommands"
|
|
19
|
+
subcommand("pool", Yao::Cli::LBaaS::Pool)
|
|
20
|
+
|
|
21
|
+
desc "healthmonitor", "healthmonitor subcommands"
|
|
22
|
+
subcommand("healthmonitor", Yao::Cli::LBaaS::HealthMonitor)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
require 'yao/cli/base'
|
|
2
|
+
require 'yao/cli/lbaas/pool_member'
|
|
3
|
+
|
|
4
|
+
module Yao::Cli::LBaaS
|
|
5
|
+
class Pool < Yao::Cli::Base
|
|
6
|
+
namespace "lbaas pool"
|
|
7
|
+
|
|
8
|
+
desc "list", "list pools"
|
|
9
|
+
def list
|
|
10
|
+
result = Yao::Resources::LoadBalancerPool.list
|
|
11
|
+
|
|
12
|
+
pretty_output(Yao::Resources::Dumper::LoadBalancerPool.dump(result))
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
desc "show <uuid or name>", "show pool details"
|
|
16
|
+
def show(id_or_name)
|
|
17
|
+
if is_uuid?(id_or_name)
|
|
18
|
+
result = Yao::Resources::LoadBalancerPool.find id_or_name
|
|
19
|
+
else
|
|
20
|
+
result = Yao::Resources::LoadBalancerPool.list.select do |lb|
|
|
21
|
+
lb.name == id_or_name
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
pretty_output(Yao::Resources::Dumper::LoadBalancerPool.dump(result))
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
desc "create", "create pool"
|
|
28
|
+
option :name, :type => :string
|
|
29
|
+
option :description, :type => :string
|
|
30
|
+
option :lb_algorithm, :type => :string, :required => true, :enum => %w(LEAST_CONNECTIONS ROUND_ROBIN SOURCE_IP)
|
|
31
|
+
option :listener_id, :type => :string
|
|
32
|
+
option :loadbalancer_id, :type => :string
|
|
33
|
+
option :protocol, :type => :string, :required => true, :enum => %w(HTTP HTTPS PROXY TCP)
|
|
34
|
+
def create
|
|
35
|
+
unless [options[:listener_id], options[:loadbalancer_id]].one?
|
|
36
|
+
puts "Error: Either listener_id or loadbalancer_id must be specified."
|
|
37
|
+
exit 1
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
params = generate_params
|
|
41
|
+
result = Yao::Resources::LoadBalancerPool.create params
|
|
42
|
+
|
|
43
|
+
# fix: すぐに出力するとvip_port_idがnullなのでエラーになる
|
|
44
|
+
#pretty_output(Yao::Resources::Dumper::LoadBalancerPool.dump(result))
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
desc "update <uuid>", "update pool "
|
|
48
|
+
option :admin_state_up, :type => :boolean
|
|
49
|
+
option :description, :type => :string
|
|
50
|
+
option :name, :type => :string
|
|
51
|
+
option :lb_algorithm, :type => :string, :enum => %w(LEAST_CONNECTIONS ROUND_ROBIN SOURCE_IP)
|
|
52
|
+
def update(uuid)
|
|
53
|
+
params = generate_params
|
|
54
|
+
result = Yao::Resources::LoadBalancerPool.update(uuid, params)
|
|
55
|
+
pretty_output(Yao::Resources::Dumper::LoadBalancerPool.dump(result))
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
desc "remove <uuid>", "remove pool"
|
|
59
|
+
def remove(uuid)
|
|
60
|
+
Yao::Resources::LoadBalancerPool.destroy(uuid)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
desc "member", "pool member subcommands"
|
|
64
|
+
subcommand("member", Yao::Cli::LBaaS::PoolMember)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
require 'yao/cli/base'
|
|
2
|
+
|
|
3
|
+
module Yao::Cli::LBaaS
|
|
4
|
+
class PoolMember < Yao::Cli::Base
|
|
5
|
+
namespace "lbaas pool member"
|
|
6
|
+
|
|
7
|
+
desc "list <pool>", "list members"
|
|
8
|
+
def list(pool)
|
|
9
|
+
result = Yao::Resources::LoadBalancerPoolMember.list(Yao::Resources::LoadBalancerPool.find pool)
|
|
10
|
+
|
|
11
|
+
pretty_output(Yao::Resources::Dumper::LoadBalancerPoolMember.dump(result))
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
desc "show <pool> <uuid or name>", "show member details"
|
|
15
|
+
def show(pool, id_or_name)
|
|
16
|
+
if is_uuid?(id_or_name)
|
|
17
|
+
result = Yao::Resources::LoadBalancerPoolMember.find(Yao::Resources::LoadBalancerPool.new({"id" => pool}), id_or_name)
|
|
18
|
+
else
|
|
19
|
+
result = Yao::Resources::LoadBalancerPoolMember.list(Yao::Resources::LoadBalancerPool.new({"id" => pool})).select do |lb|
|
|
20
|
+
lb.name == id_or_name
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
pretty_output(Yao::Resources::Dumper::LoadBalancerPoolMember.dump(result))
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
desc "add <pool>", "add member to pool"
|
|
27
|
+
option :name, :type => :string
|
|
28
|
+
option :address, :type => :string, :required => true
|
|
29
|
+
option :monitor_address, :type => :string
|
|
30
|
+
option :monitor_port, :type => :numeric
|
|
31
|
+
option :protocol_port, :type => :numeric, :required => true
|
|
32
|
+
option :subnet_id, :type => :string
|
|
33
|
+
option :weight, :type => :numeric
|
|
34
|
+
def add(pool)
|
|
35
|
+
params = generate_params
|
|
36
|
+
result = Yao::Resources::LoadBalancerPoolMember.create(Yao::Resources::LoadBalancerPool.new({"id" => pool}), params)
|
|
37
|
+
|
|
38
|
+
# fix: すぐに出力するとvip_port_idがnullなのでエラーになる
|
|
39
|
+
#pretty_output(Yao::Resources::Dumper::LoadBalancerPoolMember.dump(result))
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
desc "update <pool> <uuid>", "update member"
|
|
43
|
+
option :admin_state_up, :type => :boolean
|
|
44
|
+
option :name, :type => :string
|
|
45
|
+
option :monitor_address, :type => :string
|
|
46
|
+
option :monitor_port, :type => :numeric
|
|
47
|
+
option :weight, :type => :numeric
|
|
48
|
+
def update(pool, uuid)
|
|
49
|
+
params = generate_params
|
|
50
|
+
result = Yao::Resources::LoadBalancerPoolMember.update(Yao::Resources::LoadBalancerPool.new({"id" => pool}), uuid, params)
|
|
51
|
+
pretty_output(Yao::Resources::Dumper::LoadBalancerPoolMember.dump(result))
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
desc "remove <pool> <uuid>", "remove member"
|
|
55
|
+
def remove(pool, uuid)
|
|
56
|
+
Yao::Resources::LoadBalancerPoolMember.destroy(Yao::Resources::LoadBalancerPool.new({"id" => pool}), uuid)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
data/lib/yao/cli/main.rb
CHANGED
data/lib/yao/cli/version.rb
CHANGED
data/lib/yao/cli.rb
CHANGED
|
@@ -37,7 +37,11 @@ module Yao::Resources::Dumper
|
|
|
37
37
|
result = Object.const_get("Yao::Resources::Dumper::#{m[1]}").dump(resource)
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
|
-
result
|
|
40
|
+
if result.instance_of?(Array)
|
|
41
|
+
result.size == 1 ? result.first : result
|
|
42
|
+
else
|
|
43
|
+
result
|
|
44
|
+
end
|
|
41
45
|
end
|
|
42
46
|
end
|
|
43
47
|
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module Yao::Resources::Dumper
|
|
2
|
+
class LoadBalancer < Base
|
|
3
|
+
|
|
4
|
+
# fix: updated_atがnilのときに落ちる。直るまで含めない
|
|
5
|
+
self.fields = %w(
|
|
6
|
+
id provider description admin_state_up provisioning_status
|
|
7
|
+
vip_address operationg_status name created_at
|
|
8
|
+
project vip_network vip_port vip_subnet listeners pools
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module Yao::Resources::Dumper
|
|
2
|
+
class LoadBalancerHealthMonitor < Base
|
|
3
|
+
|
|
4
|
+
self.fields = %w(
|
|
5
|
+
id name admin_state_up provisioning_status delay expected_codes max_retries
|
|
6
|
+
http_method timeout max_retries_down url_path type operating_status
|
|
7
|
+
pools
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module Yao::Resources::Dumper
|
|
2
|
+
class LoadBalancerListener < Base
|
|
3
|
+
|
|
4
|
+
self.fields = %w(
|
|
5
|
+
id description admin_state_up protocol protocol_port provisioning_status
|
|
6
|
+
default_tls_container_ref insert_headers operating_status sni_container_refs
|
|
7
|
+
l7policies name created_at updated_at
|
|
8
|
+
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module Yao::Resources::Dumper
|
|
2
|
+
class LoadBalancerPoolMember < Base
|
|
3
|
+
|
|
4
|
+
# fix: subnetがnilのときに落ちる。直るまで含めない
|
|
5
|
+
self.fields = %w(
|
|
6
|
+
id monitor_port name weight admin_state_up provisioning_status
|
|
7
|
+
monitor_address address protocol_port operating_status
|
|
8
|
+
project
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
end
|
|
12
|
+
end
|
data/lib/yao/resources/dumper.rb
CHANGED
|
@@ -4,6 +4,15 @@ require 'yao/resources/dumper/base'
|
|
|
4
4
|
require 'yao/resources/dumper/server'
|
|
5
5
|
require 'yao/resources/dumper/flavor'
|
|
6
6
|
require 'yao/resources/dumper/image'
|
|
7
|
+
require 'yao/resources/dumper/tenant'
|
|
8
|
+
require 'yao/resources/dumper/network'
|
|
9
|
+
require 'yao/resources/dumper/subnet'
|
|
10
|
+
require 'yao/resources/dumper/port'
|
|
11
|
+
require 'yao/resources/dumper/loadbalancer'
|
|
12
|
+
require 'yao/resources/dumper/loadbalancer_pool'
|
|
13
|
+
require 'yao/resources/dumper/loadbalancer_pool_member'
|
|
14
|
+
require 'yao/resources/dumper/loadbalancer_listener'
|
|
15
|
+
require 'yao/resources/dumper/loadbalancer_healthmonitor'
|
|
7
16
|
|
|
8
17
|
module Yao::Resources
|
|
9
18
|
module Dumper
|
data/yao-cli.gemspec
CHANGED
|
@@ -7,11 +7,12 @@ Gem::Specification.new do |spec|
|
|
|
7
7
|
spec.name = "yao-cli"
|
|
8
8
|
spec.version = Yao::Cli::VERSION
|
|
9
9
|
spec.authors = ["Yuki Koya"]
|
|
10
|
-
spec.email = ["
|
|
10
|
+
spec.email = ["buty4649@gmail.com"]
|
|
11
11
|
|
|
12
12
|
spec.summary = %q{CLI tool of yao.}
|
|
13
13
|
spec.description = %q{CLI tool of yao.}
|
|
14
14
|
spec.homepage = "https://github.com/buty4649/yao-cli"
|
|
15
|
+
spec.license = "MIT"
|
|
15
16
|
|
|
16
17
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
17
18
|
f.match(%r{^(test|spec|features)/})
|
|
@@ -20,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
|
20
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
21
22
|
spec.require_paths = ["lib"]
|
|
22
23
|
|
|
23
|
-
spec.add_dependency "yao", ">= 0.3.
|
|
24
|
+
spec.add_dependency "yao", ">= 0.3.6"
|
|
24
25
|
spec.add_dependency "thor"
|
|
25
26
|
|
|
26
27
|
spec.add_development_dependency "bundler", "~> 1.15"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yao-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yuki Koya
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-08-
|
|
11
|
+
date: 2017-08-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: yao
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.3.
|
|
19
|
+
version: 0.3.6
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 0.3.
|
|
26
|
+
version: 0.3.6
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: thor
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -82,7 +82,7 @@ dependencies:
|
|
|
82
82
|
version: '3.0'
|
|
83
83
|
description: CLI tool of yao.
|
|
84
84
|
email:
|
|
85
|
-
-
|
|
85
|
+
- buty4649@gmail.com
|
|
86
86
|
executables: []
|
|
87
87
|
extensions: []
|
|
88
88
|
extra_rdoc_files: []
|
|
@@ -102,6 +102,13 @@ files:
|
|
|
102
102
|
- lib/yao/cli/formatter.rb
|
|
103
103
|
- lib/yao/cli/formatter/json.rb
|
|
104
104
|
- lib/yao/cli/formatter/yaml.rb
|
|
105
|
+
- lib/yao/cli/lbaas.rb
|
|
106
|
+
- lib/yao/cli/lbaas/healthmonitor.rb
|
|
107
|
+
- lib/yao/cli/lbaas/lb.rb
|
|
108
|
+
- lib/yao/cli/lbaas/listener.rb
|
|
109
|
+
- lib/yao/cli/lbaas/main.rb
|
|
110
|
+
- lib/yao/cli/lbaas/pool.rb
|
|
111
|
+
- lib/yao/cli/lbaas/pool_member.rb
|
|
105
112
|
- lib/yao/cli/main.rb
|
|
106
113
|
- lib/yao/cli/server.rb
|
|
107
114
|
- lib/yao/cli/version.rb
|
|
@@ -109,11 +116,21 @@ files:
|
|
|
109
116
|
- lib/yao/resources/dumper/base.rb
|
|
110
117
|
- lib/yao/resources/dumper/flavor.rb
|
|
111
118
|
- lib/yao/resources/dumper/image.rb
|
|
119
|
+
- lib/yao/resources/dumper/loadbalancer.rb
|
|
120
|
+
- lib/yao/resources/dumper/loadbalancer_healthmonitor.rb
|
|
121
|
+
- lib/yao/resources/dumper/loadbalancer_listener.rb
|
|
122
|
+
- lib/yao/resources/dumper/loadbalancer_pool.rb
|
|
123
|
+
- lib/yao/resources/dumper/loadbalancer_pool_member.rb
|
|
124
|
+
- lib/yao/resources/dumper/network.rb
|
|
125
|
+
- lib/yao/resources/dumper/port.rb
|
|
112
126
|
- lib/yao/resources/dumper/security_group.rb
|
|
113
127
|
- lib/yao/resources/dumper/server.rb
|
|
128
|
+
- lib/yao/resources/dumper/subnet.rb
|
|
129
|
+
- lib/yao/resources/dumper/tenant.rb
|
|
114
130
|
- yao-cli.gemspec
|
|
115
131
|
homepage: https://github.com/buty4649/yao-cli
|
|
116
|
-
licenses:
|
|
132
|
+
licenses:
|
|
133
|
+
- MIT
|
|
117
134
|
metadata: {}
|
|
118
135
|
post_install_message:
|
|
119
136
|
rdoc_options: []
|