001/*
002 * Copyright 2017-2024 original authors
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package io.micronaut.maven.jib;
017
018import java.util.List;
019import java.util.Optional;
020import java.util.Set;
021
022/**
023 * Represents the Jib plugin configuration.
024 *
025 * @param from The from configuration.
026 * @param to The to configuration.
027 * @param container The container configuration.
028 * @param outputPaths The output paths configuration.
029 * @since 4.7.0
030 */
031public record JibConfiguration(Optional<FromConfiguration> from, Optional<ToConfiguration> to, Optional<ContainerConfiguration> container,
032                               Optional<OutputPathsConfiguration> outputPaths) {
033
034    /**
035     * Represents the authentication configuration.
036     *
037     * @param username The username.
038     * @param password The password.
039     */
040    public record AuthConfiguration(Optional<String> username, Optional<String> password) { }
041
042    /**
043     * Represents the from configuration.
044     *
045     * @param image The image.
046     * @param auth The authentication configuration.
047     * @param platforms The platforms configuration.
048     */
049    public record FromConfiguration(Optional<String> image, Optional<AuthConfiguration> auth, Set<PlatformConfiguration> platforms) { }
050
051    /**
052     * Represents a platform configuration.
053     *
054     * @param architecture The architecture.
055     * @param os The operating system.
056     */
057    public record PlatformConfiguration(Optional<String> architecture, Optional<String> os) { }
058
059    /**
060     * Represents the to configuration.
061     *
062     * @param image The image.
063     * @param tags The tags.
064     * @param auth The authentication configuration.
065     */
066    public record ToConfiguration(Optional<String> image, Set<String> tags, Optional<AuthConfiguration> auth) { }
067
068    /**
069     * Represents the container configuration.
070     *
071     * @param workingDirectory The working directory.
072     * @param ports The ports.
073     * @param args The arguments.
074     * @param labels The labels.
075     * @param entrypoint The entrypoint.
076     * @param user The user.
077     */
078    public record ContainerConfiguration(Optional<String> workingDirectory, Set<String> ports, List<String> args, Set<String> labels,
079                                         List<String> entrypoint, Optional<String> user) { }
080
081    /**
082     * Represents the output paths configuration.
083     *
084     * @param tar The tar image output path.
085     */
086    public record OutputPathsConfiguration(Optional<String> tar) { }
087}