Class: Megam::Mixins::CommonDeployable
- Inherits:
-
Object
- Object
- Megam::Mixins::CommonDeployable
- Includes:
- Nilavu::MegamAttributes
- Defined in:
- lib/megam/mixins/common_deployable.rb
Constant Summary collapse
- DEFAULT_VERTICE_PREFIX =
'vertice'.freeze
- DEFAULT_BITNAMI_PREFIX =
'bitnami'.freeze
- DEFAULT_DOCKER_PREFIX =
'docker'.freeze
- ATTRIBUTES =
[ :tosca_type, :status, :state, :inputs]
Constants included from Nilavu::MegamAttributes
Nilavu::MegamAttributes::KEY, Nilavu::MegamAttributes::VALUE
Instance Attribute Summary collapse
-
#inputs ⇒ Object
readonly
Returns the value of attribute inputs.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#tosca_type ⇒ Object
readonly
Returns the value of attribute tosca_type.
Instance Method Summary collapse
- #attributes ⇒ Object
- #bld_toscatype(params) ⇒ Object
-
#initialize(params) ⇒ CommonDeployable
constructor
A new instance of CommonDeployable.
- #to_hash ⇒ Object
Methods included from Nilavu::MegamAttributes
Constructor Details
#initialize(params) ⇒ CommonDeployable
Returns a new instance of CommonDeployable.
23 24 25 26 27 28 29 30 31 |
# File 'lib/megam/mixins/common_deployable.rb', line 23 def initialize(params) @tosca_type = '' @status = 'initialized' @state = 'initialized' bld_toscatype(params) set_attributes(params) @inputs = InputGroupData.new(params) end |
Instance Attribute Details
#inputs ⇒ Object (readonly)
Returns the value of attribute inputs.
7 8 9 |
# File 'lib/megam/mixins/common_deployable.rb', line 7 def inputs @inputs end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
7 8 9 |
# File 'lib/megam/mixins/common_deployable.rb', line 7 def state @state end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
7 8 9 |
# File 'lib/megam/mixins/common_deployable.rb', line 7 def status @status end |
#tosca_type ⇒ Object (readonly)
Returns the value of attribute tosca_type.
7 8 9 |
# File 'lib/megam/mixins/common_deployable.rb', line 7 def tosca_type @tosca_type end |
Instance Method Details
#attributes ⇒ Object
19 20 21 |
# File 'lib/megam/mixins/common_deployable.rb', line 19 def attributes ATTRIBUTES end |
#bld_toscatype(params) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/megam/mixins/common_deployable.rb', line 42 def bld_toscatype(params) case params[:scm_name] when DEFAULT_BITNAMI_PREFIX @tosca_type = DEFAULT_BITNAMI_PREFIX + ".#{params[:cattype].downcase}.#{params[:mkp_name].downcase}" if params[:cattype] != nil && params[:mkp_name] != nil when DEFAULT_DOCKER_PREFIX @tosca_type = DEFAULT_DOCKER_PREFIX + ".#{params[:cattype].downcase}.#{params[:mkp_name].downcase}" if params[:cattype] != nil && params[:mkp_name] != nil else @tosca_type = DEFAULT_VERTICE_PREFIX + ".#{params[:cattype].downcase}.#{params[:mkp_name].downcase}" if params[:cattype] != nil && params[:mkp_name] != nil end end |
#to_hash ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/megam/mixins/common_deployable.rb', line 33 def to_hash h = { status: status, state: state, tosca_type: tosca_type, inputs: inputs.to_hash } end |