Class: Morpheus::LoadBalancersInterface
- Inherits:
-
APIClient
- Object
- APIClient
- Morpheus::LoadBalancersInterface
- Defined in:
- lib/morpheus/api/load_balancers_interface.rb
Instance Method Summary collapse
- #create(options) ⇒ Object
- #destroy(id) ⇒ Object
- #get(options = nil) ⇒ Object
-
#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ LoadBalancersInterface
constructor
A new instance of LoadBalancersInterface.
- #load_balancer_types(options = {}) ⇒ Object
- #update(id, options) ⇒ Object
Constructor Details
#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ LoadBalancersInterface
4 5 6 7 8 9 |
# File 'lib/morpheus/api/load_balancers_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(options) ⇒ Object
45 46 47 48 49 50 |
# File 'lib/morpheus/api/load_balancers_interface.rb', line 45 def create() url = "#{@base_url}/api/load-balancers" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = execute(method: :post, url: url, headers: headers, payload: payload.to_json) end |
#destroy(id) ⇒ Object
52 53 54 55 56 |
# File 'lib/morpheus/api/load_balancers_interface.rb', line 52 def destroy(id) url = "#{@base_url}/api/load-balancers/#{id}" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } execute(method: :delete, url: url, headers: headers) end |
#get(options = nil) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/morpheus/api/load_balancers_interface.rb', line 24 def get(=nil) url = "#{@base_url}/api/load-balancers" headers = { params: {}, authorization: "Bearer #{@access_token}" } if .is_a?(Hash) headers[:params].merge!() elsif .is_a?(Numeric) url = "#{@base_url}/api/load-balancers/#{options}" elsif .is_a?(String) headers[:params]['name'] = end execute(method: :get, url: url, headers: headers) end |
#load_balancer_types(options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/morpheus/api/load_balancers_interface.rb', line 11 def load_balancer_types(={}) url = "#{@base_url}/api/load-balancer-types" headers = { params: {}, authorization: "Bearer #{@access_token}" } if .is_a?(Hash) headers[:params].merge!() elsif .is_a?(Numeric) url = "#{@base_url}/api/load-balancer-types/#{options}" elsif .is_a?(String) headers[:params]['name'] = end execute(method: :get, url: url, headers: headers) end |
#update(id, options) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/morpheus/api/load_balancers_interface.rb', line 37 def update(id, ) url = "#{@base_url}/api/load-balancers/#{id}" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = execute(method: :put, url: url, headers: headers, payload: payload.to_json) end |