Module: Xnode::Keystone
- Defined in:
- lib/xnode/keystone.rb,
lib/xnode/keystone/http.rb,
lib/xnode/keystone/utils.rb,
lib/xnode/keystone/version.rb
Defined Under Namespace
Classes: Authenticate
Constant Summary collapse
- VERSION =
"0.2.0"
Class Method Summary collapse
-
.auth_data(tenant, username, password) ⇒ Object
Set up a Keystone JSON request body for authentication purposes.
-
.delete ⇒ Object
Send an HTTP DELETE request to an OpenStack API endpoint.
-
.get(url, token) ⇒ Object
Send an HTTP GET request to an OpenStack API endpoint.
-
.patch ⇒ Object
Send an HTTP PATCH request to an OpenStack API endpoint.
-
.post(url, data) ⇒ Object
Send an HTTP POST request to an OpenStack API endpoint.
-
.put ⇒ Object
Send an HTTP PUT request to an OpenStack API endpoint.
Class Method Details
.auth_data(tenant, username, password) ⇒ Object
Set up a Keystone JSON request body for authentication purposes.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/xnode/keystone/utils.rb', line 10 def auth_data(tenant, username, password) headers = { :auth => { :tenantName => tenant, :passwordCredentials => { :username => username, :password => password } } } end |
.delete ⇒ Object
Send an HTTP DELETE request to an OpenStack API endpoint.
31 32 |
# File 'lib/xnode/keystone/http.rb', line 31 def delete end |
.get(url, token) ⇒ Object
Send an HTTP GET request to an OpenStack API endpoint.
14 15 16 17 18 19 20 |
# File 'lib/xnode/keystone/http.rb', line 14 def get(url, token) request = RestClient::Request.execute( method: :get, url: "#{url}", headers: {'X-Auth-Token': token, 'Content-Type': 'application/json', 'Accept': 'application/json'}) response = JSON.parse(request.body) end |
.patch ⇒ Object
Send an HTTP PATCH request to an OpenStack API endpoint.
36 37 |
# File 'lib/xnode/keystone/http.rb', line 36 def patch end |
.post(url, data) ⇒ Object
Send an HTTP POST request to an OpenStack API endpoint.
24 25 26 27 |
# File 'lib/xnode/keystone/http.rb', line 24 def post(url, data) request = RestClient.post "#{url}", data, :content_type => :json, :accept => :json response = JSON.parse(request.body) end |
.put ⇒ Object
Send an HTTP PUT request to an OpenStack API endpoint.
41 42 |
# File 'lib/xnode/keystone/http.rb', line 41 def put end |