Class: Morpheus::AppsInterface

Inherits:
APIClient show all
Defined in:
lib/morpheus/api/apps_interface.rb

Constant Summary

Constants inherited from APIClient

Morpheus::APIClient::CLIENT_ID

Instance Method Summary collapse

Methods inherited from APIClient

#account_groups, #account_users, #accounts, #activity, #appliance_settings, #approvals, #apps, #archive_buckets, #archive_files, #audit, #auth, #authorization_required?, #backup_jobs, #backup_restores, #backup_results, #backup_service_types, #backup_services, #backup_settings, #backup_types, #backups, #billing, #blueprints, #budgets, #catalog, #catalog_item_types, #certificate_types, #certificates, #client_id, #client_id=, #clients, #cloud_datastores, #cloud_folders, #cloud_policies, #cloud_resource_pools, #clouds, #clusters, #common_interface_options, #containers, #credential_types, #credentials, #cypher, #dashboard, #datastores, #default_content_type, #default_timeout, #deploy, #deployments, #dry, #dry_run, #email_templates, #environments, #execute, #execute_schedules, #execution_request, #file_copy_request, #forgot, #group_policies, #groups, #guidance, #guidance_settings, #health, #hub, #image_builder, #initialize, #inspect, #instance_types, #instances, #integration_types, #integrations, #interface, #invoice_line_items, #invoices, #jobs, #key_pairs, #library_cluster_layouts, #library_cluster_packages, #library_container_scripts, #library_container_templates, #library_container_types, #library_container_upgrades, #library_instance_types, #library_layouts, #library_operating_systems, #library_spec_template_types, #library_spec_templates, #license, #load_balancer_monitors, #load_balancer_pool_nodes, #load_balancer_pools, #load_balancer_pools_secondary, #load_balancer_profiles, #load_balancer_types, #load_balancer_virtual_servers, #load_balancers, #log_settings, #logged_in?, #login, #logout, #logs, #monitoring, #monitoring_settings, #network_dhcp_relays, #network_dhcp_servers, #network_domain_records, #network_domains, #network_edge_clusters, #network_floating_ips, #network_groups, #network_pool_ips, #network_pool_server_types, #network_pool_servers, #network_pools, #network_proxies, #network_resource_types, #network_routers, #network_security_server_types, #network_security_servers, #network_server_groups, #network_server_services, #network_server_types, #network_servers, #network_services, #network_static_routes, #network_types, #networks, #old_cypher, #option_type_forms, #option_type_lists, #option_types, #options, #packages, #ping, #plugins, #policies, #power_schedules, #price_sets, #prices, #processes, #projects, #provision_types, #provisioning_license_types, #provisioning_licenses, #provisioning_settings, #reports, #resource_pool_groups, #rest, #roles, #scale_thresholds, #search, #security_group_rules, #security_package_types, #security_packages, #security_scans, #server_types, #servers, #service_plans, #set_ssl_verification_enabled, #setopts, #setup, #snapshots, #ssl_verification_enabled?, #storage_providers, #storage_server_types, #storage_servers, #storage_volume_types, #storage_volumes, #subnet_types, #subnets, #task_sets, #tasks, #to_s, #url, #usage, #use_refresh_token, #user_groups, #user_settings, #user_sources, #users, #vdi, #vdi_allocations, #vdi_apps, #vdi_gateways, #vdi_pools, #virtual_images, #whitelabel_settings, #whoami, #withopts

Constructor Details

This class inherits a constructor from Morpheus::APIClient

Instance Method Details

#add_instance(app_id, payload) ⇒ Object



88
89
90
91
92
93
# File 'lib/morpheus/api/apps_interface.rb', line 88

def add_instance(app_id, payload)
  url = "#{@base_url}/api/apps/#{app_id}/add-instance"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end

#apply(app_id, params, payload) ⇒ Object



74
75
76
77
78
79
# File 'lib/morpheus/api/apps_interface.rb', line 74

def apply(app_id, params, payload)
  url = "#{@base_url}/api/apps/#{app_id}/apply"
  headers = {:params => params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end

#apply_security_groups(id, payload) ⇒ Object



159
160
161
162
163
164
# File 'lib/morpheus/api/apps_interface.rb', line 159

def apply_security_groups(id, payload)
  url = "#{@base_url}/api/apps/#{id}/security-groups"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end

#cancel_removal(id, params = {}) ⇒ Object



110
111
112
113
114
115
# File 'lib/morpheus/api/apps_interface.rb', line 110

def cancel_removal(id, params = {})
  url = "#{@base_url}/api/apps/#{id}/cancel-removal"
  headers = {:params => params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :put, url: url, headers: headers}
  execute(opts)
end

#create(payload) ⇒ Object



39
40
41
42
43
44
# File 'lib/morpheus/api/apps_interface.rb', line 39

def create(payload)
  url = "#{@base_url}/api/apps"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end

#destroy(id, params = {}) ⇒ Object



102
103
104
105
106
107
108
# File 'lib/morpheus/api/apps_interface.rb', line 102

def destroy(id, params={})
  url = "#{@base_url}/api/apps/#{id}"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  headers[:params] = params
  opts = {method: :delete, url: url, headers: headers}
  execute(opts)
end

#firewall_disable(id) ⇒ Object



138
139
140
141
142
143
# File 'lib/morpheus/api/apps_interface.rb', line 138

def firewall_disable(id)
  url = "#{@base_url}/api/apps/#{id}/security-groups/disable"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :put, url: url, headers: headers}
  execute(opts)
