yao 0.15.0 → 0.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rubocop.yml +2 -2
- data/.github/workflows/ubuntu-rvm.yml +1 -1
- data/.github/workflows/ubuntu.yml +2 -2
- data/lib/yao/error.rb +1 -1
- data/lib/yao/resources/base.rb +17 -5
- data/lib/yao/resources/flavor.rb +10 -0
- data/lib/yao/resources/floating_ip.rb +26 -5
- data/lib/yao/resources/loadbalancer_pool.rb +10 -20
- data/lib/yao/resources/meter.rb +1 -1
- data/lib/yao/resources/network.rb +1 -1
- data/lib/yao/resources/old_sample.rb +1 -1
- data/lib/yao/resources/port.rb +17 -1
- data/lib/yao/resources/{tenant_associationable.rb → project_associationable.rb} +5 -5
- data/lib/yao/resources/resource.rb +1 -1
- data/lib/yao/resources/restfully_accessible.rb +11 -6
- data/lib/yao/resources/role_assignment.rb +2 -2
- data/lib/yao/resources/router.rb +19 -10
- data/lib/yao/resources/security_group.rb +1 -1
- data/lib/yao/resources/server.rb +6 -1
- data/lib/yao/resources/subnet.rb +1 -1
- data/lib/yao/resources/volume.rb +2 -0
- data/lib/yao/resources.rb +1 -1
- data/lib/yao/version.rb +1 -1
- data/test/yao/resources/test_base.rb +21 -0
- data/test/yao/resources/test_flavor.rb +67 -33
- data/test/yao/resources/test_floating_ip.rb +96 -5
- data/test/yao/resources/test_loadbalancer_pool.rb +146 -1
- data/test/yao/resources/test_meter.rb +5 -5
- data/test/yao/resources/test_network.rb +6 -6
- data/test/yao/resources/test_port.rb +54 -6
- data/test/yao/resources/test_restfully_accessible.rb +87 -5
- data/test/yao/resources/test_role_assignment.rb +3 -3
- data/test/yao/resources/test_router.rb +33 -12
- data/test/yao/resources/test_security_group.rb +5 -5
- data/test/yao/resources/test_server.rb +52 -6
- data/test/yao/resources/test_subnet.rb +6 -6
- data/test/yao/resources/test_volume.rb +21 -0
- data/yao.gemspec +1 -1
- metadata +6 -6
@@ -25,12 +25,12 @@ class TestSecurityGroup < TestYaoResource
|
|
25
25
|
|
26
26
|
def test_sg_to_tenant
|
27
27
|
|
28
|
-
stub = stub_request(:get, "https://example.com:12345/
|
28
|
+
stub = stub_request(:get, "https://example.com:12345/projects/0123456789abcdef0123456789abcdef")
|
29
29
|
.to_return(
|
30
30
|
status: 200,
|
31
31
|
body: <<-JSON,
|
32
32
|
{
|
33
|
-
"
|
33
|
+
"project": {
|
34
34
|
"id": "0123456789abcdef0123456789abcdef"
|
35
35
|
}
|
36
36
|
}
|
@@ -38,9 +38,9 @@ class TestSecurityGroup < TestYaoResource
|
|
38
38
|
headers: {'Content-Type' => 'application/json'}
|
39
39
|
)
|
40
40
|
|
41
|
-
sg = Yao::SecurityGroup.new('
|
42
|
-
assert_instance_of(Yao::
|
43
|
-
assert_equal('0123456789abcdef0123456789abcdef', sg.
|
41
|
+
sg = Yao::SecurityGroup.new('project_id' => '0123456789abcdef0123456789abcdef')
|
42
|
+
assert_instance_of(Yao::Project, sg.project)
|
43
|
+
assert_equal('0123456789abcdef0123456789abcdef', sg.project.id)
|
44
44
|
|
45
45
|
assert_requested(stub)
|
46
46
|
end
|
@@ -206,14 +206,14 @@ class TestServer < TestYaoResource
|
|
206
206
|
assert_equal(Yao::Server.method(:list), Yao::Server.method(:list_detail))
|
207
207
|
end
|
208
208
|
|
209
|
-
def
|
209
|
+
def test_project
|
210
210
|
|
211
|
-
stub = stub_request(:get, "https://example.com:12345/
|
211
|
+
stub = stub_request(:get, "https://example.com:12345/projects/0123456789abcdef0123456789abcdef")
|
212
212
|
.to_return(
|
213
213
|
status: 200,
|
214
214
|
body: <<-JSON,
|
215
215
|
{
|
216
|
-
"
|
216
|
+
"project": {
|
217
217
|
"id": "0123456789abcdef0123456789abcdef"
|
218
218
|
}
|
219
219
|
}
|
@@ -221,10 +221,56 @@ class TestServer < TestYaoResource
|
|
221
221
|
headers: {'Content-Type' => 'application/json'}
|
222
222
|
)
|
223
223
|
|
224
|
-
server = Yao::Server.new('
|
225
|
-
assert_instance_of(Yao::
|
226
|
-
assert_equal('0123456789abcdef0123456789abcdef', server.
|
224
|
+
server = Yao::Server.new('project_id' => '0123456789abcdef0123456789abcdef')
|
225
|
+
assert_instance_of(Yao::Project, server.project)
|
226
|
+
assert_equal('0123456789abcdef0123456789abcdef', server.project.id)
|
227
227
|
|
228
228
|
assert_requested(stub)
|
229
229
|
end
|
230
|
+
|
231
|
+
def test_ports
|
232
|
+
|
233
|
+
stub = stub_request(:get, "https://example.com:12345/ports?device_id")
|
234
|
+
.to_return(
|
235
|
+
status: 200,
|
236
|
+
body: <<-JSON,
|
237
|
+
{
|
238
|
+
"ports": [{
|
239
|
+
"id": "0123456789abcdef0123456789abcdef"
|
240
|
+
}]
|
241
|
+
}
|
242
|
+
JSON
|
243
|
+
headers: {'Content-Type' => 'application/json'}
|
244
|
+
)
|
245
|
+
|
246
|
+
server = Yao::Server.new('project_id' => '0123456789abcdef0123456789abcdef')
|
247
|
+
ports = server.ports
|
248
|
+
|
249
|
+
assert_instance_of(Array, ports)
|
250
|
+
assert_instance_of(Yao::Port, ports.first)
|
251
|
+
assert_equal('0123456789abcdef0123456789abcdef', ports.first.id)
|
252
|
+
|
253
|
+
assert_requested(stub)
|
254
|
+
end
|
255
|
+
|
256
|
+
def test_ports_empty
|
257
|
+
|
258
|
+
stub = stub_request(:get, "https://example.com:12345/ports?device_id")
|
259
|
+
.to_return(
|
260
|
+
status: 200,
|
261
|
+
body: <<-JSON,
|
262
|
+
{
|
263
|
+
"ports": []
|
264
|
+
}
|
265
|
+
JSON
|
266
|
+
headers: {'Content-Type' => 'application/json'}
|
267
|
+
)
|
268
|
+
|
269
|
+
server = Yao::Server.new('project_id' => '0123456789abcdef0123456789abcdef')
|
270
|
+
ports = server.ports
|
271
|
+
|
272
|
+
assert_instance_of(Array, ports)
|
273
|
+
assert_equal(0, ports.size)
|
274
|
+
assert_requested(stub)
|
275
|
+
end
|
230
276
|
end
|
@@ -76,13 +76,13 @@ class TestSubnet < TestYaoResource
|
|
76
76
|
assert_requested(stub)
|
77
77
|
end
|
78
78
|
|
79
|
-
def
|
80
|
-
stub = stub_request(:get, "https://example.com:12345/
|
79
|
+
def test_project
|
80
|
+
stub = stub_request(:get, "https://example.com:12345/projects/0123456789abcdef0123456789abcdef")
|
81
81
|
.to_return(
|
82
82
|
status: 200,
|
83
83
|
body: <<-JSON,
|
84
84
|
{
|
85
|
-
"
|
85
|
+
"project": {
|
86
86
|
"id": "0123456789abcdef0123456789abcdef"
|
87
87
|
}
|
88
88
|
}
|
@@ -90,9 +90,9 @@ class TestSubnet < TestYaoResource
|
|
90
90
|
headers: {'Content-Type' => 'application/json'}
|
91
91
|
)
|
92
92
|
|
93
|
-
subnet = Yao::Subnet.new('
|
94
|
-
assert_instance_of(Yao::
|
95
|
-
assert_equal('0123456789abcdef0123456789abcdef', subnet.
|
93
|
+
subnet = Yao::Subnet.new('project_id' => '0123456789abcdef0123456789abcdef')
|
94
|
+
assert_instance_of(Yao::Project, subnet.project)
|
95
|
+
assert_equal('0123456789abcdef0123456789abcdef', subnet.project.id)
|
96
96
|
|
97
97
|
assert_requested(stub)
|
98
98
|
end
|
@@ -98,4 +98,25 @@ class TestVolume < TestYaoResource
|
|
98
98
|
volume.status = 'error'
|
99
99
|
assert_requested(stub)
|
100
100
|
end
|
101
|
+
|
102
|
+
def test_project
|
103
|
+
stub = stub_request(:get, "https://example.com:12345/projects/0123456789abcdef0123456789abcdef")
|
104
|
+
.to_return(
|
105
|
+
status: 200,
|
106
|
+
body: <<-JSON,
|
107
|
+
{
|
108
|
+
"project": {
|
109
|
+
"id": "0123456789abcdef0123456789abcdef"
|
110
|
+
}
|
111
|
+
}
|
112
|
+
JSON
|
113
|
+
headers: {'Content-Type' => 'application/json'}
|
114
|
+
)
|
115
|
+
|
116
|
+
volume = Yao::Volume.new('project_id' => '0123456789abcdef0123456789abcdef')
|
117
|
+
assert_instance_of(Yao::Project, volume.project)
|
118
|
+
assert_equal('0123456789abcdef0123456789abcdef', volume.project.id)
|
119
|
+
|
120
|
+
assert_requested(stub)
|
121
|
+
end
|
101
122
|
end
|
data/yao.gemspec
CHANGED
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.
|
4
|
+
version: 0.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Uchio, KONDO
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -42,14 +42,14 @@ dependencies:
|
|
42
42
|
name: faraday
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 1.8.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.8.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
@@ -122,6 +122,7 @@ files:
|
|
122
122
|
- lib/yao/resources/port.rb
|
123
123
|
- lib/yao/resources/port_associationable.rb
|
124
124
|
- lib/yao/resources/project.rb
|
125
|
+
- lib/yao/resources/project_associationable.rb
|
125
126
|
- lib/yao/resources/resource.rb
|
126
127
|
- lib/yao/resources/restfully_accessible.rb
|
127
128
|
- lib/yao/resources/role.rb
|
@@ -135,7 +136,6 @@ files:
|
|
135
136
|
- lib/yao/resources/server_usage_associationable.rb
|
136
137
|
- lib/yao/resources/subnet.rb
|
137
138
|
- lib/yao/resources/tenant.rb
|
138
|
-
- lib/yao/resources/tenant_associationable.rb
|
139
139
|
- lib/yao/resources/user.rb
|
140
140
|
- lib/yao/resources/volume.rb
|
141
141
|
- lib/yao/resources/volume_action.rb
|
@@ -216,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
216
216
|
- !ruby/object:Gem::Version
|
217
217
|
version: '0'
|
218
218
|
requirements: []
|
219
|
-
rubygems_version: 3.
|
219
|
+
rubygems_version: 3.3.7
|
220
220
|
signing_key:
|
221
221
|
specification_version: 4
|
222
222
|
summary: Yet Another OpenStack API Wrapper that rocks!!
|