yao 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -0
- data/lib/yao/client.rb +7 -2
- data/lib/yao/version.rb +1 -1
- data/test/yao/test_auth.rb +16 -0
- data/test/yao/test_config.rb +1 -1
- data/yao.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd6c10a9f17a721d151c633f1668bc518c01fb51
|
4
|
+
data.tar.gz: e520c0d5a5a3eff1dfbd796c883af865747f0882
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eff49cbc10c33dffc702372092d7af9196a9dda99af850f61531e592a3b1ffaa0601cfedcdd0872a98e35b70a1a38226f3cbf3fc852c6db192933f5546317c03
|
7
|
+
data.tar.gz: dac64ca02915c373496db975899f53e44b3b489f81f558207449796d9644cc51c29ceeee0dba4cee5e1141514c4b04dc5e0137c53c00fccb8e0aa0f24a749f39
|
data/README.md
CHANGED
@@ -36,6 +36,18 @@ Yao::Network.list # list up networks...
|
|
36
36
|
Yao::Server.list_detail # list up instances...
|
37
37
|
```
|
38
38
|
|
39
|
+
If you want to override some of endpoints by service, you can do:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
Yao.configure do
|
43
|
+
auth_url "http://endpoint.example.com:12345"
|
44
|
+
tenant_name "example"
|
45
|
+
username "udzura"
|
46
|
+
password "XXXXXXXX"
|
47
|
+
endpoints identity: { public: "http://override-endpoint.example.com:35357/v3.0" }
|
48
|
+
end
|
49
|
+
```
|
50
|
+
|
39
51
|
## Support policy
|
40
52
|
|
41
53
|
YAO supports rubies which are supported by Ruby Core Team. Please look into [`.travis.yml`](./.travis.yml) 's directive.
|
data/lib/yao/client.rb
CHANGED
@@ -3,6 +3,8 @@ require 'faraday'
|
|
3
3
|
require 'yao/plugins/default_client_generator'
|
4
4
|
|
5
5
|
module Yao
|
6
|
+
Yao.config.param :endpoints, nil
|
7
|
+
|
6
8
|
module Client
|
7
9
|
class ClientSet
|
8
10
|
def initialize
|
@@ -32,8 +34,11 @@ module Yao
|
|
32
34
|
}.to_h
|
33
35
|
end
|
34
36
|
|
35
|
-
|
36
|
-
|
37
|
+
force_public_url = Yao.config.endpoints[type.to_sym][:public] rescue nil
|
38
|
+
force_admin_url = Yao.config.endpoints[type.to_sym][:admin] rescue nil
|
39
|
+
|
40
|
+
self.pool[type] = Yao::Client.gen_client(force_public_url || urls[:public_url], token: token) if force_public_url || urls[:public_url]
|
41
|
+
self.admin_pool[type] = Yao::Client.gen_client(force_admin_url || urls[:admin_url], token: token) if force_admin_url || urls[:admin_url]
|
37
42
|
end
|
38
43
|
end
|
39
44
|
end
|
data/lib/yao/version.rb
CHANGED
data/test/yao/test_auth.rb
CHANGED
@@ -14,6 +14,9 @@ class TestAuth < Test::Unit::TestCase
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def teardown
|
17
|
+
Yao.configure do
|
18
|
+
endpoints nil
|
19
|
+
end
|
17
20
|
end
|
18
21
|
|
19
22
|
def test_auth_successful
|
@@ -57,4 +60,17 @@ class TestAuth < Test::Unit::TestCase
|
|
57
60
|
end
|
58
61
|
assert_received(auth) {|a| a.new }
|
59
62
|
end
|
63
|
+
|
64
|
+
def test_override_endpoint
|
65
|
+
Yao.configure do
|
66
|
+
auth_url "http://endpoint.example.com:12345"
|
67
|
+
tenant_name "example"
|
68
|
+
username "udzura"
|
69
|
+
password "XXXXXXXX"
|
70
|
+
endpoints ({ identity: { public: "http://override-endpoint.example.com:35357/v3.0" } })
|
71
|
+
end
|
72
|
+
assert(Yao.default_client.pool["identity"].url_prefix.to_s, "http://override-endpoint.example.com:35357/v3.0")
|
73
|
+
end
|
74
|
+
|
75
|
+
|
60
76
|
end
|
data/test/yao/test_config.rb
CHANGED
data/yao.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency "json"
|
22
|
-
spec.add_dependency "faraday"
|
22
|
+
spec.add_dependency "faraday", "~> 0.12.0"
|
23
23
|
spec.add_dependency "faraday_middleware"
|
24
24
|
|
25
25
|
spec.add_development_dependency "bundler", ">= 1.10"
|
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.1
|
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: 2017-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: faraday
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.12.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 0.12.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: faraday_middleware
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -239,7 +239,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
239
|
version: '0'
|
240
240
|
requirements: []
|
241
241
|
rubyforge_project:
|
242
|
-
rubygems_version: 2.
|
242
|
+
rubygems_version: 2.5.1
|
243
243
|
signing_key:
|
244
244
|
specification_version: 4
|
245
245
|
summary: Yet Another OpenStack API Wrapper that rocks!!
|