xnode-keystone 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9faa42e7c5f50577cc4d610767b4b021a7e6f622
4
- data.tar.gz: ad518d1b937e84929b1ac9d79a75e427a7508d4a
3
+ metadata.gz: adc3e9bf385d47c72169139ac971474022b4ed3c
4
+ data.tar.gz: 6871e8c9b7296d0b4e78a94ce0b2fcc3791f5aae
5
5
  SHA512:
6
- metadata.gz: 346eb8480ffd28829dc528b5917499c1289e9c0da04160ab8bb8c7341c51b15f99ae3a626e19f9eede7e48b406a243c4c8efc5fb638b65e9c0a5303202734216
7
- data.tar.gz: 663691086092b08fa30cf74460627b000bb7aa77d3c0ff58d3e355182f93ca9e29102f7ec54162181008a2b27cc1558dcc132732cbe02140bc3d4a43dcf97c80
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
  ![Build Status](https://travis-ci.org/xnoder/xnode-keystone.svg)
4
+ [![Gem Version](https://badge.fury.io/rb/xnode-keystone.svg)](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
@@ -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
@@ -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, headers)
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
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Xnode
4
4
  module Keystone
5
- VERSION = "0.1.1"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
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.1.1
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: