Class: Morpheus::RolesInterface
- Inherits:
-
APIClient
- Object
- APIClient
- Morpheus::RolesInterface
- Defined in:
- lib/morpheus/api/roles_interface.rb
Instance Method Summary collapse
- #create(account_id, options) ⇒ Object
- #destroy(account_id, id) ⇒ Object
- #get(account_id, id) ⇒ Object
-
#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ RolesInterface
constructor
A new instance of RolesInterface.
- #list(account_id, options = {}) ⇒ Object
- #update(account_id, id, options) ⇒ Object
- #update_cloud(account_id, id, options) ⇒ Object
- #update_group(account_id, id, options) ⇒ Object
- #update_instance_type(account_id, id, options) ⇒ Object
- #update_permission(account_id, id, options) ⇒ Object
Constructor Details
#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ RolesInterface
Returns a new instance of RolesInterface.
4 5 6 7 8 9 |
# File 'lib/morpheus/api/roles_interface.rb', line 4 def initialize(access_token, refresh_token, expires_at = nil, base_url=nil) @access_token = access_token @refresh_token = refresh_token @base_url = base_url @expires_at = expires_at end |
Instance Method Details
#create(account_id, options) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/morpheus/api/roles_interface.rb', line 25 def create(account_id, ) url = build_url(account_id) headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = execute(method: :post, url: url, headers: headers, payload: payload.to_json) end |
#destroy(account_id, id) ⇒ Object
39 40 41 42 43 |
# File 'lib/morpheus/api/roles_interface.rb', line 39 def destroy(account_id, id) url = build_url(account_id, id) headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } execute(method: :delete, url: url, headers: headers) end |
#get(account_id, id) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/morpheus/api/roles_interface.rb', line 11 def get(account_id, id) raise "#{self.class}.get() passed a blank id!" if id.to_s == '' url = build_url(account_id, id) headers = { params: {}, authorization: "Bearer #{@access_token}" } execute(method: :get, url: url, headers: headers) end |
#list(account_id, options = {}) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/morpheus/api/roles_interface.rb', line 18 def list(account_id, ={}) url = build_url(account_id) headers = { params: {}, authorization: "Bearer #{@access_token}" } headers[:params].merge!() execute(method: :get, url: url, headers: headers) end |
#update(account_id, id, options) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/morpheus/api/roles_interface.rb', line 32 def update(account_id, id, ) url = build_url(account_id, id) headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = execute(method: :put, url: url, headers: headers, payload: payload.to_json) end |
#update_cloud(account_id, id, options) ⇒ Object
66 67 68 69 70 71 |
# File 'lib/morpheus/api/roles_interface.rb', line 66 def update_cloud(account_id, id, ) url = build_url(account_id, id) + "/update-cloud" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = execute(method: :put, url: url, headers: headers, payload: payload.to_json) end |
#update_group(account_id, id, options) ⇒ Object
59 60 61 62 63 64 |
# File 'lib/morpheus/api/roles_interface.rb', line 59 def update_group(account_id, id, ) url = build_url(account_id, id) + "/update-group" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = execute(method: :put, url: url, headers: headers, payload: payload.to_json) end |
#update_instance_type(account_id, id, options) ⇒ Object
52 53 54 55 56 57 |
# File 'lib/morpheus/api/roles_interface.rb', line 52 def update_instance_type(account_id, id, ) url = build_url(account_id, id) + "/update-instance-type" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = execute(method: :put, url: url, headers: headers, payload: payload.to_json) end |
#update_permission(account_id, id, options) ⇒ Object
45 46 47 48 49 50 |
# File 'lib/morpheus/api/roles_interface.rb', line 45 def (account_id, id, ) url = build_url(account_id, id) + "/update-permission" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = execute(method: :put, url: url, headers: headers, payload: payload.to_json) end |