class Morpheus::AppsInterface

Public Instance Methods

add_instance(app_id, payload) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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 = {}) click to toggle source
# 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) click to toggle source
# 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={}) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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={}) click to toggle source
# 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={}) click to toggle source
# File lib/morpheus/api/apps_interface.rb, line 19
def list(params={})
  get(params)
end
prepare_apply(app_id, params={}) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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={}) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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