"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.PatchDeployment = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * Patch deployments are configurations that individual patch jobs use to complete a patch.
 * These configurations include instance filter, package repository settings, and a schedule.
 *
 * To get more information about PatchDeployment, see:
 *
 * * [API documentation](https://cloud.google.com/compute/docs/osconfig/rest)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/compute/docs/os-patch-management)
 *
 * ## Example Usage
 *
 * ### Os Config Patch Deployment Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const patch = new gcp.osconfig.PatchDeployment("patch", {
 *     patchDeploymentId: "patch-deploy",
 *     instanceFilter: {
 *         all: true,
 *     },
 *     oneTimeSchedule: {
 *         executeTime: "2999-10-10T10:10:10.045123456Z",
 *     },
 * });
 * ```
 * ### Os Config Patch Deployment Daily
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const patch = new gcp.osconfig.PatchDeployment("patch", {
 *     patchDeploymentId: "patch-deploy",
 *     instanceFilter: {
 *         all: true,
 *     },
 *     recurringSchedule: {
 *         timeZone: {
 *             id: "America/New_York",
 *         },
 *         timeOfDay: {
 *             hours: 0,
 *             minutes: 30,
 *             seconds: 30,
 *             nanos: 20,
 *         },
 *     },
 * });
 * ```
 * ### Os Config Patch Deployment Daily Midnight
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const patch = new gcp.osconfig.PatchDeployment("patch", {
 *     patchDeploymentId: "patch-deploy",
 *     instanceFilter: {
 *         all: true,
 *     },
 *     recurringSchedule: {
 *         timeZone: {
 *             id: "America/New_York",
 *         },
 *         timeOfDay: {
 *             hours: 0,
 *             minutes: 0,
 *             seconds: 0,
 *             nanos: 0,
 *         },
 *     },
 * });
 * ```
 * ### Os Config Patch Deployment Instance
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const myImage = gcp.compute.getImage({
 *     family: "debian-11",
 *     project: "debian-cloud",
 * });
 * const foobar = new gcp.compute.Instance("foobar", {
 *     name: "patch-deploy-inst",
 *     machineType: "e2-medium",
 *     zone: "us-central1-a",
 *     canIpForward: false,
 *     tags: [
 *         "foo",
 *         "bar",
 *     ],
 *     bootDisk: {
 *         initializeParams: {
 *             image: myImage.then(myImage => myImage.selfLink),
 *         },
 *     },
 *     networkInterfaces: [{
 *         network: "default",
 *     }],
 *     metadata: {
 *         foo: "bar",
 *     },
 * });
 * const patch = new gcp.osconfig.PatchDeployment("patch", {
 *     patchDeploymentId: "patch-deploy",
 *     instanceFilter: {
 *         instances: [foobar.id],
 *     },
 *     patchConfig: {
 *         yum: {
 *             security: true,
 *             minimal: true,
 *             excludes: ["bash"],
 *         },
 *     },
 *     recurringSchedule: {
 *         timeZone: {
 *             id: "America/New_York",
 *         },
 *         timeOfDay: {
 *             hours: 0,
 *             minutes: 30,
 *             seconds: 30,
 *             nanos: 20,
 *         },
 *         monthly: {
 *             monthDay: 1,
 *         },
 *     },
 * });
 * ```
 * ### Os Config Patch Deployment Full
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const patch = new gcp.osconfig.PatchDeployment("patch", {
 *     patchDeploymentId: "patch-deploy",
 *     instanceFilter: {
 *         groupLabels: [{
 *             labels: {
 *                 env: "dev",
 *                 app: "web",
 *             },
 *         }],
 *         instanceNamePrefixes: ["test-"],
 *         zones: [
 *             "us-central1-a",
 *             "us-central-1c",
 *         ],
 *     },
 *     patchConfig: {
 *         migInstancesAllowed: true,
 *         rebootConfig: "ALWAYS",
 *         apt: {
 *             type: "DIST",
 *             excludes: ["python"],
 *         },
 *         yum: {
 *             security: true,
 *             minimal: true,
 *             excludes: ["bash"],
 *         },
 *         goo: {
 *             enabled: true,
 *         },
 *         zypper: {
 *             categories: ["security"],
 *         },
 *         windowsUpdate: {
 *             classifications: [
 *                 "CRITICAL",
 *                 "SECURITY",
 *                 "UPDATE",
 *             ],
 *             excludes: ["5012170"],
 *         },
 *         preStep: {
 *             linuxExecStepConfig: {
 *                 allowedSuccessCodes: [
 *                     0,
 *                     3,
 *                 ],
 *                 localPath: "/tmp/pre_patch_script.sh",
 *             },
 *             windowsExecStepConfig: {
 *                 interpreter: "SHELL",
 *                 allowedSuccessCodes: [
 *                     0,
 *                     2,
 *                 ],
 *                 localPath: "C:\\Users\\user\\pre-patch-script.cmd",
 *             },
 *         },
 *         postStep: {
 *             linuxExecStepConfig: {
 *                 gcsObject: {
 *                     bucket: "my-patch-scripts",
 *                     generationNumber: "1523477886880",
 *                     object: "linux/post_patch_script",
 *                 },
 *             },
 *             windowsExecStepConfig: {
 *                 interpreter: "POWERSHELL",
 *                 gcsObject: {
 *                     bucket: "my-patch-scripts",
 *                     generationNumber: "135920493447",
 *                     object: "windows/post_patch_script.ps1",
 *                 },
 *             },
 *         },
 *     },
 *     duration: "10s",
 *     recurringSchedule: {
 *         timeZone: {
 *             id: "America/New_York",
 *         },
 *         timeOfDay: {
 *             hours: 0,
 *             minutes: 30,
 *             seconds: 30,
 *             nanos: 20,
 *         },
 *         monthly: {
 *             weekDayOfMonth: {
 *                 weekOrdinal: -1,
 *                 dayOfWeek: "TUESDAY",
 *                 dayOffset: 3,
 *             },
 *         },
 *     },
 *     rollout: {
 *         mode: "ZONE_BY_ZONE",
 *         disruptionBudget: {
 *             fixed: 1,
 *         },
 *     },
 * });
 * ```
 *
 * ## Import
 *
 * PatchDeployment can be imported using any of these accepted formats:
 *
 * * `{{project}}/{{name}}`
 *
 * * `{{project}} {{name}}`
 *
 * * `{{name}}`
 *
 * When using the `pulumi import` command, PatchDeployment can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:osconfig/patchDeployment:PatchDeployment default {{project}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:osconfig/patchDeployment:PatchDeployment default "{{project}} {{name}}"
 * ```
 *
 * ```sh
 * $ pulumi import gcp:osconfig/patchDeployment:PatchDeployment default {{name}}
 * ```
 */
