class Morpheus::CloudsInterface

Public Instance Methods

apply_security_groups(id, payload) click to toggle source
# File lib/morpheus/api/clouds_interface.rb, line 98
def apply_security_groups(id, payload)
  url = "#{@base_url}/api/zones/#{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
cloud_type(params) click to toggle source
# File lib/morpheus/api/clouds_interface.rb, line 12
def cloud_type(params)
  url = "#{@base_url}/api/zone-types"
  headers = { params: {}, authorization: "Bearer #{@access_token}" }

  if params.is_a?(Hash)
    headers[:params].merge!(params)
  elsif params.is_a?(Numeric)
    url = "#{@base_url}/api/zone-types/#{params}"
  elsif params.is_a?(String)
    headers[:params]['name'] = params
  end
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end
cloud_types(params={}) click to toggle source
# File lib/morpheus/api/clouds_interface.rb, line 5
def cloud_types(params={})
  url = "#{@base_url}/api/zone-types"
  headers = { params: params, authorization: "Bearer #{@access_token}" }
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end
create(payload) click to toggle source
# File lib/morpheus/api/clouds_interface.rb, line 42
def create(payload)
  url = "#{@base_url}/api/zones"
  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/clouds_interface.rb, line 56
def destroy(id, params={})
  url = "#{@base_url}/api/zones/#{id}"
  headers = { :params => params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :delete, url: url, headers: headers}
  execute(opts)
end
firewall_disable(id) click to toggle source
# File lib/morpheus/api/clouds_interface.rb, line 77
def firewall_disable(id)
  url = "#{@base_url}/api/zones/#{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/clouds_interface.rb, line 84
def firewall_enable(id)
  url = "#{@base_url}/api/zones/#{id}/security-groups/enable"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :put, url: url, headers: headers}
  execute(opts)
end
get(id, params={}) click to toggle source
# File lib/morpheus/api/clouds_interface.rb, line 27
def get(id, params={})
  validate_id!(id)
  url = "#{@base_url}/api/zones/#{id}"
  headers = { params: params, authorization: "Bearer #{@access_token}" }
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end
list(params={}) click to toggle source
# File lib/morpheus/api/clouds_interface.rb, line 35
def list(params={})
  url = "#{@base_url}/api/zones"
  headers = { params: params, authorization: "Bearer #{@access_token}" }
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end
refresh(id, params={}, payload={}) click to toggle source
# File lib/morpheus/api/clouds_interface.rb, line 63
def refresh(id, params={}, payload={})
  url = "#{@base_url}/api/zones/#{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
security_groups(id) click to toggle source
# File lib/morpheus/api/clouds_interface.rb, line 91
def security_groups(id)
  url = "#{@base_url}/api/zones/#{id}/security-groups"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end
sync(id, params={}, payload={}) click to toggle source
# File lib/morpheus/api/clouds_interface.rb, line 70
def sync(id, params={}, payload={})
  url = "#{@base_url}/api/zones/#{id}/sync"
  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
update(id, payload) click to toggle source
# File lib/morpheus/api/clouds_interface.rb, line 49
def update(id, payload)
  url = "#{@base_url}/api/zones/#{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/clouds_interface.rb, line 112
def update_wiki(id, payload)
  url = "#{@base_url}/api/zones/#{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
wiki(id, params) click to toggle source
# File lib/morpheus/api/clouds_interface.rb, line 105
def wiki(id, params)
  url = "#{@base_url}/api/zones/#{id}/wiki"
  headers = { params: params, authorization: "Bearer #{@access_token}" }
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end