xnode-keystone 0.1.1 → 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/README.md +5 -0
- data/lib/xnode/keystone.rb +9 -0
- data/lib/xnode/keystone/http.rb +6 -1
- data/lib/xnode/keystone/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adc3e9bf385d47c72169139ac971474022b4ed3c
|
4
|
+
data.tar.gz: 6871e8c9b7296d0b4e78a94ce0b2fcc3791f5aae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 692a46ca48e1a3e19d21b5f1ac245f28acdedf146079a7053112724ba997fae5d98aecf70b6f1f32c183bfc48bd2aa2c97752293209218b5d1aec05ff096358b
|
7
|
+
data.tar.gz: b40275fded79a6f94f8418c5f6aaee84455d269a4569099653874736a2e9e323d605c926c9dec221e5f4d533332693351d7813b4e2e321db37fe2a5b694bd8b9
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Xnode::Keystone
|
2
2
|
|
3
3
|

|
4
|
+
[](http://badge.fury.io/rb/xnode-keystone)
|
4
5
|
|
5
6
|
`xnode-keystone` provides methods that allow you to interact with the Keystone Identity service provided by an OpenStack
|
6
7
|
cloud. It covers your authentication, and depending on your rights within the cloud, the ability to query and manipulate
|
@@ -50,6 +51,10 @@ token = auth.get_token(request)
|
|
50
51
|
# And to get the public compute API endpoint back...
|
51
52
|
endpoints = auth.catalog(request)
|
52
53
|
compute = endpoints['compute']['public']
|
54
|
+
|
55
|
+
# If you want a list of tenants...
|
56
|
+
keystone = endpoints['identity']['public']
|
57
|
+
tenants = auth.tenants(keystone, token)
|
53
58
|
```
|
54
59
|
|
55
60
|
## Development
|
data/lib/xnode/keystone.rb
CHANGED
@@ -24,6 +24,9 @@ module Xnode
|
|
24
24
|
# => auth = Xnode::Keystone::Authenticate.new
|
25
25
|
# => request = auth.request
|
26
26
|
# => token = auth.get_token(request)
|
27
|
+
# => catalog = auth.catalog(request)
|
28
|
+
# => keystone_endpoint = catalog['identity']['public']
|
29
|
+
# => tenants = auth.tenants(keystone_endpoint, token)
|
27
30
|
class Authenticate
|
28
31
|
|
29
32
|
# Set accessors for credentials
|
@@ -66,6 +69,12 @@ module Xnode
|
|
66
69
|
return mapendpoints
|
67
70
|
end
|
68
71
|
|
72
|
+
# Fetches a list of tenants from the platform and returns the data as a Hash
|
73
|
+
def tenants(baseurl, token)
|
74
|
+
url = baseurl + '/tenants'
|
75
|
+
response = Xnode::Keystone.get(url, token)
|
76
|
+
end
|
77
|
+
|
69
78
|
end
|
70
79
|
end
|
71
80
|
end
|
data/lib/xnode/keystone/http.rb
CHANGED
@@ -11,7 +11,12 @@ module Xnode
|
|
11
11
|
private
|
12
12
|
|
13
13
|
# Send an HTTP GET request to an OpenStack API endpoint.
|
14
|
-
def get(url,
|
14
|
+
def get(url, token)
|
15
|
+
request = RestClient::Request.execute(
|
16
|
+
method: :get,
|
17
|
+
url: "#{url}",
|
18
|
+
headers: {'X-Auth-Token': token, 'Content-Type': 'application/json', 'Accept': 'application/json'})
|
19
|
+
response = JSON.parse(request.body)
|
15
20
|
end
|
16
21
|
module_function :get
|
17
22
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xnode-keystone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Stevens
|
@@ -145,3 +145,4 @@ signing_key:
|
|
145
145
|
specification_version: 4
|
146
146
|
summary: Authenticate against the OpenStack Keystone Identity Service.
|
147
147
|
test_files: []
|
148
|
+
has_rdoc:
|