Class: Morpheus::AppsInterface
Instance Method Summary
collapse
Methods inherited from APIClient
#account_groups, #accounts, #app_templates, #apps, #archive_buckets, #archive_files, #auth, #blueprints, #cloud_datastores, #cloud_policies, #clouds, #containers, #custom_instance_types, #cypher, #dashboard, #deploy, #deployments, #dry, #dry_run, #execute, #execute_schedules, #execution_request, #file_copy_request, #group_policies, #groups, #image_builder, #instance_types, #instances, #key_pairs, #library_container_scripts, #library_container_templates, #library_container_types, #library_container_upgrades, #library_instance_types, #library_layouts, #license, #load_balancers, #logs, #monitoring, #network_domains, #network_groups, #network_pool_servers, #network_pools, #network_proxies, #network_services, #networks, #option_type_lists, #option_types, #options, #packages, #policies, #power_schedules, #processes, #provision_types, #roles, #security_group_rules, #servers, #set_ssl_verification_enabled, #setup, #ssl_verification_enabled?, #storage_providers, #task_sets, #tasks, #user_groups, #user_settings, #user_sources, #users, #virtual_images, #whoami
Constructor Details
#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ AppsInterface
Returns a new instance of AppsInterface.
4
5
6
7
8
9
|
# File 'lib/morpheus/api/apps_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
#add_instance(app_id, options) ⇒ Object
60
61
62
63
64
65
66
|
# File 'lib/morpheus/api/apps_interface.rb', line 60
def add_instance(app_id, options)
url = "#{@base_url}/api/apps/#{app_id}/add-instance"
= { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
payload = options
opts = {method: :post, url: url, headers: , payload: payload.to_json}
execute(opts)
end
|
#apply_security_groups(id, options) ⇒ Object
126
127
128
129
130
131
132
|
# File 'lib/morpheus/api/apps_interface.rb', line 126
def apply_security_groups(id, options)
url = "#{@base_url}/api/apps/#{id}/security-groups"
= { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
payload = options
opts = {method: :post, url: url, headers: , payload: payload.to_json}
execute(opts)
end
|
#create(options) ⇒ Object
44
45
46
47
48
49
50
|
# File 'lib/morpheus/api/apps_interface.rb', line 44
def create(options)
url = "#{@base_url}/api/apps"
= { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
payload = options
opts = {method: :post, url: url, headers: , payload: payload.to_json}
execute(opts)
end
|
#destroy(id, params = {}) ⇒ Object
76
77
78
79
80
81
82
|
# File 'lib/morpheus/api/apps_interface.rb', line 76
def destroy(id, params={})
url = "#{@base_url}/api/apps/#{id}"
= { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
[:params] = params
opts = {method: :delete, url: url, headers: }
execute(opts)
end
|
#firewall_disable(id) ⇒ Object
105
106
107
108
109
110
|
# File 'lib/morpheus/api/apps_interface.rb', line 105
def firewall_disable(id)
url = "#{@base_url}/api/apps/#{id}/security-groups/disable"
= { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
opts = {method: :put, url: url, headers: }
execute(opts)
end
|
#firewall_enable(id) ⇒ Object
112
113
114
115
116
117
|
# File 'lib/morpheus/api/apps_interface.rb', line 112
def firewall_enable(id)
url = "#{@base_url}/api/apps/#{id}/security-groups/enable"
= { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
opts = {method: :put, url: url, headers: }
execute(opts)
end
|
#get(options = nil) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/morpheus/api/apps_interface.rb', line 12
def get(options=nil)
url = "#{@base_url}/api/apps"
= { params: {}, authorization: "Bearer #{@access_token}" }
if options.is_a?(Hash)
[:params].merge!(options)
elsif options.is_a?(Numeric)
url = "#{@base_url}/api/apps/#{options}"
elsif options.is_a?(String)
[:params]['name'] = options
end
opts = {method: :get, url: url, headers: }
execute(opts)
end
|
#remove_instance(app_id, options) ⇒ Object
68
69
70
71
72
73
74
|
# File 'lib/morpheus/api/apps_interface.rb', line 68
def remove_instance(app_id, options)
url = "#{@base_url}/api/apps/#{app_id}/remove-instance"
= { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
payload = options
opts = {method: :post, url: url, headers: , payload: payload.to_json}
execute(opts)
end
|
#restart(id) ⇒ Object
98
99
100
101
102
103
|
# File 'lib/morpheus/api/apps_interface.rb', line 98
def restart(id)
url = "#{@base_url}/api/apps/#{id}/restart"
= { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
opts = {method: :put, url: url, headers: }
execute(opts)
end
|
#security_groups(id) ⇒ Object
119
120
121
122
123
124
|
# File 'lib/morpheus/api/apps_interface.rb', line 119
def security_groups(id)
url = "#{@base_url}/api/apps/#{id}/security-groups"
= { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
opts = {method: :get, url: url, headers: }
execute(opts)
end
|
#start(id) ⇒ Object
91
92
93
94
95
96
|
# File 'lib/morpheus/api/apps_interface.rb', line 91
def start(id)
url = "#{@base_url}/api/apps/#{id}/start"
= { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
opts = {method: :put, url: url, headers: }
execute(opts)
end
|
#stop(id) ⇒ Object
84
85
86
87
88
89
|
# File 'lib/morpheus/api/apps_interface.rb', line 84
def stop(id)
url = "#{@base_url}/api/apps/#{id}/stop"
= { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
opts = {method: :put, url: url, headers: }
execute(opts)
end
|
#update(app_id, options) ⇒ Object
52
53
54
55
56
57
58
|
# File 'lib/morpheus/api/apps_interface.rb', line 52
def update(app_id, options)
url = "#{@base_url}/api/apps/#{app_id}"
= { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
payload = options
opts = {method: :put, url: url, headers: , payload: payload.to_json}
execute(opts)
end
|
#validate(options) ⇒ Object
26
27
28
29
30
31
32
33
|
# File 'lib/morpheus/api/apps_interface.rb', line 26
def validate(options)
url = "#{@base_url}/api/apps/validate"
= { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
payload = options
opts = {method: :post, url: url, headers: , payload: payload.to_json}
execute(opts)
end
|
#validate_instance(options) ⇒ Object
35
36
37
38
39
40
41
42
|
# File 'lib/morpheus/api/apps_interface.rb', line 35
def validate_instance(options)
url = "#{@base_url}/api/apps/validate-instance"
= { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
payload = options
opts = {method: :post, url: url, headers: , payload: payload.to_json}
execute(opts)
end
|