class RHC::Rest::Domain

Attributes

id[R]

Public Instance Methods

add_application(name, options) click to toggle source

Add Application to this domain

options
cartrdige
template
scale
gear_profile
# File lib/rhc/rest/domain.rb, line 14
def add_application(name, options)
  debug "Adding application #{name} to domain #{id}"

  payload = {:name => name}
  options.each do |key, value|
    payload[key] = value
  end
  timeout = nil
  if options[:scale]
    timeout = 300 # 5 minute timeout for scalable app
  end

  rest_method "ADD_APPLICATION", payload, timeout
end
applications() click to toggle source
# File lib/rhc/rest/domain.rb, line 29
def applications
  debug "Getting all applications for domain #{id}"
  rest_method "LIST_APPLICATIONS"
end
delete(force=false) click to toggle source
Alias for: destroy
destroy(force=false) click to toggle source
# File lib/rhc/rest/domain.rb, line 41
def destroy(force=false)
  debug "Deleting domain #{id}"
  rest_method "DELETE", :force => force
end
Also aliased as: delete
find_application(name, options={}) click to toggle source
# File lib/rhc/rest/domain.rb, line 47
def find_application(name, options={})
  if name.is_a?(Hash)
    options = name.merge(options)
    name = options[:name]
  end
  framework = options[:framework]

  debug "Finding application :name => #{name}, :framework => #{framework}"
  applications.each do |app|
    return app if (name.nil? or app.name == name) and (framework.nil? or app.framework == framework)
  end

  raise RHC::ApplicationNotFoundException.new("Application #{name} does not exist")
end
save(new_id) click to toggle source
Alias for: update
update(new_id) click to toggle source
# File lib/rhc/rest/domain.rb, line 34
def update(new_id)
  debug "Updating domain #{id} to #{new_id}"
  # 5 minute timeout as this may take time if there are a lot of apps
  rest_method "UPDATE", {:id => new_id}, 300
end
Also aliased as: save