Class: Morpheus::SecurityGroupsInterface
- Inherits:
-
APIClient
- Object
- APIClient
- Morpheus::SecurityGroupsInterface
- Defined in:
- lib/morpheus/api/security_groups_interface.rb
Instance Method Summary collapse
- #create(payload) ⇒ Object
- #create_location(id, payload) ⇒ Object
- #delete(id) ⇒ Object
- #delete_location(id, location_id, params = {}) ⇒ Object
- #get(id, params = {}) ⇒ Object
- #list(params = {}) ⇒ Object
- #update(id, payload) ⇒ Object
Instance Method Details
#create(payload) ⇒ Object
26 27 28 29 30 |
# File 'lib/morpheus/api/security_groups_interface.rb', line 26 def create(payload) url = "#{@base_url}/api/security-groups" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } execute(method: :post, url: url, headers: headers, payload: payload.to_json) end |
#create_location(id, payload) ⇒ Object
44 45 46 47 48 |
# File 'lib/morpheus/api/security_groups_interface.rb', line 44 def create_location(id, payload) url = "#{@base_url}/api/security-groups/#{id}/locations" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } execute(method: :post, url: url, headers: headers, payload: payload.to_json) end |
#delete(id) ⇒ Object
38 39 40 41 42 |
# File 'lib/morpheus/api/security_groups_interface.rb', line 38 def delete(id) url = "#{@base_url}/api/security-groups/#{id}" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } execute(method: :delete, url: url, headers: headers) end |
#delete_location(id, location_id, params = {}) ⇒ Object
50 51 52 53 54 |
# File 'lib/morpheus/api/security_groups_interface.rb', line 50 def delete_location(id, location_id, params={}) url = "#{@base_url}/api/security-groups/#{id}/locations/#{location_id}" headers = { :params => params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } execute(method: :delete, url: url, headers: headers) end |
#get(id, params = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/morpheus/api/security_groups_interface.rb', line 11 def get(id, params={}) url = "#{@base_url}/api/security-groups/#{id}" headers = { params: {}, authorization: "Bearer #{@access_token}" } if .is_a?(Hash) headers[:params].merge!() elsif .is_a?(Numeric) url = "#{url}/#{}" elsif .is_a?(String) headers[:params]['name'] = end opts = {method: :get, url: url, headers: headers} execute(opts) end |
#list(params = {}) ⇒ Object
5 6 7 8 9 |
# File 'lib/morpheus/api/security_groups_interface.rb', line 5 def list(params={}) url = "#{@base_url}/api/security-groups" headers = { params: params, authorization: "Bearer #{@access_token}" } execute(method: :get, url: url, headers: headers) end |
#update(id, payload) ⇒ Object
32 33 34 35 36 |
# File 'lib/morpheus/api/security_groups_interface.rb', line 32 def update(id, payload) url = "#{@base_url}/api/security-groups/#{id}" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } execute(method: :put, url: url, headers: headers, payload: payload.to_json) end |