yao 0.13.4 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rubocop.yml +19 -0
  3. data/.github/workflows/ubuntu-rvm.yml +1 -1
  4. data/.github/workflows/ubuntu.yml +1 -1
  5. data/.rubocop.yml +3 -6
  6. data/lib/yao/auth.rb +18 -0
  7. data/lib/yao/client.rb +1 -1
  8. data/lib/yao/config.rb +19 -0
  9. data/lib/yao/faraday_middlewares.rb +37 -3
  10. data/lib/yao/mode.rb +4 -0
  11. data/lib/yao/plugins/default_client_generator.rb +0 -1
  12. data/lib/yao/plugins/registry.rb +2 -1
  13. data/lib/yao/resources/action.rb +7 -0
  14. data/lib/yao/resources/aggregates.rb +1 -0
  15. data/lib/yao/resources/base.rb +22 -1
  16. data/lib/yao/resources/compute_services.rb +8 -1
  17. data/lib/yao/resources/flavor.rb +2 -0
  18. data/lib/yao/resources/floating_ip.rb +2 -0
  19. data/lib/yao/resources/hypervisor.rb +1 -1
  20. data/lib/yao/resources/image.rb +2 -0
  21. data/lib/yao/resources/loadbalancer.rb +4 -0
  22. data/lib/yao/resources/loadbalancer_healthmonitor.rb +3 -0
  23. data/lib/yao/resources/loadbalancer_listener.rb +2 -0
  24. data/lib/yao/resources/loadbalancer_pool.rb +6 -0
  25. data/lib/yao/resources/loadbalancer_pool_member.rb +21 -0
  26. data/lib/yao/resources/metadata_available.rb +21 -0
  27. data/lib/yao/resources/meter.rb +8 -1
  28. data/lib/yao/resources/network.rb +1 -0
  29. data/lib/yao/resources/network_associationable.rb +1 -0
  30. data/lib/yao/resources/old_sample.rb +4 -0
  31. data/lib/yao/resources/port.rb +2 -0
  32. data/lib/yao/resources/port_associationable.rb +1 -0
  33. data/lib/yao/resources/project.rb +6 -0
  34. data/lib/yao/resources/resource.rb +8 -2
  35. data/lib/yao/resources/restfully_accessible.rb +15 -0
  36. data/lib/yao/resources/role.rb +6 -4
  37. data/lib/yao/resources/role_assignment.rb +1 -0
  38. data/lib/yao/resources/router.rb +9 -0
  39. data/lib/yao/resources/sample.rb +4 -0
  40. data/lib/yao/resources/security_group.rb +1 -0
  41. data/lib/yao/resources/security_group_rule.rb +10 -0
  42. data/lib/yao/resources/server.rb +20 -0
  43. data/lib/yao/resources/server_group.rb +1 -1
  44. data/lib/yao/resources/server_usage_associationable.rb +12 -0
  45. data/lib/yao/resources/subnet.rb +1 -0
  46. data/lib/yao/resources/tenant.rb +6 -0
  47. data/lib/yao/resources/tenant_associationable.rb +1 -0
  48. data/lib/yao/resources/user.rb +2 -0
  49. data/lib/yao/resources.rb +3 -0
  50. data/lib/yao/token.rb +1 -0
  51. data/lib/yao/version.rb +1 -1
  52. data/test/yao/resources/test_base.rb +11 -0
  53. data/test/yao/resources/test_image.rb +5 -0
  54. data/test/yao/resources/test_project.rb +20 -1
  55. data/test/yao/resources/test_server_group.rb +1 -1
  56. data/test/yao/test_client.rb +0 -1
  57. data/yao.gemspec +1 -1
  58. metadata +7 -5
@@ -254,4 +254,23 @@ class TestProject < TestYaoResource
254
254
  assert_instance_of(Array, project.servers)
255
255
  assert_requested(stub)
256
256
  end
257
- end
257
+
258
+ def test_server_usage
259
+ stub = stub_request(:get, "https://example.com:12345/os-simple-tenant-usage/0123456789abcdef0123456789abcdef")
260
+ .to_return(
261
+ status: 200,
262
+ body: <<-JSON,
263
+ {
264
+ "tenant_usage": {
265
+ "total_memory_mb_usage": 1024
266
+ }
267
+ }
268
+ JSON
269
+ headers: {'Content-Type' => 'application/json'}
270
+ )
271
+
272
+ project = Yao::Project::new("id" => "0123456789abcdef0123456789abcdef")
273
+ usage = project.server_usage
274
+ assert_equal(1024, usage["total_memory_mb_usage"])
275
+ end
276
+ end
@@ -20,4 +20,4 @@ class TestServerGroup < TestYaoResource
20
20
  assert_equal("6f70656e737461636b20342065766572", sg.project_id)
21
21
  assert_equal("fake", sg.user_id)
22
22
  end
23
- end
23
+ end
@@ -51,7 +51,6 @@ class TestClient < Test::Unit::TestCase
51
51
  Faraday::Request::ReadOnly,
52
52
  Faraday::Response::OSErrorDetector,
53
53
  FaradayMiddleware::ParseJson,
54
- Faraday::Response::Logger,
55
54
  Faraday::Response::OSDumper
56
55
  ]
57
56
  assert { cli.builder.handlers == handlers }
data/yao.gemspec CHANGED
@@ -19,6 +19,6 @@ Gem::Specification.new do |spec|
19
19
 
20
20
  spec.add_dependency "json"
21
21
  spec.add_dependency "deep_merge"
22
- spec.add_dependency "faraday", "~> 1.0.1"
22
+ spec.add_dependency "faraday", "~> 1.8.0"
23
23
  spec.add_dependency "faraday_middleware"
24
24
  end
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.13.4
4
+ version: 0.14.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: 2020-10-12 00:00:00.000000000 Z
11
+ date: 2021-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.0.1
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
- version: 1.0.1
54
+ version: 1.8.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: faraday_middleware
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -74,6 +74,7 @@ extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
76
  - ".github/workflows/macos.yml"
77
+ - ".github/workflows/rubocop.yml"
77
78
  - ".github/workflows/ubuntu-rvm.yml"
78
79
  - ".github/workflows/ubuntu.yml"
79
80
  - ".gitignore"
@@ -131,6 +132,7 @@ files:
131
132
  - lib/yao/resources/security_group_rule.rb
132
133
  - lib/yao/resources/server.rb
133
134
  - lib/yao/resources/server_group.rb
135
+ - lib/yao/resources/server_usage_associationable.rb
134
136
  - lib/yao/resources/subnet.rb
135
137
  - lib/yao/resources/tenant.rb
136
138
  - lib/yao/resources/tenant_associationable.rb
@@ -213,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
213
215
  - !ruby/object:Gem::Version
214
216
  version: '0'
215
217
  requirements: []
216
- rubygems_version: 3.0.6
218
+ rubygems_version: 3.2.32
217
219
  signing_key:
218
220
  specification_version: 4
219
221
  summary: Yet Another OpenStack API Wrapper that rocks!!