Sha256: 32b0f3a0f80aa254dd6e5e73bb8413511ae2e75eb77dd4e249c09a60dd3fde79

Contents?: true

Size: 748 Bytes

Versions: 8

Compression:

Stored size: 748 Bytes

Contents

class KuberKit::Core::ServiceFactory
  AttributeNotSetError = Class.new(KuberKit::Error)

  def create(definition)
    service_attrs = definition.to_service_attrs

    if service_attrs.template_name.nil?
      raise AttributeNotSetError, "Please set template for service using #template method"
    end

    configuration_attributes = KuberKit.current_configuration.service_attributes(service_attrs.name)
    attributes = (service_attrs.attributes || {}).merge(configuration_attributes)

    KuberKit::Core::Service.new(
      name:           service_attrs.name,
      template_name:  service_attrs.template_name,
      tags:           service_attrs.tags,
      images:         service_attrs.images,
      attributes:     attributes
    )
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
kuber_kit-0.2.3 lib/kuber_kit/core/service_factory.rb
kuber_kit-0.2.2 lib/kuber_kit/core/service_factory.rb
kuber_kit-0.2.1 lib/kuber_kit/core/service_factory.rb
kuber_kit-0.2.0 lib/kuber_kit/core/service_factory.rb
kuber_kit-0.1.9 lib/kuber_kit/core/service_factory.rb
kuber_kit-0.1.8 lib/kuber_kit/core/service_factory.rb
kuber_kit-0.1.7 lib/kuber_kit/core/service_factory.rb
kuber_kit-0.1.6 lib/kuber_kit/core/service_factory.rb