Class: KuberKit::Core::ServiceDefinition
- Defined in:
- lib/kuber_kit/core/service_definition.rb
Instance Attribute Summary collapse
-
#dependencies ⇒ Object
readonly
Returns the value of attribute dependencies.
-
#service_name ⇒ Object
readonly
Returns the value of attribute service_name.
-
#template_name ⇒ Object
readonly
Returns the value of attribute template_name.
Instance Method Summary collapse
- #attributes(value = nil, &block) ⇒ Object
- #depends_on(*value, &block) ⇒ Object
- #deployer_strategy(value = nil, &block) ⇒ Object
- #images(*value, &block) ⇒ Object
-
#initialize(service_name) ⇒ ServiceDefinition
constructor
A new instance of ServiceDefinition.
- #tags(*value, &block) ⇒ Object
- #template(value = nil, &block) ⇒ Object
- #to_service_attrs ⇒ Object
Constructor Details
#initialize(service_name) ⇒ ServiceDefinition
Returns a new instance of ServiceDefinition.
5 6 7 8 |
# File 'lib/kuber_kit/core/service_definition.rb', line 5 def initialize(service_name) @service_name = service_name.to_sym @dependencies = [] end |
Instance Attribute Details
#dependencies ⇒ Object (readonly)
Returns the value of attribute dependencies.
2 3 4 |
# File 'lib/kuber_kit/core/service_definition.rb', line 2 def dependencies @dependencies end |
#service_name ⇒ Object (readonly)
Returns the value of attribute service_name.
2 3 4 |
# File 'lib/kuber_kit/core/service_definition.rb', line 2 def service_name @service_name end |
#template_name ⇒ Object (readonly)
Returns the value of attribute template_name.
2 3 4 |
# File 'lib/kuber_kit/core/service_definition.rb', line 2 def template_name @template_name end |
Instance Method Details
#attributes(value = nil, &block) ⇒ Object
45 46 47 48 49 |
# File 'lib/kuber_kit/core/service_definition.rb', line 45 def attributes(value = nil, &block) @attributes = block_given? ? block : value self end |
#depends_on(*value, &block) ⇒ Object
22 23 24 25 |
# File 'lib/kuber_kit/core/service_definition.rb', line 22 def depends_on(*value, &block) @dependencies = Array(value).flatten self end |
#deployer_strategy(value = nil, &block) ⇒ Object
51 52 53 54 55 |
# File 'lib/kuber_kit/core/service_definition.rb', line 51 def deployer_strategy(value = nil, &block) @deployer_strategy = block_given? ? block : value self end |
#images(*value, &block) ⇒ Object
39 40 41 42 43 |
# File 'lib/kuber_kit/core/service_definition.rb', line 39 def images(*value, &block) @images = block_given? ? block : Array(value).flatten self end |
#tags(*value, &block) ⇒ Object
33 34 35 36 37 |
# File 'lib/kuber_kit/core/service_definition.rb', line 33 def (*value, &block) @tags = block_given? ? block : Array(value).flatten self end |
#template(value = nil, &block) ⇒ Object
27 28 29 30 31 |
# File 'lib/kuber_kit/core/service_definition.rb', line 27 def template(value = nil, &block) @template_name = block_given? ? block : value self end |
#to_service_attrs ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/kuber_kit/core/service_definition.rb', line 10 def to_service_attrs OpenStruct.new( name: @service_name, dependencies: @dependencies, template_name: get_value(@template_name), tags: Array(get_value(@tags)).map(&:to_sym), images: Array(get_value(@images)).map(&:to_sym), attributes: get_value(@attributes), deployer_strategy: get_value(@deployer_strategy), ) end |