"use strict";
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Job = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * A Cloud Run Job resource that references a container image which is run to completion.
 *
 * To get more information about Job, see:
 *
 * * [API documentation](https://cloud.google.com/run/docs/reference/rest/v2/projects.locations.jobs)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/run/docs/)
 *
 * ## Example Usage
 *
 * ### Cloudrunv2 Job Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.cloudrunv2.Job("default", {
 *     name: "cloudrun-job",
 *     location: "us-central1",
 *     deletionProtection: false,
 *     template: {
 *         template: {
 *             containers: [{
 *                 image: "us-docker.pkg.dev/cloudrun/container/job",
 *             }],
 *         },
 *     },
 * });
 * ```
 * ### Cloudrunv2 Job Limits
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.cloudrunv2.Job("default", {
 *     name: "cloudrun-job",
 *     location: "us-central1",
 *     deletionProtection: false,
 *     template: {
 *         template: {
 *             containers: [{
 *                 image: "us-docker.pkg.dev/cloudrun/container/job",
 *                 resources: {
 *                     limits: {
 *                         cpu: "2",
 *                         memory: "1024Mi",
 *                     },
 *                 },
 *             }],
 *         },
 *     },
 * });
 * ```
 * ### Cloudrunv2 Job Sql
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const secret = new gcp.secretmanager.Secret("secret", {
 *     secretId: "secret",
 *     replication: {
 *         auto: {},
 *     },
 * });
 * const instance = new gcp.sql.DatabaseInstance("instance", {
 *     name: "cloudrun-sql",
 *     region: "us-central1",
 *     databaseVersion: "MYSQL_5_7",
 *     settings: {
 *         tier: "db-f1-micro",
 *     },
 *     deletionProtection: true,
 * });
 * const _default = new gcp.cloudrunv2.Job("default", {
 *     name: "cloudrun-job",
 *     location: "us-central1",
 *     deletionProtection: false,
 *     template: {
 *         template: {
 *             volumes: [{
 *                 name: "cloudsql",
 *                 cloudSqlInstance: {
 *                     instances: [instance.connectionName],
 *                 },
 *             }],
 *             containers: [{
 *                 image: "us-docker.pkg.dev/cloudrun/container/job",
 *                 envs: [
 *                     {
 *                         name: "FOO",
 *                         value: "bar",
 *                     },
 *                     {
 *                         name: "latestdclsecret",
 *                         valueSource: {
 *                             secretKeyRef: {
 *                                 secret: secret.secretId,
 *                                 version: "1",
 *                             },
 *                         },
 *                     },
 *                 ],
 *                 volumeMounts: [{
 *                     name: "cloudsql",
 *                     mountPath: "/cloudsql",
 *                 }],
 *             }],
 *         },
 *     },
 * });
 * const project = gcp.organizations.getProject({});
 * const secret_version_data = new gcp.secretmanager.SecretVersion("secret-version-data", {
 *     secret: secret.name,
 *     secretData: "secret-data",
 * });
 * const secret_access = new gcp.secretmanager.SecretIamMember("secret-access", {
 *     secretId: secret.id,
 *     role: "roles/secretmanager.secretAccessor",
 *     member: project.then(project => `serviceAccount:${project.number}-compute@developer.gserviceaccount.com`),
 * }, {
 *     dependsOn: [secret],
 * });
 * ```
 * ### Cloudrunv2 Job Vpcaccess
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const customTestNetwork = new gcp.compute.Network("custom_test", {
 *     name: "run-network",
 *     autoCreateSubnetworks: false,
 * });
 * const customTest = new gcp.compute.Subnetwork("custom_test", {
 *     name: "run-subnetwork",
 *     ipCidrRange: "10.2.0.0/28",
 *     region: "us-central1",
 *     network: customTestNetwork.id,
 * });
 * const connector = new gcp.vpcaccess.Connector("connector", {
 *     name: "run-vpc",
 *     subnet: {
 *         name: customTest.name,
 *     },
 *     machineType: "e2-standard-4",
 *     minInstances: 2,
 *     maxInstances: 3,
 *     region: "us-central1",
 * });
 * const _default = new gcp.cloudrunv2.Job("default", {
 *     name: "cloudrun-job",
 *     location: "us-central1",
 *     deletionProtection: false,
 *     template: {
 *         template: {
 *             containers: [{
 *                 image: "us-docker.pkg.dev/cloudrun/container/job",
 *             }],
 *             vpcAccess: {
 *                 connector: connector.id,
 *                 egress: "ALL_TRAFFIC",
 *             },
 *         },
 *     },
 * });
 * ```
 * ### Cloudrunv2 Job Directvpc
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.cloudrunv2.Job("default", {
 *     name: "cloudrun-job",
 *     location: "us-central1",
 *     deletionProtection: false,
 *     launchStage: "GA",
 *     template: {
 *         template: {
 *             containers: [{
 *                 image: "us-docker.pkg.dev/cloudrun/container/job",
 *             }],
 *             vpcAccess: {
 *                 networkInterfaces: [{
 *                     network: "default",
 *                     subnetwork: "default",
 *                     tags: [
 *                         "tag1",
 *                         "tag2",
 *                         "tag3",
 *                     ],
 *                 }],
 *             },
 *         },
 *     },
 * });
 * ```
 * ### Cloudrunv2 Job Secret
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const secret = new gcp.secretmanager.Secret("secret", {
 *     secretId: "secret",
 *     replication: {
 *         auto: {},
 *     },
 * });
 * const secret_version_data = new gcp.secretmanager.SecretVersion("secret-version-data", {
 *     secret: secret.name,
 *     secretData: "secret-data",
 * });
 * const project = gcp.organizations.getProject({});
 * const secret_access = new gcp.secretmanager.SecretIamMember("secret-access", {
 *     secretId: secret.id,
 *     role: "roles/secretmanager.secretAccessor",
 *     member: project.then(project => `serviceAccount:${project.number}-compute@developer.gserviceaccount.com`),
 * }, {
 *     dependsOn: [secret],
 * });
 * const _default = new gcp.cloudrunv2.Job("default", {
 *     name: "cloudrun-job",
 *     location: "us-central1",
 *     deletionProtection: false,
 *     template: {
 *         template: {
 *             volumes: [{
 *                 name: "a-volume",
 *                 secret: {
 *                     secret: secret.secretId,
 *                     defaultMode: 292,
 *                     items: [{
 *                         version: "1",
 *                         path: "my-secret",
 *                         mode: 256,
 *                     }],
 *                 },
 *             }],
 *             containers: [{
 *                 image: "us-docker.pkg.dev/cloudrun/container/job",
 *                 volumeMounts: [{
 *                     name: "a-volume",
 *                     mountPath: "/secrets",
 *                 }],
 *             }],
 *         },
 *     },
 * }, {
 *     dependsOn: [
 *         secret_version_data,
 *         secret_access,
 *     ],
 * });
 * ```
 * ### Cloudrunv2 Job Emptydir
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.cloudrunv2.Job("default", {
 *     name: "cloudrun-job",
 *     location: "us-central1",
 *     deletionProtection: false,
 *     template: {
 *         template: {
 *             containers: [{
 *                 image: "us-docker.pkg.dev/cloudrun/container/job",
 *                 volumeMounts: [{
 *                     name: "empty-dir-volume",
 *                     mountPath: "/mnt",
 *                 }],
 *             }],
 *             volumes: [{
 *                 name: "empty-dir-volume",
 *                 emptyDir: {
 *                     medium: "MEMORY",
 *                     sizeLimit: "128Mi",
 *                 },
 *             }],
 *         },
 *     },
 * });
 * ```
 * ### Cloudrunv2 Job Run Job
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.cloudrunv2.Job("default", {
 *     name: "cloudrun-job",
 *     location: "us-central1",
 *     deletionProtection: false,
 *     startExecutionToken: "start-once-created",
 *     template: {
 *         template: {
 *             containers: [{
 *                 image: "us-docker.pkg.dev/cloudrun/container/job",
 *             }],
 *         },
 *     },
 * });
 * ```
 * ### Cloudrunv2 Job Multicontainer
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.cloudrunv2.Job("default", {
 *     name: "cloudrun-job",
 *     location: "us-central1",
 *     deletionProtection: false,
 *     template: {
 *         template: {
 *             containers: [
 *                 {
 *                     name: "job-1",
 *                     image: "us-docker.pkg.dev/cloudrun/container/job",
 *                 },
 *                 {
 *                     name: "job-2",
 *                     image: "us-docker.pkg.dev/cloudrun/container/job",
 *                 },
 *             ],
 *         },
 *     },
 * });
 * ```
 * ### Cloudrunv2 Job Gpu
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.cloudrunv2.Job("default", {
 *     name: "cloudrun-job",
 *     location: "us-central1",
 *     deletionProtection: false,
 *     launchStage: "BETA",
 *     template: {
 *         template: {
 *             containers: [{
 *                 image: "us-docker.pkg.dev/cloudrun/container/job",
 *             }],
 *             nodeSelector: {
 *                 accelerator: "nvidia-l4",
 *             },
 *             gpuZonalRedundancyDisabled: true,
 *         },
 *     },
 * });
 * ```
 *
 * ## Import
 *
 * Job can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/locations/{{location}}/jobs/{{name}}`
 *
 * * `{{project}}/{{location}}/{{name}}`
 *
 * * `{{location}}/{{name}}`
 *
 * When using the `pulumi import` command, Job can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:cloudrunv2/job:Job default projects/{{project}}/locations/{{location}}/jobs/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:cloudrunv2/job:Job default {{project}}/{{location}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:cloudrunv2/job:Job default {{location}}/{{name}}
 * ```
 */
