// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.gcp.cloudbuild.outputs;

import com.pulumi.core.annotations.CustomType;
import com.pulumi.gcp.cloudbuild.outputs.TriggerBuildArtifacts;
import com.pulumi.gcp.cloudbuild.outputs.TriggerBuildAvailableSecrets;
import com.pulumi.gcp.cloudbuild.outputs.TriggerBuildOptions;
import com.pulumi.gcp.cloudbuild.outputs.TriggerBuildSecret;
import com.pulumi.gcp.cloudbuild.outputs.TriggerBuildSource;
import com.pulumi.gcp.cloudbuild.outputs.TriggerBuildStep;
import java.lang.String;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;

@CustomType
public final class TriggerBuild {
    /**
     * @return Artifacts produced by the build that should be uploaded upon successful completion of all build steps.
     * Structure is documented below.
     * 
     */
    private @Nullable TriggerBuildArtifacts artifacts;
    /**
     * @return Secrets and secret environment variables.
     * Structure is documented below.
     * 
     */
    private @Nullable TriggerBuildAvailableSecrets availableSecrets;
    /**
     * @return A list of images to be pushed upon the successful completion of all build steps.
     * The images are pushed using the builder service account&#39;s credentials.
     * The digests of the pushed images will be stored in the Build resource&#39;s results field.
     * If any of the images fail to be pushed, the build status is marked FAILURE.
     * 
     */
    private @Nullable List<String> images;
    /**
     * @return Google Cloud Storage bucket where logs should be written.
     * Logs file names will be of the format ${logsBucket}/log-${build_id}.txt.
     * 
     */
    private @Nullable String logsBucket;
    /**
     * @return Special options for this build.
     * Structure is documented below.
     * 
     */
    private @Nullable TriggerBuildOptions options;
    /**
     * @return TTL in queue for this build. If provided and the build is enqueued longer than this value,
     * the build will expire and the build status will be EXPIRED.
     * The TTL starts ticking from createTime.
     * A duration in seconds with up to nine fractional digits, terminated by &#39;s&#39;. Example: &#34;3.5s&#34;.
     * 
     */
    private @Nullable String queueTtl;
    /**
     * @return Secrets to decrypt using Cloud Key Management Service.
     * Structure is documented below.
     * 
     */
    private @Nullable List<TriggerBuildSecret> secrets;
    /**
     * @return The location of the source files to build.
     * One of `storageSource` or `repoSource` must be provided.
     * Structure is documented below.
     * 
     */
    private @Nullable TriggerBuildSource source;
    /**
     * @return The operations to be performed on the workspace.
     * Structure is documented below.
     * 
     */
    private List<TriggerBuildStep> steps;
    /**
     * @return Substitutions data for Build resource.
     * 
     */
    private @Nullable Map<String,String> substitutions;
    /**
     * @return Tags for annotation of a Build. These are not docker tags.
     * 
     */
    private @Nullable List<String> tags;
    /**
     * @return Amount of time that this build should be allowed to run, to second granularity.
     * If this amount of time elapses, work on the build will cease and the build status will be TIMEOUT.
     * This timeout must be equal to or greater than the sum of the timeouts for build steps within the build.
     * The expected format is the number of seconds followed by s.
     * Default time is ten minutes (600s).
     * 
     */
    private @Nullable String timeout;

    private TriggerBuild() {}
    /**
     * @return Artifacts produced by the build that should be uploaded upon successful completion of all build steps.
     * Structure is documented below.
     * 
     */
    public Optional<TriggerBuildArtifacts> artifacts() {
        return Optional.ofNullable(this.artifacts);
    }
    /**
     * @return Secrets and secret environment variables.
     * Structure is documented below.
     * 
     */
    public Optional<TriggerBuildAvailableSecrets> availableSecrets() {
        return Optional.ofNullable(this.availableSecrets);
    }
    /**
     * @return A list of images to be pushed upon the successful completion of all build steps.
     * The images are pushed using the builder service account&#39;s credentials.
     * The digests of the pushed images will be stored in the Build resource&#39;s results field.
     * If any of the images fail to be pushed, the build status is marked FAILURE.
     * 
     */
    public List<String> images() {
        return this.images == null ? List.of() : this.images;
    }
    /**
     * @return Google Cloud Storage bucket where logs should be written.
     * Logs file names will be of the format ${logsBucket}/log-${build_id}.txt.
     * 
     */
    public Optional<String> logsBucket() {
        return Optional.ofNullable(this.logsBucket);
    }
    /**
     * @return Special options for this build.
     * Structure is documented below.
     * 
     */
    public Optional<TriggerBuildOptions> options() {
        return Optional.ofNullable(this.options);
    }
    /**
     * @return TTL in queue for this build. If provided and the build is enqueued longer than this value,
     * the build will expire and the build status will be EXPIRED.
     * The TTL starts ticking from createTime.
     * A duration in seconds with up to nine fractional digits, terminated by &#39;s&#39;. Example: &#34;3.5s&#34;.
     * 
     */
    public Optional<String> queueTtl() {
        return Optional.ofNullable(this.queueTtl);
    }
    /**
     * @return Secrets to decrypt using Cloud Key Management Service.
     * Structure is documented below.
     * 
     */
    public List<TriggerBuildSecret> secrets() {
        return this.secrets == null ? List.of() : this.secrets;
    }
    /**
     * @return The location of the source files to build.
     * One of `storageSource` or `repoSource` must be provided.
     * Structure is documented below.
     * 
     */
    public Optional<TriggerBuildSource> source() {
        return Optional.ofNullable(this.source);
    }
    /**
     * @return The operations to be performed on the workspace.
     * Structure is documented below.
     * 
     */
    public List<TriggerBuildStep> steps() {
        return this.steps;
    }
    /**
     * @return Substitutions data for Build resource.
     * 
     */
    public Map<String,String> substitutions() {
        return this.substitutions == null ? Map.of() : this.substitutions;
    }
    /**
     * @return Tags for annotation of a Build. These are not docker tags.
     * 
     */
    public List<String> tags() {
        return this.tags == null ? List.of() : this.tags;
    }
    /**
     * @return Amount of time that this build should be allowed to run, to second granularity.
     * If this amount of time elapses, work on the build will cease and the build status will be TIMEOUT.
     * This timeout must be equal to or greater than the sum of the timeouts for build steps within the build.
     * The expected format is the number of seconds followed by s.
     * Default time is ten minutes (600s).
     * 
     */
    public Optional<String> timeout() {
        return Optional.ofNullable(this.timeout);
    }

