org.eclipse.jkube.kit.enricher.api.model.Configuration Maven / Gradle / Ivy
/**
* Copyright (c) 2019 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at:
*
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.jkube.kit.enricher.api.model;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Singular;
import org.eclipse.jkube.kit.config.image.ImageConfiguration;
import org.eclipse.jkube.kit.config.resource.ProcessorConfig;
import org.eclipse.jkube.kit.config.resource.ResourceConfig;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.BiFunction;
import java.util.function.Function;
/**
* Configuration class which holds various configuration
* related components
*
* @author roland
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
@EqualsAndHashCode
public class Configuration {
/**
* List of image configuration used when building.
*/
private List images;
/**
* Configuration influencing the resource generation.
*/
private ResourceConfig resource;
/**
* Lookup plugin project configuration.
*/
private BiFunction>> pluginConfigLookup;
/**
* Lookup secret configuration.
*/
private Function>> secretConfigLookup;
/**
* Processor config which holds all the configuration for processors / enrichers.
*/
private ProcessorConfig processorConfig;
@Builder(toBuilder = true)
public Configuration(
@Singular List images, ResourceConfig resource,
BiFunction>> pluginConfigLookup,
Function>> secretConfigLookup, ProcessorConfig processorConfig) {
this.images = images;
this.resource = resource;
this.pluginConfigLookup = pluginConfigLookup;
this.secretConfigLookup = secretConfigLookup;
this.processorConfig = processorConfig;
}
/**
* Gets plugin configuration values. Since there can be inner values,
* it returns a Map of Objects where an Object can be a
* simple type, List or another Map.
*
* @param system the underlying build platform (e.g. "maven")
* @param id which plugin configuration to pick
* @return configuration map specific to this id
*/
public Optional