yao 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/yao/resources/aggregates.rb +0 -8
- data/lib/yao/resources/base.rb +5 -2
- data/lib/yao/resources/hypervisor.rb +5 -1
- data/lib/yao/resources/loadbalancer.rb +0 -10
- data/lib/yao/resources/loadbalancer_healthmonitor.rb +0 -9
- data/lib/yao/resources/loadbalancer_listener.rb +0 -9
- data/lib/yao/resources/loadbalancer_pool.rb +0 -9
- data/lib/yao/resources/loadbalancer_pool_member.rb +0 -9
- data/lib/yao/version.rb +1 -1
- data/test/yao/resources/test_aggregates.rb +4 -3
- data/test/yao/resources/test_base.rb +15 -0
- data/test/yao/resources/test_hypervisor.rb +12 -0
- data/test/yao/resources/test_loadbalancer.rb +3 -3
- data/test/yao/resources/test_loadbalancer_healthmonitor.rb +5 -5
- data/test/yao/resources/test_loadbalancer_listener.rb +3 -3
- data/test/yao/resources/test_loadbalancer_pool.rb +3 -3
- data/test/yao/resources/test_loadbalancer_pool_member.rb +5 -5
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d43c067685907e1e430dc8e003d9817fdf16f260
|
4
|
+
data.tar.gz: 80d85a73f095c4bcb7f4805cc7aa23e548c77493
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3f5118243d9ed662b34e981dcd15f4889475eeab02b5cfcea86af12e5afe677b873f538cf4e628ca9546ca0b03fc10ad49e01df0f5a9d00194d579b1c683d11
|
7
|
+
data.tar.gz: 499c01244f7d5cda681ba5f0ad0baf68bbea8f9784d14a01630ef3d4cc8668ae2941509bf9de32bed2fa988c47861d8c667855cbc73150627f93a9120769389a
|
@@ -4,14 +4,6 @@ module Yao::Resources
|
|
4
4
|
class Aggregates < Base
|
5
5
|
friendly_attributes :availability_zone, :deleted, :hosts, :metadata, :name
|
6
6
|
|
7
|
-
def created_at
|
8
|
-
Date.parse(self["created_at"])
|
9
|
-
end
|
10
|
-
|
11
|
-
def updated_at
|
12
|
-
Date.parse(self["updated_at"]) if self["updated_at"]
|
13
|
-
end
|
14
|
-
|
15
7
|
def deleted_at
|
16
8
|
Date.parse(self["deleted_at"]) if self["deleted_at"]
|
17
9
|
end
|
data/lib/yao/resources/base.rb
CHANGED
@@ -6,6 +6,9 @@ module Yao::Resources
|
|
6
6
|
def self.friendly_attributes(*names)
|
7
7
|
names.map(&:to_s).each do |name|
|
8
8
|
define_method(name) do
|
9
|
+
if !@data.key?(name) && id
|
10
|
+
@data = self.class.get(id)
|
11
|
+
end
|
9
12
|
self[name]
|
10
13
|
end
|
11
14
|
end
|
@@ -53,13 +56,13 @@ module Yao::Resources
|
|
53
56
|
end
|
54
57
|
|
55
58
|
def created
|
56
|
-
if date = self["created"]
|
59
|
+
if date = self["created"] || self["created_at"]
|
57
60
|
Time.parse(date)
|
58
61
|
end
|
59
62
|
end
|
60
63
|
|
61
64
|
def updated
|
62
|
-
if date = self["updated"]
|
65
|
+
if date = self["updated"] || self["updated_at"]
|
63
66
|
Time.parse(date)
|
64
67
|
end
|
65
68
|
end
|
@@ -3,12 +3,16 @@ module Yao::Resources
|
|
3
3
|
friendly_attributes :hypervisor_hostname, :hypervisor_type, :hypervisor_version, :running_vms, :current_workload,
|
4
4
|
:vcpus, :vcpus_used,
|
5
5
|
:memory_mb, :memory_mb_used, :free_disk_gb,
|
6
|
-
:local_gb, :local_gb_used, :free_disk_gb
|
6
|
+
:local_gb, :local_gb_used, :free_disk_gb, :status
|
7
7
|
|
8
8
|
def cpu_info
|
9
9
|
JSON.parse self["cpu_info"]
|
10
10
|
end
|
11
11
|
|
12
|
+
def enabled?
|
13
|
+
self['status'] == 'enabled'
|
14
|
+
end
|
15
|
+
|
12
16
|
alias hostname hypervisor_hostname
|
13
17
|
alias type hypervisor_hostname
|
14
18
|
alias version hypervisor_version
|
@@ -1,19 +1,9 @@
|
|
1
|
-
require 'date'
|
2
|
-
|
3
1
|
module Yao::Resources
|
4
2
|
class LoadBalancer < Base
|
5
3
|
friendly_attributes :provider, :description, :admin_state_up, :provisioning_status,
|
6
4
|
:pools, :vip_address,
|
7
5
|
:operationg_status, :name
|
8
6
|
|
9
|
-
def created_at
|
10
|
-
Date.parse(self["created_at"])
|
11
|
-
end
|
12
|
-
|
13
|
-
def updated_at
|
14
|
-
Date.parse(self["updated_at"])
|
15
|
-
end
|
16
|
-
|
17
7
|
def project
|
18
8
|
Yao::Tenant.find self["project_id"]
|
19
9
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'date'
|
2
1
|
module Yao::Resources
|
3
2
|
class LoadBalancerHealthMonitor < Base
|
4
3
|
friendly_attributes :name, :admin_state_up, :provisioning_status,
|
@@ -12,14 +11,6 @@ module Yao::Resources
|
|
12
11
|
end
|
13
12
|
end
|
14
13
|
|
15
|
-
def created_at
|
16
|
-
Date.parse(self["created_at"])
|
17
|
-
end
|
18
|
-
|
19
|
-
def updated_at
|
20
|
-
Date.parse(self["updated_at"])
|
21
|
-
end
|
22
|
-
|
23
14
|
self.service = "load-balancer"
|
24
15
|
self.api_version = "v2.0"
|
25
16
|
self.resource_name = "healthmonitor"
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'date'
|
2
1
|
module Yao::Resources
|
3
2
|
class LoadBalancerListener < Base
|
4
3
|
friendly_attributes :description, :admin_state_up,
|
@@ -17,14 +16,6 @@ module Yao::Resources
|
|
17
16
|
end
|
18
17
|
end
|
19
18
|
|
20
|
-
def created_at
|
21
|
-
Date.parse(self["created_at"])
|
22
|
-
end
|
23
|
-
|
24
|
-
def updated_at
|
25
|
-
Date.parse(self["updated_at"])
|
26
|
-
end
|
27
|
-
|
28
19
|
def default_pool
|
29
20
|
Yao::LoadBalancerPool.find self["default_pool_id"]
|
30
21
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'date'
|
2
1
|
module Yao::Resources
|
3
2
|
class LoadBalancerPool < Base
|
4
3
|
friendly_attributes :lb_algorithm, :protocol, :description,
|
@@ -11,14 +10,6 @@ module Yao::Resources
|
|
11
10
|
end
|
12
11
|
end
|
13
12
|
|
14
|
-
def created_at
|
15
|
-
Date.parse(self["created_at"])
|
16
|
-
end
|
17
|
-
|
18
|
-
def updated_at
|
19
|
-
Date.parse(self["updated_at"])
|
20
|
-
end
|
21
|
-
|
22
13
|
def listeners
|
23
14
|
self["listeners"].map do |listener|
|
24
15
|
Yao::LoadBalancerListener.find listener["id"]
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'date'
|
2
1
|
module Yao::Resources
|
3
2
|
class LoadBalancerPoolMember < Base
|
4
3
|
friendly_attributes :monitor_port, :name, :weight,
|
@@ -14,14 +13,6 @@ module Yao::Resources
|
|
14
13
|
Yao::Subnet.find self["subnet_id"]
|
15
14
|
end
|
16
15
|
|
17
|
-
def created_at
|
18
|
-
Date.parse(self["created_at"])
|
19
|
-
end
|
20
|
-
|
21
|
-
def updated_at
|
22
|
-
Date.parse(self["updated_at"])
|
23
|
-
end
|
24
|
-
|
25
16
|
self.service = "load-balancer"
|
26
17
|
self.api_version = "v2.0"
|
27
18
|
self.resource_name = "member"
|
data/lib/yao/version.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require "time"
|
1
2
|
require "date"
|
2
3
|
|
3
4
|
class TestRole < Test::Unit::TestCase
|
@@ -19,8 +20,8 @@ class TestRole < Test::Unit::TestCase
|
|
19
20
|
assert_equal(aggregates.hosts, ["host1", "host2"])
|
20
21
|
assert_equal(aggregates.metadata, {"foo" => "bar"})
|
21
22
|
assert_equal(aggregates.name, "nova")
|
22
|
-
assert_equal(aggregates.
|
23
|
-
assert_equal(aggregates.
|
24
|
-
assert_equal(aggregates.
|
23
|
+
assert_equal(aggregates.created, Time.parse("2015-08-27T09:49:58-05:00"))
|
24
|
+
assert_equal(aggregates.updated, Time.parse("2015-08-27T09:49:58-05:00"))
|
25
|
+
assert_equal(aggregates.deleted_at, Date.parse("2015-08-27T09:49:58-05:00"))
|
25
26
|
end
|
26
27
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class TestResourceBase < Test::Unit::TestCase
|
2
|
+
def setup
|
3
|
+
stub(Yao::Resources::Base).get { Yao::Resources::Base.new({"id" => "foor", "name" => "bar"}) }
|
4
|
+
end
|
5
|
+
|
6
|
+
def test_friendly_attributes
|
7
|
+
base = Yao::Resources::Base.new({"id" => "foor"})
|
8
|
+
base.class.friendly_attributes(:name)
|
9
|
+
assert_equal(base.name, "bar")
|
10
|
+
|
11
|
+
base = Yao::Resources::Base.new({"name" => "bar"})
|
12
|
+
base.class.friendly_attributes(:name)
|
13
|
+
assert_equal(base.name, "bar")
|
14
|
+
end
|
15
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require "
|
1
|
+
require "time"
|
2
2
|
|
3
3
|
class TestRole < Test::Unit::TestCase
|
4
4
|
def test_loadbalancer
|
@@ -22,7 +22,7 @@ class TestRole < Test::Unit::TestCase
|
|
22
22
|
assert_equal(lb.vip_address, "198.51.100.1")
|
23
23
|
assert_equal(lb.operationg_status, "ONLINE")
|
24
24
|
assert_equal(lb.name, "greate loadbalancer")
|
25
|
-
assert_equal(lb.
|
26
|
-
assert_equal(lb.
|
25
|
+
assert_equal(lb.created, Time.parse("2017-02-28T00:41:44"))
|
26
|
+
assert_equal(lb.updated, Time.parse("2017-02-28T00:43:30"))
|
27
27
|
end
|
28
28
|
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
require "
|
1
|
+
require "time"
|
2
2
|
|
3
3
|
class TestRole < Test::Unit::TestCase
|
4
4
|
def test_loadbalancer_healtchmonitor
|
5
5
|
params = {
|
6
6
|
"name" => "super-pool-health-monitor",
|
7
7
|
"admin_state_up" => true,
|
8
|
-
"created_at" => "2017-05-11T23
|
8
|
+
"created_at" => "2017-05-11T23:53:47",
|
9
9
|
"provisioning_status" => "ACTIVE",
|
10
|
-
"updated_at" => "2017-05-11T23
|
10
|
+
"updated_at" => "2017-05-11T23:53:47",
|
11
11
|
"delay" => 10,
|
12
12
|
"expected_codes" => "200",
|
13
13
|
"max_retries" => 1,
|
@@ -22,9 +22,9 @@ class TestRole < Test::Unit::TestCase
|
|
22
22
|
healthmonitor = Yao::LoadBalancerHealthMonitor.new(params)
|
23
23
|
assert_equal(healthmonitor.name, "super-pool-health-monitor")
|
24
24
|
assert_equal(healthmonitor.admin_state_up, true)
|
25
|
-
assert_equal(healthmonitor.
|
25
|
+
assert_equal(healthmonitor.created, Time.parse("2017-05-11T23:53:47"))
|
26
26
|
assert_equal(healthmonitor.provisioning_status, "ACTIVE")
|
27
|
-
assert_equal(healthmonitor.
|
27
|
+
assert_equal(healthmonitor.updated, Time.parse("2017-05-11T23:53:47"))
|
28
28
|
assert_equal(healthmonitor.delay, 10)
|
29
29
|
assert_equal(healthmonitor.expected_codes, "200")
|
30
30
|
assert_equal(healthmonitor.max_retries, 1)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require "
|
1
|
+
require "time"
|
2
2
|
|
3
3
|
class TestRole < Test::Unit::TestCase
|
4
4
|
def test_loadbalancer_listener
|
@@ -40,8 +40,8 @@ class TestRole < Test::Unit::TestCase
|
|
40
40
|
"X-Forwarded-Port" => "true",
|
41
41
|
"X-Forwarded-For" => "true"
|
42
42
|
})
|
43
|
-
assert_equal(listener.
|
44
|
-
assert_equal(listener.
|
43
|
+
assert_equal(listener.created, Time.parse("2017-02-28T00:42:44"))
|
44
|
+
assert_equal(listener.updated, Time.parse("2017-02-28T00:44:30"))
|
45
45
|
assert_equal(listener.operating_status, "ONLINE")
|
46
46
|
assert_equal(listener.sni_container_refs, [
|
47
47
|
"http://198.51.100.10:9311/v1/containers/a570068c-d295-4780-91d4-3046a325db51",
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require "
|
1
|
+
require "time"
|
2
2
|
|
3
3
|
class TestRole < Test::Unit::TestCase
|
4
4
|
def test_loadbalancer_pool
|
@@ -23,9 +23,9 @@ class TestRole < Test::Unit::TestCase
|
|
23
23
|
assert_equal(pool.protocol, "HTTP")
|
24
24
|
assert_equal(pool.description, "My round robin pool")
|
25
25
|
assert_equal(pool.admin_state_up, true)
|
26
|
-
assert_equal(pool.
|
26
|
+
assert_equal(pool.created, Time.parse("2017-04-13T18:14:44"))
|
27
27
|
assert_equal(pool.provisioning_status, "ACTIVE")
|
28
|
-
assert_equal(pool.
|
28
|
+
assert_equal(pool.updated, Time.parse("2017-04-13T23:08:12"))
|
29
29
|
assert_equal(pool.session_persistence, {
|
30
30
|
"cookie_name" => nil,
|
31
31
|
"type" => "SOURCE_IP"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require "
|
1
|
+
require "time"
|
2
2
|
|
3
3
|
class TestRole < Test::Unit::TestCase
|
4
4
|
def test_loadbalancer_pool_member
|
@@ -7,10 +7,10 @@ class TestRole < Test::Unit::TestCase
|
|
7
7
|
"name" => "web-server-1",
|
8
8
|
"weight" => 20,
|
9
9
|
"admin_state_up" => true,
|
10
|
-
"created_at" => "2017-05-11T17
|
10
|
+
"created_at" => "2017-05-11T17:21:34",
|
11
11
|
"provisioning_status" => "ACTIVE",
|
12
12
|
"monitor_address" => nil,
|
13
|
-
"updated_at" => "2017-05-11T17
|
13
|
+
"updated_at" => "2017-05-11T17:21:37",
|
14
14
|
"address" => "192.0.2.16",
|
15
15
|
"protocol_port" => 80,
|
16
16
|
"operating_status" => "NO_MONITOR"
|
@@ -21,10 +21,10 @@ class TestRole < Test::Unit::TestCase
|
|
21
21
|
assert_equal(member.name, "web-server-1")
|
22
22
|
assert_equal(member.weight, 20)
|
23
23
|
assert_equal(member.admin_state_up, true)
|
24
|
-
assert_equal(member.
|
24
|
+
assert_equal(member.created, Time.parse("2017-05-11T17:21:34"))
|
25
25
|
assert_equal(member.provisioning_status, "ACTIVE")
|
26
26
|
assert_equal(member.monitor_address, nil)
|
27
|
-
assert_equal(member.
|
27
|
+
assert_equal(member.updated, Time.parse("2017-05-11T17:21:37"))
|
28
28
|
assert_equal(member.address, "192.0.2.16")
|
29
29
|
assert_equal(member.protocol_port, 80)
|
30
30
|
assert_equal(member.operating_status, "NO_MONITOR")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yao
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Uchio, KONDO
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -216,6 +216,8 @@ files:
|
|
216
216
|
- test/fixtures/dummy.pem
|
217
217
|
- test/support/auth_stub.rb
|
218
218
|
- test/yao/resources/test_aggregates.rb
|
219
|
+
- test/yao/resources/test_base.rb
|
220
|
+
- test/yao/resources/test_hypervisor.rb
|
219
221
|
- test/yao/resources/test_loadbalancer.rb
|
220
222
|
- test/yao/resources/test_loadbalancer_healthmonitor.rb
|
221
223
|
- test/yao/resources/test_loadbalancer_listener.rb
|
@@ -254,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
254
256
|
version: '0'
|
255
257
|
requirements: []
|
256
258
|
rubyforge_project:
|
257
|
-
rubygems_version: 2.
|
259
|
+
rubygems_version: 2.4.5
|
258
260
|
signing_key:
|
259
261
|
specification_version: 4
|
260
262
|
summary: Yet Another OpenStack API Wrapper that rocks!!
|
@@ -264,6 +266,8 @@ test_files:
|
|
264
266
|
- test/fixtures/dummy.pem
|
265
267
|
- test/support/auth_stub.rb
|
266
268
|
- test/yao/resources/test_aggregates.rb
|
269
|
+
- test/yao/resources/test_base.rb
|
270
|
+
- test/yao/resources/test_hypervisor.rb
|
267
271
|
- test/yao/resources/test_loadbalancer.rb
|
268
272
|
- test/yao/resources/test_loadbalancer_healthmonitor.rb
|
269
273
|
- test/yao/resources/test_loadbalancer_listener.rb
|