Sha256: 255302208cce6edfb9ca2fceff01300b3f051fd30d4f44f5dd07554776ebe787
Contents?: true
Size: 1.75 KB
Versions: 2
Compression:
Stored size: 1.75 KB
Contents
class KuberKit::Core::ConfigurationDefinition ResourceAlreadyAdded = Class.new(KuberKit::Error) attr_reader :configuration_name Contract Or[Symbol, String] => Any def initialize(configuration_name) @configuration_name = configuration_name.to_sym @artifacts = {} @registries = {} @env_files = {} @templates = {} end def to_attrs OpenStruct.new( name: @configuration_name, artifacts: @artifacts, registries: @registries, env_files: @env_files, templates: @templates, kubeconfig_path: @kubeconfig_path, deploy_strategy: @deploy_strategy ) end def use_artifact(artifact_name, as:) if @artifacts.has_key?(as) raise ResourceAlreadyAdded.new("alias name :#{as} is already used by artifact: #{@artifacts[as].inspect}") end @artifacts[as] = artifact_name self end def use_registry(registry_name, as:) if @registries.has_key?(as) raise ResourceAlreadyAdded.new("alias name :#{as} is already used by registry: #{@registries[as].inspect}") end @registries[as] = registry_name self end def use_env_file(env_file_name, as:) if @env_files.has_key?(as) raise ResourceAlreadyAdded.new("alias name :#{as} is already used by env_file: #{@env_files[as].inspect}") end @env_files[as] = env_file_name self end def use_template(template_name, as:) if @templates.has_key?(as) raise ResourceAlreadyAdded.new("alias name :#{as} is already used by template: #{@templates[as].inspect}") end @templates[as] = template_name self end def kubeconfig_path(path) @kubeconfig_path = path self end def deploy_strategy(path) @deploy_strategy = path self end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kuber_kit-0.1.5 | lib/kuber_kit/core/configuration_definition.rb |
kuber_kit-0.1.4 | lib/kuber_kit/core/configuration_definition.rb |