class PatchDeployment extends pulumi.CustomResource {
    /**
     * Get an existing PatchDeployment 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 PatchDeployment(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of PatchDeployment.  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'] === PatchDeployment.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["createTime"] = state?.createTime;
            resourceInputs["description"] = state?.description;
            resourceInputs["duration"] = state?.duration;
            resourceInputs["instanceFilter"] = state?.instanceFilter;
            resourceInputs["lastExecuteTime"] = state?.lastExecuteTime;
            resourceInputs["name"] = state?.name;
            resourceInputs["oneTimeSchedule"] = state?.oneTimeSchedule;
            resourceInputs["patchConfig"] = state?.patchConfig;
            resourceInputs["patchDeploymentId"] = state?.patchDeploymentId;
            resourceInputs["project"] = state?.project;
            resourceInputs["recurringSchedule"] = state?.recurringSchedule;
            resourceInputs["rollout"] = state?.rollout;
            resourceInputs["updateTime"] = state?.updateTime;
        }
        else {
            const args = argsOrState;
            if (args?.instanceFilter === undefined && !opts.urn) {
                throw new Error("Missing required property 'instanceFilter'");
            }
            if (args?.patchDeploymentId === undefined && !opts.urn) {
                throw new Error("Missing required property 'patchDeploymentId'");
            }
            resourceInputs["description"] = args?.description;
            resourceInputs["duration"] = args?.duration;
            resourceInputs["instanceFilter"] = args?.instanceFilter;
            resourceInputs["oneTimeSchedule"] = args?.oneTimeSchedule;
            resourceInputs["patchConfig"] = args?.patchConfig;
            resourceInputs["patchDeploymentId"] = args?.patchDeploymentId;
            resourceInputs["project"] = args?.project;
            resourceInputs["recurringSchedule"] = args?.recurringSchedule;
            resourceInputs["rollout"] = args?.rollout;
            resourceInputs["createTime"] = undefined /*out*/;
            resourceInputs["lastExecuteTime"] = undefined /*out*/;
            resourceInputs["name"] = undefined /*out*/;
            resourceInputs["updateTime"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(PatchDeployment.__pulumiType, name, resourceInputs, opts);
    }
}
exports.PatchDeployment = PatchDeployment;
/** @internal */
PatchDeployment.__pulumiType = 'gcp:osconfig/patchDeployment:PatchDeployment';
//# sourceMappingURL=patchDeployment.js.map