Class: RestDomain10

Inherits:
OpenShift::Model
  • Object
show all
Includes:
LegacyBrokerHelper
Defined in:
app/models/rest_domain10.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from LegacyBrokerHelper

#get_cached

Constructor Details

#initialize(domain, url, nolinks = false) ⇒ RestDomain10

Returns a new instance of RestDomain10.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/models/rest_domain10.rb', line 5

def initialize(domain, url, nolinks=false)
  self.id = domain.namespace
  self.suffix = Rails.application.config.openshift[:domain_suffix] 
  
  unless nolinks      
    valid_sizes = OpenShift::ApplicationContainerProxy.valid_gear_sizes(domain.user)
    blacklisted_words = OpenShift::ApplicationContainerProxy.get_blacklisted

    carts = get_cached("cart_list_standalone", :expires_in => 21600.seconds) do
      Application.get_available_cartridges("standalone")
    end

    self.links = {
      "GET" => Link.new("Get domain", "GET", URI::join(url, "domains/#{id}")),
      "LIST_APPLICATIONS" => Link.new("List applications", "GET", URI::join(url, "domains/#{id}/applications")),
      "ADD_APPLICATION" => Link.new("Create new application", "POST", URI::join(url, "domains/#{id}/applications"), 
        [Param.new("name", "string", "Name of the application",nil,blacklisted_words)], 
        [OptionalParam.new("cartridge", "string", "framework-type, e.g: php-5.3", carts),
        OptionalParam.new("template", "string", "UUID of the application template"),
        OptionalParam.new("scale", "boolean", "Mark application as scalable", [true, false], false),
        OptionalParam.new("gear_profile", "string", "The size of the gear", valid_sizes, valid_sizes[0])
      ]),
      "UPDATE" => Link.new("Update domain", "PUT", URI::join(url, "domains/#{id}"),[
        Param.new("id", "string", "Name of the domain")
      ]),
      "DELETE" => Link.new("Delete domain", "DELETE", URI::join(url, "domains/#{id}"),nil,[
        OptionalParam.new("force", "boolean", "Force delete domain.  i.e. delete any applications under this domain", [true, false], false)
      ])
    }
  end
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



2
3
4
# File 'app/models/rest_domain10.rb', line 2

def id
  @id
end

Returns the value of attribute links.



2
3
4
# File 'app/models/rest_domain10.rb', line 2

def links
  @links
end

#suffixObject

Returns the value of attribute suffix.



2
3
4
# File 'app/models/rest_domain10.rb', line 2

def suffix
  @suffix
end

Instance Method Details

#to_xml(options = {}) ⇒ Object



37
38
39
40
# File 'app/models/rest_domain10.rb', line 37

def to_xml(options={})
  options[:tag_name] = "domain"
  super(options)
end