// *** 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.cloudrunv2.outputs;

import com.pulumi.core.annotations.CustomType;
import com.pulumi.gcp.cloudrunv2.outputs.JobTemplateTemplate;
import java.lang.Integer;
import java.lang.String;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;

@CustomType
public final class JobTemplate {
    /**
     * @return Unstructured key value map that may be set by external tools to store and arbitrary metadata. They are not queryable and should be preserved when modifying objects.
     * Cloud Run API v2 does not support annotations with `run.googleapis.com`, `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev` namespaces, and they will be rejected.
     * All system annotations in v1 now have a corresponding field in v2 ExecutionTemplate.
     * This field follows Kubernetes annotations&#39; namespacing, limits, and rules.
     * 
     */
    private @Nullable Map<String,String> annotations;
    /**
     * @return Unstructured key value map that can be used to organize and categorize objects. User-provided labels are shared with Google&#39;s billing system, so they can be used to filter,
     * or break down billing charges by team, component, environment, state, etc. For more information, visit https://cloud.google.com/resource-manager/docs/creating-managing-labels or
     * https://cloud.google.com/run/docs/configuring/labels.
     * Cloud Run API v2 does not support labels with `run.googleapis.com`, `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev` namespaces, and they will be rejected.
     * All system labels in v1 now have a corresponding field in v2 ExecutionTemplate.
     * 
     */
    private @Nullable Map<String,String> labels;
    /**
     * @return Specifies the maximum desired number of tasks the execution should run at given time. Must be &lt;= taskCount. When the job is run, if this field is 0 or unset, the maximum possible value will be used for that execution. The actual number of tasks running in steady state will be less than this number when there are fewer tasks waiting to be completed remaining, i.e. when the work left to do is less than max parallelism.
     * 
     */
    private @Nullable Integer parallelism;
    /**
     * @return Specifies the desired number of tasks the execution should run. Setting to 1 means that parallelism is limited to 1 and the success of that task signals the success of the execution. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
     * 
     */
    private @Nullable Integer taskCount;
    /**
     * @return Describes the task(s) that will be created when executing an execution
     * Structure is documented below.
     * 
     */
    private JobTemplateTemplate template;

    private JobTemplate() {}
    /**
     * @return Unstructured key value map that may be set by external tools to store and arbitrary metadata. They are not queryable and should be preserved when modifying objects.
     * Cloud Run API v2 does not support annotations with `run.googleapis.com`, `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev` namespaces, and they will be rejected.
     * All system annotations in v1 now have a corresponding field in v2 ExecutionTemplate.
     * This field follows Kubernetes annotations&#39; namespacing, limits, and rules.
     * 
     */
    public Map<String,String> annotations() {
        return this.annotations == null ? Map.of() : this.annotations;
    }
    /**
     * @return Unstructured key value map that can be used to organize and categorize objects. User-provided labels are shared with Google&#39;s billing system, so they can be used to filter,
     * or break down billing charges by team, component, environment, state, etc. For more information, visit https://cloud.google.com/resource-manager/docs/creating-managing-labels or
     * https://cloud.google.com/run/docs/configuring/labels.
     * Cloud Run API v2 does not support labels with `run.googleapis.com`, `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev` namespaces, and they will be rejected.
     * All system labels in v1 now have a corresponding field in v2 ExecutionTemplate.
     * 
     */
    public Map<String,String> labels() {
        return this.labels == null ? Map.of() : this.labels;
    }
    /**
     * @return Specifies the maximum desired number of tasks the execution should run at given time. Must be &lt;= taskCount. When the job is run, if this field is 0 or unset, the maximum possible value will be used for that execution. The actual number of tasks running in steady state will be less than this number when there are fewer tasks waiting to be completed remaining, i.e. when the work left to do is less than max parallelism.
     * 
     */
    public Optional<Integer> parallelism() {
        return Optional.ofNullable(this.parallelism);
    }
    /**
     * @return Specifies the desired number of tasks the execution should run. Setting to 1 means that parallelism is limited to 1 and the success of that task signals the success of the execution. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
     * 
     */
    public Optional<Integer> taskCount() {
        return Optional.ofNullable(this.taskCount);
    }
    /**
     * @return Describes the task(s) that will be created when executing an execution
     * Structure is documented below.
     * 
     */
    public JobTemplateTemplate template() {
        return this.template;
    }

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

    public static Builder builder(JobTemplate defaults) {
        return new Builder(defaults);
    }
    @CustomType.Builder
    public static final class Builder {
        private @Nullable Map<String,String> annotations;
        private @Nullable Map<String,String> labels;
        private @Nullable Integer parallelism;
        private @Nullable Integer taskCount;
        private JobTemplateTemplate template;
        public Builder() {}
        public Builder(JobTemplate defaults) {
    	      Objects.requireNonNull(defaults);
    	      this.annotations = defaults.annotations;
    	      this.labels = defaults.labels;
    	      this.parallelism = defaults.parallelism;
    	      this.taskCount = defaults.taskCount;
    	      this.template = defaults.template;
        }

        @CustomType.Setter
        public Builder annotations(@Nullable Map<String,String> annotations) {
            this.annotations = annotations;
            return this;
        }
        @CustomType.Setter
        public Builder labels(@Nullable Map<String,String> labels) {
            this.labels = labels;
            return this;
        }
        @CustomType.Setter
        public Builder parallelism(@Nullable Integer parallelism) {
            this.parallelism = parallelism;
            return this;
        }
        @CustomType.Setter
        public Builder taskCount(@Nullable Integer taskCount) {
            this.taskCount = taskCount;
            return this;
        }
        @CustomType.Setter
        public Builder template(JobTemplateTemplate template) {
            this.template = Objects.requireNonNull(template);
            return this;
        }
        public JobTemplate build() {
            final var o = new JobTemplate();
            o.annotations = annotations;
            o.labels = labels;
            o.parallelism = parallelism;
            o.taskCount = taskCount;
            o.template = template;
            return o;
        }
    }
}
