Class: RestApplication10
- Inherits:
-
OpenShift::Model
- Object
- OpenShift::Model
- RestApplication10
- Includes:
- LegacyBrokerHelper
- Defined in:
- app/models/rest_application10.rb
Instance Attribute Summary collapse
-
#aliases ⇒ Object
Returns the value of attribute aliases.
-
#app_url ⇒ Object
Returns the value of attribute app_url.
-
#cartridges ⇒ Object
Returns the value of attribute cartridges.
-
#creation_time ⇒ Object
Returns the value of attribute creation_time.
-
#domain_id ⇒ Object
Returns the value of attribute domain_id.
-
#embedded ⇒ Object
Returns the value of attribute embedded.
-
#framework ⇒ Object
Returns the value of attribute framework.
-
#gear_count ⇒ Object
Returns the value of attribute gear_count.
-
#gear_profile ⇒ Object
Returns the value of attribute gear_profile.
-
#git_url ⇒ Object
Returns the value of attribute git_url.
-
#health_check_path ⇒ Object
Returns the value of attribute health_check_path.
-
#links ⇒ Object
Returns the value of attribute links.
-
#name ⇒ Object
Returns the value of attribute name.
-
#scalable ⇒ Object
Returns the value of attribute scalable.
-
#scale_max ⇒ Object
Returns the value of attribute scale_max.
-
#scale_min ⇒ Object
Returns the value of attribute scale_min.
-
#ssh_url ⇒ Object
Returns the value of attribute ssh_url.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
Instance Method Summary collapse
-
#initialize(app, url, nolinks = false) ⇒ RestApplication10
constructor
A new instance of RestApplication10.
- #to_xml(options = {}) ⇒ Object
Methods included from LegacyBrokerHelper
Constructor Details
#initialize(app, url, nolinks = false) ⇒ RestApplication10
Returns a new instance of RestApplication10.
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'app/models/rest_application10.rb', line 6 def initialize(app, url, nolinks=false) self.framework = app.framework self.name = app.name self.creation_time = app.creation_time self.uuid = app.uuid self.aliases = app.aliases || Array.new self.gear_count = (app.gears.nil?) ? 0 : app.gears.length self. = app. self.domain_id = app.domain.namespace self.gear_profile = app.node_profile self.scalable = app.scalable self.scale_min,self.scale_max = app.scaling_limits self.git_url = "ssh://#{@uuid}@#{@name}-#{@domain_id}.#{Rails.configuration.openshift[:domain_suffix]}/~/git/#{@name}.git/" self.app_url = "http://#{@name}-#{@domain_id}.#{Rails.configuration.openshift[:domain_suffix]}/" self.ssh_url = "ssh://#{@uuid}@#{@name}-#{@domain_id}.#{Rails.configuration.openshift[:domain_suffix]}" self.health_check_path = app.health_check_path cart_type = "embedded" cache_key = "cart_list_#{cart_type}" unless nolinks carts = nil if app.scalable carts = Application::SCALABLE_EMBEDDED_CARTS else carts = get_cached(cache_key, :expires_in => 21600.seconds) do Application.get_available_cartridges("embedded") end end # Update carts list # - remove already embedded carts # - remove conflicting carts app..keys.each do |cname| carts -= [cname] cinfo = CartridgeCache.find_cartridge(cname) carts -= cinfo.conflicts_feature if defined?(cinfo.conflicts_feature) end if !app..empty? self.links = { "GET" => Link.new("Get application", "GET", URI::join(url, "domains/#{@domain_id}/applications/#{@name}")), "GET_DESCRIPTOR" => Link.new("Get application descriptor", "GET", URI::join(url, "domains/#{@domain_id}/applications/#{@name}/descriptor")), "GET_GEARS" => Link.new("Get application gears", "GET", URI::join(url, "domains/#{@domain_id}/applications/#{@name}/gears")), "GET_GEAR_GROUPS" => Link.new("Get application gear groups", "GET", URI::join(url, "domains/#{@domain_id}/applications/#{@name}/gear_groups")), "START" => Link.new("Start application", "POST", URI::join(url, "domains/#{@domain_id}/applications/#{@name}/events"), [ Param.new("event", "string", "event", "start") ]), "STOP" => Link.new("Stop application", "POST", URI::join(url, "domains/#{@domain_id}/applications/#{@name}/events"), [ Param.new("event", "string", "event", "stop") ]), "RESTART" => Link.new("Restart application", "POST", URI::join(url, "domains/#{@domain_id}/applications/#{@name}/events"), [ Param.new("event", "string", "event", "restart") ]), "FORCE_STOP" => Link.new("Force stop application", "POST", URI::join(url, "domains/#{@domain_id}/applications/#{@name}/events"), [ Param.new("event", "string", "event", "force-stop") ]), "EXPOSE_PORT" => Link.new("Expose port", "POST", URI::join(url, "domains/#{@domain_id}/applications/#{@name}/events"), [ Param.new("event", "string", "event", "expose-port") ]), "CONCEAL_PORT" => Link.new("Conceal port", "POST", URI::join(url, "domains/#{@domain_id}/applications/#{@name}/events"), [ Param.new("event", "string", "event", "conceal-port") ]), "SHOW_PORT" => Link.new("Show port", "POST", URI::join(url, "domains/#{@domain_id}/applications/#{@name}/events"), [ Param.new("event", "string", "event", "show-port") ]), "ADD_ALIAS" => Link.new("Add application alias", "POST", URI::join(url, "domains/#{@domain_id}/applications/#{@name}/events"), [ Param.new("event", "string", "event", "add-alias"), Param.new("alias", "string", "The server alias for the application") ]), "REMOVE_ALIAS" => Link.new("Remove application alias", "POST", URI::join(url, "domains/#{@domain_id}/applications/#{@name}/events"), [ Param.new("event", "string", "event", "remove-alias"), Param.new("alias", "string", "The application alias to be removed") ]), "SCALE_UP" => Link.new("Scale up application", "POST", URI::join(url, "domains/#{@domain_id}/applications/#{@name}/events"), [ Param.new("event", "string", "event", "scale-up") ]), "SCALE_DOWN" => Link.new("Scale down application", "POST", URI::join(url, "domains/#{@domain_id}/applications/#{@name}/events"), [ Param.new("event", "string", "event", "scale-down") ]), "TIDY" => Link.new("Tidy the application framework", "POST", URI::join(url, "domains/#{@domain_id}/applications/#{@name}/events"), [ Param.new("event", "string", "event", "tidy") ]), "RELOAD" => Link.new("Reload the application", "POST", URI::join(url, "domains/#{@domain_id}/applications/#{@name}/events"), [ Param.new("event", "string", "event", "reload") ]), "THREAD_DUMP" => Link.new("Trigger thread dump", "POST", URI::join(url, "domains/#{@domain_id}/applications/#{@name}/events"), [ Param.new("event", "string", "event", "thread-dump") ]), "DELETE" => Link.new("Delete application", "DELETE", URI::join(url, "domains/#{@domain_id}/applications/#{@name}")), "ADD_CARTRIDGE" => Link.new("Add embedded cartridge", "POST", URI::join(url, "domains/#{@domain_id}/applications/#{@name}/cartridges"),[ Param.new("cartridge", "string", "framework-type, e.g.: mongodb-2.2", carts) ]), "LIST_CARTRIDGES" => Link.new("List embedded cartridges", "GET", URI::join(url, "domains/#{@domain_id}/applications/#{@name}/cartridges")), "DNS_RESOLVABLE" => Link.new("Resolve DNS", "GET", URI::join(url, "domains/#{@domain_id}/applications/#{@name}/dns_resolvable")) } end end |
Instance Attribute Details
#aliases ⇒ Object
Returns the value of attribute aliases.
2 3 4 |
# File 'app/models/rest_application10.rb', line 2 def aliases @aliases end |
#app_url ⇒ Object
Returns the value of attribute app_url.
2 3 4 |
# File 'app/models/rest_application10.rb', line 2 def app_url @app_url end |
#cartridges ⇒ Object
Returns the value of attribute cartridges.
2 3 4 |
# File 'app/models/rest_application10.rb', line 2 def cartridges @cartridges end |
#creation_time ⇒ Object
Returns the value of attribute creation_time.
2 3 4 |
# File 'app/models/rest_application10.rb', line 2 def creation_time @creation_time end |
#domain_id ⇒ Object
Returns the value of attribute domain_id.
2 3 4 |
# File 'app/models/rest_application10.rb', line 2 def domain_id @domain_id end |
#embedded ⇒ Object
Returns the value of attribute embedded.
2 3 4 |
# File 'app/models/rest_application10.rb', line 2 def @embedded end |
#framework ⇒ Object
Returns the value of attribute framework.
2 3 4 |
# File 'app/models/rest_application10.rb', line 2 def framework @framework end |
#gear_count ⇒ Object
Returns the value of attribute gear_count.
2 3 4 |
# File 'app/models/rest_application10.rb', line 2 def gear_count @gear_count end |
#gear_profile ⇒ Object
Returns the value of attribute gear_profile.
2 3 4 |
# File 'app/models/rest_application10.rb', line 2 def gear_profile @gear_profile end |
#git_url ⇒ Object
Returns the value of attribute git_url.
2 3 4 |
# File 'app/models/rest_application10.rb', line 2 def git_url @git_url end |
#health_check_path ⇒ Object
Returns the value of attribute health_check_path.
2 3 4 |
# File 'app/models/rest_application10.rb', line 2 def health_check_path @health_check_path end |
#links ⇒ Object
Returns the value of attribute links.
2 3 4 |
# File 'app/models/rest_application10.rb', line 2 def links @links end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'app/models/rest_application10.rb', line 2 def name @name end |
#scalable ⇒ Object
Returns the value of attribute scalable.
2 3 4 |
# File 'app/models/rest_application10.rb', line 2 def scalable @scalable end |
#scale_max ⇒ Object
Returns the value of attribute scale_max.
2 3 4 |
# File 'app/models/rest_application10.rb', line 2 def scale_max @scale_max end |
#scale_min ⇒ Object
Returns the value of attribute scale_min.
2 3 4 |
# File 'app/models/rest_application10.rb', line 2 def scale_min @scale_min end |
#ssh_url ⇒ Object
Returns the value of attribute ssh_url.
2 3 4 |
# File 'app/models/rest_application10.rb', line 2 def ssh_url @ssh_url end |
#uuid ⇒ Object
Returns the value of attribute uuid.
2 3 4 |
# File 'app/models/rest_application10.rb', line 2 def uuid @uuid end |
Instance Method Details
#to_xml(options = {}) ⇒ Object
102 103 104 105 |
# File 'app/models/rest_application10.rb', line 102 def to_xml(={}) [:tag_name] = "application" super() end |