Class: Morpheus::RestInterface
- Inherits:
-
APIClient
- Object
- APIClient
- Morpheus::RestInterface
show all
- Defined in:
- lib/morpheus/api/rest_interface.rb
Overview
Interface class to be subclassed by interfaces that provide CRUD endpoints
Subclasses must override the base_path method
Direct Known Subclasses
AccountUsersInterface, AccountsInterface, BackupJobsInterface, BackupServicesInterface, BackupsInterface, CatalogItemTypesInterface, CertificateTypesInterface, CertificatesInterface, CredentialsInterface, DeploymentsInterface, IntegrationsInterface, LoadBalancerPoolsInterface, LoadBalancersInterface, MigrationsInterface, NetworkDhcpRelaysInterface, NetworkDhcpServersInterface, NetworkEdgeClustersInterface, NetworkServersInterface, NetworkStaticRoutesInterface, OptionTypeFormsInterface, PluginsInterface, ScaleThresholdsInterface, SecurityPackagesInterface, SecurityScansInterface, StorageServersInterface, StorageVolumesInterface, SupportBundlesInterface, SystemTypesInterface, SystemsInterface, UsersInterface, VdiAppsInterface, VdiGatewaysInterface, VdiPoolsInterface, VirtualServersInterface
Instance Method Summary
collapse
-
#base_path ⇒ Object
subclasses should override in your interface Example: "/api/things".
-
#create(payload, params = {}, headers = {}) ⇒ Object
-
#destroy(id, params = {}, headers = {}) ⇒ Object
-
#get(id, params = {}, headers = {}) ⇒ Object
-
#list(params = {}, headers = {}) ⇒ Object
-
#update(id, payload, params = {}, headers = {}) ⇒ Object
Instance Method Details
#base_path ⇒ Object
subclasses should override in your interface
Example: "/api/things"
9
10
11
12
|
# File 'lib/morpheus/api/rest_interface.rb', line 9
def base_path
raise "#{self.class} has not defined base_path!" if @options[:base_path].nil?
@options[:base_path]
end
|
#create(payload, params = {}, headers = {}) ⇒ Object
23
24
25
|
# File 'lib/morpheus/api/rest_interface.rb', line 23
def create(payload, params={}, ={})
execute(method: :post, url: "#{base_path}", params: params, payload: payload, headers: )
end
|
#destroy(id, params = {}, headers = {}) ⇒ Object
32
33
34
35
|
# File 'lib/morpheus/api/rest_interface.rb', line 32
def destroy(id, params = {}, ={})
validate_id!(id)
execute(method: :delete, url: "#{base_path}/#{CGI::escape(id.to_s)}", params: params, headers: )
end
|
#get(id, params = {}, headers = {}) ⇒ Object
18
19
20
21
|
# File 'lib/morpheus/api/rest_interface.rb', line 18
def get(id, params={}, ={})
validate_id!(id)
execute(method: :get, url: "#{base_path}/#{CGI::escape(id.to_s)}", params: params, headers: )
end
|
#list(params = {}, headers = {}) ⇒ Object
14
15
16
|
# File 'lib/morpheus/api/rest_interface.rb', line 14
def list(params={}, ={})
execute(method: :get, url: "#{base_path}", params: params, headers: )
end
|
#update(id, payload, params = {}, headers = {}) ⇒ Object
27
28
29
30
|
# File 'lib/morpheus/api/rest_interface.rb', line 27
def update(id, payload, params={}, ={})
validate_id!(id)
execute(method: :put, url: "#{base_path}/#{CGI::escape(id.to_s)}", params: params, payload: payload, headers: )
end
|