Class: RestGearGroup
- Inherits:
-
OpenShift::Model
- Object
- OpenShift::Model
- RestGearGroup
- Defined in:
- app/models/rest_gear_group.rb
Instance Attribute Summary collapse
-
#additional_gear_storage ⇒ Object
Returns the value of attribute additional_gear_storage.
-
#base_gear_storage ⇒ Object
Returns the value of attribute base_gear_storage.
-
#cartridges ⇒ Object
Returns the value of attribute cartridges.
-
#gear_profile ⇒ Object
Returns the value of attribute gear_profile.
-
#gears ⇒ Object
Returns the value of attribute gears.
-
#links ⇒ Object
Returns the value of attribute links.
-
#name ⇒ Object
Returns the value of attribute name.
-
#scales_from ⇒ Object
Returns the value of attribute scales_from.
-
#scales_to ⇒ Object
Returns the value of attribute scales_to.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
Instance Method Summary collapse
-
#initialize(group_instance, gear_states, url, nolinks = false) ⇒ RestGearGroup
constructor
A new instance of RestGearGroup.
- #to_xml(options = {}) ⇒ Object
Constructor Details
#initialize(group_instance, gear_states, url, nolinks = false) ⇒ RestGearGroup
Returns a new instance of RestGearGroup.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/models/rest_gear_group.rb', line 4 def initialize(group_instance, gear_states, url, nolinks=false) app = group_instance.app self.uuid = group_instance.uuid self.name = group_instance.name self.gear_profile = group_instance.node_profile self.gears = group_instance.gears.map{ |gear| {:id => gear.uuid, :state => gear_states[gear.uuid] || 'unknown'} } self.cartridges = group_instance.component_instances.map { |comp_inst| app.comp_instance_map[comp_inst].cart_properties.merge({:name => app.comp_instance_map[comp_inst].parent_cart_name}) } self.cartridges.delete_if{ |comp| comp[:name] == app.name } storage = group_instance.get_quota self.base_gear_storage = storage["base_gear_storage"] self.additional_gear_storage = storage["additional_gear_storage"] self.scales_to = group_instance.max self.scales_from = group_instance.min self.links = { "GET" => Link.new("Get gear group", "GET", URI::join(url, "domains/#{app.domain.namespace}/applications/#{app.name}/gear_groups/#{uuid}")) } unless nolinks end |
Instance Attribute Details
#additional_gear_storage ⇒ Object
Returns the value of attribute additional_gear_storage.
2 3 4 |
# File 'app/models/rest_gear_group.rb', line 2 def additional_gear_storage @additional_gear_storage end |
#base_gear_storage ⇒ Object
Returns the value of attribute base_gear_storage.
2 3 4 |
# File 'app/models/rest_gear_group.rb', line 2 def base_gear_storage @base_gear_storage end |
#cartridges ⇒ Object
Returns the value of attribute cartridges.
2 3 4 |
# File 'app/models/rest_gear_group.rb', line 2 def cartridges @cartridges end |
#gear_profile ⇒ Object
Returns the value of attribute gear_profile.
2 3 4 |
# File 'app/models/rest_gear_group.rb', line 2 def gear_profile @gear_profile end |
#gears ⇒ Object
Returns the value of attribute gears.
2 3 4 |
# File 'app/models/rest_gear_group.rb', line 2 def gears @gears end |
#links ⇒ Object
Returns the value of attribute links.
2 3 4 |
# File 'app/models/rest_gear_group.rb', line 2 def links @links end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'app/models/rest_gear_group.rb', line 2 def name @name end |
#scales_from ⇒ Object
Returns the value of attribute scales_from.
2 3 4 |
# File 'app/models/rest_gear_group.rb', line 2 def scales_from @scales_from end |
#scales_to ⇒ Object
Returns the value of attribute scales_to.
2 3 4 |
# File 'app/models/rest_gear_group.rb', line 2 def scales_to @scales_to end |
#uuid ⇒ Object
Returns the value of attribute uuid.
2 3 4 |
# File 'app/models/rest_gear_group.rb', line 2 def uuid @uuid end |
Instance Method Details
#to_xml(options = {}) ⇒ Object
22 23 24 25 |
# File 'app/models/rest_gear_group.rb', line 22 def to_xml(={}) [:tag_name] = "gear_group" super() end |