end

#firewall_enable(id) ⇒ Object



145
146
147
148
149
150
# File 'lib/morpheus/api/apps_interface.rb', line 145

def firewall_enable(id)
  url = "#{@base_url}/api/apps/#{id}/security-groups/enable"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :put, url: url, headers: headers}
  execute(opts)
end

#get(params = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/morpheus/api/apps_interface.rb', line 5

def get(params={})
  url = "#{@base_url}/api/apps"
  headers = { params: {}, authorization: "Bearer #{@access_token}" }
  if params.is_a?(Hash)
    headers[:params].merge!(params)
  elsif params.is_a?(Numeric)
    url = "#{@base_url}/api/apps/#{params}"
  elsif params.is_a?(String)
    headers[:params]['name'] = params
  end
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end

#list(params = {}) ⇒ Object



19
20
21
# File 'lib/morpheus/api/apps_interface.rb', line 19

def list(params={})
  get(params)
end

#prepare_apply(app_id, params = {}) ⇒ Object



60
61
62
63
64
65
# File 'lib/morpheus/api/apps_interface.rb', line 60

def prepare_apply(app_id, params={})
  url = "#{@base_url}/api/apps/#{app_id}/prepare-apply"
  headers = {:params => params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end

#refresh(app_id, params, payload) ⇒ Object



53
54
55
56
57
58
# File 'lib/morpheus/api/apps_interface.rb', line 53

def refresh(app_id, params, payload)
  url = "#{@base_url}/api/apps/#{app_id}/refresh"
  headers = {:params => params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end

#remove_instance(app_id, payload) ⇒ Object



95
96
97
98
99
100
# File 'lib/morpheus/api/apps_interface.rb', line 95

def remove_instance(app_id, payload)
  url = "#{@base_url}/api/apps/#{app_id}/remove-instance"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end

#restart(id) ⇒ Object



131
132
133
134
135
136
# File 'lib/morpheus/api/apps_interface.rb', line 131

def restart(id)
  url = "#{@base_url}/api/apps/#{id}/restart"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :put, url: url, headers: headers}
  execute(opts)
end

#security_groups(id) ⇒ Object



152
153
154
155
156
157
# File 'lib/morpheus/api/apps_interface.rb', line 152

def security_groups(id)
  url = "#{@base_url}/api/apps/#{id}/security-groups"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end

#start(id) ⇒ Object



124
125
126
127
128
129
# File 'lib/morpheus/api/apps_interface.rb', line 124

def start(id)
  url = "#{@base_url}/api/apps/#{id}/start"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :put, url: url, headers: headers}
  execute(opts)
end

#state(id, params = {}) ⇒ Object



81
82
83
84
85
86
# File 'lib/morpheus/api/apps_interface.rb', line 81

def state(id, params={})
  url = "#{@base_url}/api/apps/#{id}/state"
  headers = { params: params, authorization: "Bearer #{@access_token}" }
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end

#stop(id) ⇒ Object



117
118
119
120
121
122
# File 'lib/morpheus/api/apps_interface.rb', line 117

def stop(id)
  url = "#{@base_url}/api/apps/#{id}/stop"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :put, url: url, headers: headers}
  execute(opts)
end

#update(app_id, payload) ⇒ Object



46
47
48
49
50
51
# File 'lib/morpheus/api/apps_interface.rb', line 46

def update(app_id, payload)
  url = "#{@base_url}/api/apps/#{app_id}"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :put, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end

#update_wiki(id, payload) ⇒ Object



173
174
175
176
177
178
# File 'lib/morpheus/api/apps_interface.rb', line 173

def update_wiki(id, payload)
  url = "#{@base_url}/api/apps/#{id}/wiki"
  headers = {authorization: "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :put, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end

#validate(payload) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/morpheus/api/apps_interface.rb', line 23

def validate(payload)
  # url = "#{@base_url}/api/apps/validate-instance"
  url = "#{@base_url}/api/apps/validate"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end

#validate_apply(app_id, params, payload) ⇒ Object



67
68
69
70
71
72
# File 'lib/morpheus/api/apps_interface.rb', line 67

def validate_apply(app_id, params, payload)
  url = "#{@base_url}/api/apps/#{app_id}/validate-apply"
  headers = {:params => params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end

#validate_instance(payload) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/morpheus/api/apps_interface.rb', line 31

def validate_instance(payload)
  # url = "#{@base_url}/api/apps/validate-instance"
  url = "#{@base_url}/api/apps/validate-instance"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end

#wiki(id, params) ⇒ Object



166
167
168
169
170
171
# File 'lib/morpheus/api/apps_interface.rb', line 166

def wiki(id, params)
  url = "#{@base_url}/api/apps/#{id}/wiki"
  headers = { params: params, authorization: "Bearer #{@access_token}" }
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end