class Rhc::Rest::Domain

Attributes

namespace[R]

Public Class Methods

new(args) click to toggle source
# File lib/rhc-rest/domain.rb, line 28
def initialize(args)
  @namespace = args[:namespace] || args["namespace"]
  @links = args[:links] || args["links"]
end

Public Instance Methods

add_application(name, cartridge) click to toggle source

Add Application to this domain

# File lib/rhc-rest/domain.rb, line 34
def add_application(name, cartridge)
  logger.debug "Adding application #{name} to domain #{self.namespace}"
  url = @@end_point + @links['ADD_APPLICATION']['href']
  method =  @links['ADD_APPLICATION']['method']
  payload = {:name => name, :cartridge => cartridge}
  request = RestClient::Request.new(:url => url, :method => method, :headers => @@headers, :payload => payload)
  return send(request)
end
applications() click to toggle source

Get all Application for this domain

# File lib/rhc-rest/domain.rb, line 44
def applications
  logger.debug "Getting all applications for domain #{self.namespace}"
  url = @@end_point + @links['LIST_APPLICATIONS']['href']
  method =  @links['LIST_APPLICATIONS']['method']
  request = RestClient::Request.new(:url => url, :method => method, :headers => @@headers)
  return send(request)
end
delete(force=false) click to toggle source
Alias for: destroy
destroy(force=false) click to toggle source

Delete Domain

# File lib/rhc-rest/domain.rb, line 64
def destroy(force=false)
  logger.debug "Deleting domain #{self.namespace}"
  url = @@end_point + @links['DELETE']['href']
  method =  @links['DELETE']['method']
  payload[:force] = force if force
  request = RestClient::Request.new(:url => url, :method => method, :headers => @@headers)
  return send(request)
end
Also aliased as: delete
save(new_namespace) click to toggle source
Alias for: update
update(new_namespace) click to toggle source

Update Domain

# File lib/rhc-rest/domain.rb, line 53
def update(new_namespace)
  logger.debug "Updating domain #{self.namespace}"
  url = @@end_point + @links['UPDATE']['href']
  method =  @links['UPDATE']['method']
  payload = {:namespace => new_namespace}
  request = RestClient::Request.new(:url => url, :method => method, :headers => @@headers, :payload => payload)
  return send(request)
end
Also aliased as: save