Class: Deltacloud::DSL::InstanceProfile
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Deltacloud::DSL::InstanceProfile
- Defined in:
- lib/instance_profile.rb
Instance Method Summary collapse
- #define {|_self| ... } ⇒ Object
-
#initialize(name, &block) ⇒ InstanceProfile
constructor
A new instance of InstanceProfile.
-
#to_instance_params ⇒ Object
Convert InstanceProfile to DeltaCloud create_instance method parameters.
Constructor Details
#initialize(name, &block) ⇒ InstanceProfile
Returns a new instance of InstanceProfile.
12 13 14 15 |
# File 'lib/instance_profile.rb', line 12 def initialize(name, &block) super(:name => name) define &block end |
Instance Method Details
#define {|_self| ... } ⇒ Object
17 18 19 |
# File 'lib/instance_profile.rb', line 17 def define(&block) yield self if block_given? end |
#to_instance_params ⇒ Object
Convert InstanceProfile to DeltaCloud create_instance method parameters. Some property names varies from the names used in DeltaCloud. This method will deal with them.
25 26 27 28 29 30 31 32 |
# File 'lib/instance_profile.rb', line 25 def to_instance_params params = self.marshal_dump params[:hardware_profile] = params.delete(:name) params[:hwp_memory] = params.delete(:memory) unless params[:memory].nil? params[:hwp_cpu] = params.delete(:cpu) unless params[:cpu].nil? params[:hwp_storage] = params.delete(:storage) unless params[:storage].nil? params end |