    public static Builder builder() {
        return new Builder();
    }

    public static Builder builder(TriggerBuild defaults) {
        return new Builder(defaults);
    }
    @CustomType.Builder
    public static final class Builder {
        private @Nullable TriggerBuildArtifacts artifacts;
        private @Nullable TriggerBuildAvailableSecrets availableSecrets;
        private @Nullable List<String> images;
        private @Nullable String logsBucket;
        private @Nullable TriggerBuildOptions options;
        private @Nullable String queueTtl;
        private @Nullable List<TriggerBuildSecret> secrets;
        private @Nullable TriggerBuildSource source;
        private List<TriggerBuildStep> steps;
        private @Nullable Map<String,String> substitutions;
        private @Nullable List<String> tags;
        private @Nullable String timeout;
        public Builder() {}
        public Builder(TriggerBuild defaults) {
    	      Objects.requireNonNull(defaults);
    	      this.artifacts = defaults.artifacts;
    	      this.availableSecrets = defaults.availableSecrets;
    	      this.images = defaults.images;
    	      this.logsBucket = defaults.logsBucket;
    	      this.options = defaults.options;
    	      this.queueTtl = defaults.queueTtl;
    	      this.secrets = defaults.secrets;
    	      this.source = defaults.source;
    	      this.steps = defaults.steps;
    	      this.substitutions = defaults.substitutions;
    	      this.tags = defaults.tags;
    	      this.timeout = defaults.timeout;
        }

        @CustomType.Setter
        public Builder artifacts(@Nullable TriggerBuildArtifacts artifacts) {
            this.artifacts = artifacts;
            return this;
        }
        @CustomType.Setter
        public Builder availableSecrets(@Nullable TriggerBuildAvailableSecrets availableSecrets) {
            this.availableSecrets = availableSecrets;
            return this;
        }
        @CustomType.Setter
        public Builder images(@Nullable List<String> images) {
            this.images = images;
            return this;
        }
        public Builder images(String... images) {
            return images(List.of(images));
        }
        @CustomType.Setter
        public Builder logsBucket(@Nullable String logsBucket) {
            this.logsBucket = logsBucket;
            return this;
        }
        @CustomType.Setter
        public Builder options(@Nullable TriggerBuildOptions options) {
            this.options = options;
            return this;
        }
        @CustomType.Setter
        public Builder queueTtl(@Nullable String queueTtl) {
            this.queueTtl = queueTtl;
            return this;
        }
        @CustomType.Setter
        public Builder secrets(@Nullable List<TriggerBuildSecret> secrets) {
            this.secrets = secrets;
            return this;
        }
        public Builder secrets(TriggerBuildSecret... secrets) {
            return secrets(List.of(secrets));
        }
        @CustomType.Setter
        public Builder source(@Nullable TriggerBuildSource source) {
            this.source = source;
            return this;
        }
        @CustomType.Setter
        public Builder steps(List<TriggerBuildStep> steps) {
            this.steps = Objects.requireNonNull(steps);
            return this;
        }
        public Builder steps(TriggerBuildStep... steps) {
            return steps(List.of(steps));
        }
        @CustomType.Setter
        public Builder substitutions(@Nullable Map<String,String> substitutions) {
            this.substitutions = substitutions;
            return this;
        }
        @CustomType.Setter
        public Builder tags(@Nullable List<String> tags) {
            this.tags = tags;
            return this;
        }
        public Builder tags(String... tags) {
            return tags(List.of(tags));
        }
        @CustomType.Setter
        public Builder timeout(@Nullable String timeout) {
            this.timeout = timeout;
            return this;
        }
        public TriggerBuild build() {
            final var o = new TriggerBuild();
            o.artifacts = artifacts;
            o.availableSecrets = availableSecrets;
            o.images = images;
            o.logsBucket = logsBucket;
            o.options = options;
            o.queueTtl = queueTtl;
            o.secrets = secrets;
            o.source = source;
            o.steps = steps;
            o.substitutions = substitutions;
            o.tags = tags;
            o.timeout = timeout;
            return o;
        }
    }
}
