mirror of
https://github.com/puppetlabs/vmfloaty.git
synced 2026-01-26 21:38:41 -05:00
(#1) Update query, snapshot, and revert
This commit is contained in:
parent
f773e0a5a6
commit
02527b9665
4 changed files with 91 additions and 29 deletions
|
|
@ -1,17 +1,19 @@
|
|||
require 'faraday'
|
||||
require 'json'
|
||||
require 'vmfloaty/http'
|
||||
|
||||
class Auth
|
||||
def self.get_token(user, url, password)
|
||||
conn = Http.get_conn(url)
|
||||
|
||||
#resp = conn.post do |req|
|
||||
# req.url '/v1/token'
|
||||
# req.headers['Content-Type'] = 'application/json'
|
||||
# req.user = user
|
||||
# end
|
||||
resp = conn.post do |req|
|
||||
req.url '/v1/token'
|
||||
req.headers['Content-Type'] = 'application/json'
|
||||
req.user = user
|
||||
end
|
||||
# if ok: true, return token
|
||||
puts 'Got token'
|
||||
resp_body = JSON.parse(resp.body)
|
||||
resp_body
|
||||
end
|
||||
|
||||
def self.delete_token(user, token)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue