Class: Morpheus::StorageDatastoresInterface
- Inherits:
-
APIClient
- Object
- APIClient
- Morpheus::StorageDatastoresInterface
- Defined in:
- lib/morpheus/api/storage_datastores_interface.rb
Instance Method Summary collapse
- #base_path ⇒ Object
- #create(options) ⇒ Object
- #get(id, params = {}) ⇒ Object
- #list(params = {}) ⇒ Object
- #load_type_options(datastore_type) ⇒ Object
- #update(id, payload) ⇒ Object
Instance Method Details
#base_path ⇒ Object
5 6 7 |
# File 'lib/morpheus/api/storage_datastores_interface.rb', line 5 def base_path "#{@base_url}/api/data-stores" end |
#create(options) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/morpheus/api/storage_datastores_interface.rb', line 31 def create() url = "#{@base_url}/api/data-stores" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = execute(method: :post, url: url, headers: headers, payload: payload.to_json) end |
#get(id, params = {}) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/morpheus/api/storage_datastores_interface.rb', line 9 def get(id, params={}) raise "#{self.class}.get() passed a blank id!" if id.to_s == '' url = "#{@base_url}/api/data-stores/#{id}" headers = { params: params, authorization: "Bearer #{@access_token}" } opts = {method: :get, url: url, headers: headers} execute(opts) end |
#list(params = {}) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/morpheus/api/storage_datastores_interface.rb', line 17 def list(params={}) url = base_path headers = { params: params, authorization: "Bearer #{@access_token}" } opts = {method: :get, url: url, headers: headers} execute(opts) end |
#load_type_options(datastore_type) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/morpheus/api/storage_datastores_interface.rb', line 24 def (datastore_type) url = "/api/data-stores/#{datastore_type}/option-types" headers = { params: {}, authorization: "Bearer #{@access_token}" } opts = {method: :get, url: url, headers: headers} execute(opts) end |
#update(id, payload) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/morpheus/api/storage_datastores_interface.rb', line 38 def update(id, payload) url = "#{@base_url}/api/data-stores/#{id}" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } opts = {method: :put, url: url, headers: headers, payload: payload.to_json} execute(opts) end |