class Job extends pulumi.CustomResource {
    /**
     * Get an existing Job resource's state with the given name, ID, and optional extra
     * properties used to qualify the lookup.
     *
     * @param name The _unique_ name of the resulting resource.
     * @param id The _unique_ provider ID of the resource to lookup.
     * @param state Any extra arguments used during the lookup.
     * @param opts Optional settings to control the behavior of the CustomResource.
     */
    static get(name, id, state, opts) {
        return new Job(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of Job.  This is designed to work even
     * when multiple copies of the Pulumi SDK have been loaded into the same process.
     */
    static isInstance(obj) {
        if (obj === undefined || obj === null) {
            return false;
        }
        return obj['__pulumiType'] === Job.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["annotations"] = state?.annotations;
            resourceInputs["binaryAuthorization"] = state?.binaryAuthorization;
            resourceInputs["client"] = state?.client;
            resourceInputs["clientVersion"] = state?.clientVersion;
            resourceInputs["conditions"] = state?.conditions;
            resourceInputs["createTime"] = state?.createTime;
            resourceInputs["creator"] = state?.creator;
            resourceInputs["deleteTime"] = state?.deleteTime;
            resourceInputs["deletionProtection"] = state?.deletionProtection;
            resourceInputs["effectiveAnnotations"] = state?.effectiveAnnotations;
            resourceInputs["effectiveLabels"] = state?.effectiveLabels;
            resourceInputs["etag"] = state?.etag;
            resourceInputs["executionCount"] = state?.executionCount;
            resourceInputs["expireTime"] = state?.expireTime;
            resourceInputs["generation"] = state?.generation;
            resourceInputs["labels"] = state?.labels;
            resourceInputs["lastModifier"] = state?.lastModifier;
            resourceInputs["latestCreatedExecutions"] = state?.latestCreatedExecutions;
            resourceInputs["launchStage"] = state?.launchStage;
            resourceInputs["location"] = state?.location;
            resourceInputs["name"] = state?.name;
            resourceInputs["observedGeneration"] = state?.observedGeneration;
            resourceInputs["project"] = state?.project;
            resourceInputs["pulumiLabels"] = state?.pulumiLabels;
            resourceInputs["reconciling"] = state?.reconciling;
            resourceInputs["runExecutionToken"] = state?.runExecutionToken;
            resourceInputs["startExecutionToken"] = state?.startExecutionToken;
            resourceInputs["template"] = state?.template;
            resourceInputs["terminalConditions"] = state?.terminalConditions;
            resourceInputs["uid"] = state?.uid;
            resourceInputs["updateTime"] = state?.updateTime;
        }
        else {
            const args = argsOrState;
            if (args?.location === undefined && !opts.urn) {
                throw new Error("Missing required property 'location'");
            }
            if (args?.template === undefined && !opts.urn) {
                throw new Error("Missing required property 'template'");
            }
            resourceInputs["annotations"] = args?.annotations;
            resourceInputs["binaryAuthorization"] = args?.binaryAuthorization;
            resourceInputs["client"] = args?.client;
            resourceInputs["clientVersion"] = args?.clientVersion;
            resourceInputs["deletionProtection"] = args?.deletionProtection;
            resourceInputs["labels"] = args?.labels;
            resourceInputs["launchStage"] = args?.launchStage;
            resourceInputs["location"] = args?.location;
            resourceInputs["name"] = args?.name;
            resourceInputs["project"] = args?.project;
            resourceInputs["runExecutionToken"] = args?.runExecutionToken;
            resourceInputs["startExecutionToken"] = args?.startExecutionToken;
            resourceInputs["template"] = args?.template;
            resourceInputs["conditions"] = undefined /*out*/;
            resourceInputs["createTime"] = undefined /*out*/;
            resourceInputs["creator"] = undefined /*out*/;
            resourceInputs["deleteTime"] = undefined /*out*/;
            resourceInputs["effectiveAnnotations"] = undefined /*out*/;
            resourceInputs["effectiveLabels"] = undefined /*out*/;
            resourceInputs["etag"] = undefined /*out*/;
            resourceInputs["executionCount"] = undefined /*out*/;
            resourceInputs["expireTime"] = undefined /*out*/;
            resourceInputs["generation"] = undefined /*out*/;
            resourceInputs["lastModifier"] = undefined /*out*/;
            resourceInputs["latestCreatedExecutions"] = undefined /*out*/;
            resourceInputs["observedGeneration"] = undefined /*out*/;
            resourceInputs["pulumiLabels"] = undefined /*out*/;
            resourceInputs["reconciling"] = undefined /*out*/;
            resourceInputs["terminalConditions"] = undefined /*out*/;
            resourceInputs["uid"] = undefined /*out*/;
            resourceInputs["updateTime"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
        opts = pulumi.mergeOptions(opts, secretOpts);
        super(Job.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Job = Job;
/** @internal */
Job.__pulumiType = 'gcp:cloudrunv2/job:Job';
//# sourceMappingURL=job.js.map