"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.OsPolicyAssignment = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * OS policy assignment is an API resource that is used to apply a set of OS
 * policies to a dynamically targeted group of Compute Engine VM instances. An OS
 * policy is used to define the desired state configuration for a Compute Engine VM
 * instance through a set of configuration resources that provide capabilities such
 * as installing or removing software packages, or executing a script. For more
 * information about the OS policy resource definitions and examples, see
 * [OS policy and OS policy assignment](https://cloud.google.com/compute/docs/os-configuration-management/working-with-os-policies).
 *
 * To get more information about OSPolicyAssignment, see:
 *
 * *   [API documentation](https://cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments)
 * *   How-to Guides
 *     *   [Official Documentation](https://cloud.google.com/compute/docs/os-configuration-management/create-os-policy-assignment)
 *
 * ## Example Usage
 *
 * ### Os Config Os Policy Assignment Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const primary = new gcp.osconfig.OsPolicyAssignment("primary", {
 *     instanceFilter: {
 *         all: false,
 *         exclusionLabels: [{
 *             labels: {
 *                 "label-two": "value-two",
 *             },
 *         }],
 *         inclusionLabels: [{
 *             labels: {
 *                 "label-one": "value-one",
 *             },
 *         }],
 *         inventories: [{
 *             osShortName: "centos",
 *             osVersion: "8.*",
 *         }],
 *     },
 *     location: "us-central1-a",
 *     name: "policy-assignment",
 *     osPolicies: [{
 *         id: "policy",
 *         mode: "VALIDATION",
 *         resourceGroups: [{
 *             resources: [
 *                 {
 *                     id: "apt-to-yum",
 *                     repository: {
 *                         apt: {
 *                             archiveType: "DEB",
 *                             components: ["doc"],
 *                             distribution: "debian",
 *                             uri: "https://atl.mirrors.clouvider.net/debian",
 *                             gpgKey: ".gnupg/pubring.kbx",
 *                         },
 *                     },
 *                 },
 *                 {
 *                     id: "exec1",
 *                     exec: {
 *                         validate: {
 *                             interpreter: "SHELL",
 *                             args: ["arg1"],
 *                             file: {
 *                                 localPath: "$HOME/script.sh",
 *                             },
 *                             outputFilePath: "$HOME/out",
 *                         },
 *                         enforce: {
 *                             interpreter: "SHELL",
 *                             args: ["arg1"],
 *                             file: {
 *                                 allowInsecure: true,
 *                                 remote: {
 *                                     uri: "https://www.example.com/script.sh",
 *                                     sha256Checksum: "c7938fed83afdccbb0e86a2a2e4cad7d5035012ca3214b4a61268393635c3063",
 *                                 },
 *                             },
 *                             outputFilePath: "$HOME/out",
 *                         },
 *                     },
 *                 },
 *             ],
 *             inventoryFilters: [{
 *                 osShortName: "centos",
 *                 osVersion: "8.*",
 *             }],
 *         }],
 *         allowNoResourceGroupMatch: false,
 *         description: "A test os policy",
 *     }],
 *     rollout: {
 *         disruptionBudget: {
 *             percent: 100,
 *         },
 *         minWaitDuration: "3s",
 *     },
 *     description: "A test os policy assignment",
 * });
 * ```
 *
 * ## Import
 *
 * OSPolicyAssignment can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/locations/{{location}}/osPolicyAssignments/{{name}}`
 *
 * * `{{project}}/{{location}}/{{name}}`
 *
 * * `{{location}}/{{name}}`
 *
 * When using the `pulumi import` command, OSPolicyAssignment can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:osconfig/osPolicyAssignment:OsPolicyAssignment default projects/{{project}}/locations/{{location}}/osPolicyAssignments/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:osconfig/osPolicyAssignment:OsPolicyAssignment default {{project}}/{{location}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:osconfig/osPolicyAssignment:OsPolicyAssignment default {{location}}/{{name}}
 * ```
 */
class OsPolicyAssignment extends pulumi.CustomResource {
    /**
     * Get an existing OsPolicyAssignment 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 OsPolicyAssignment(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of OsPolicyAssignment.  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'] === OsPolicyAssignment.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["baseline"] = state?.baseline;
            resourceInputs["deleted"] = state?.deleted;
            resourceInputs["description"] = state?.description;
            resourceInputs["etag"] = state?.etag;
            resourceInputs["instanceFilter"] = state?.instanceFilter;
            resourceInputs["location"] = state?.location;
            resourceInputs["name"] = state?.name;
            resourceInputs["osPolicies"] = state?.osPolicies;
            resourceInputs["project"] = state?.project;
            resourceInputs["reconciling"] = state?.reconciling;
            resourceInputs["revisionCreateTime"] = state?.revisionCreateTime;
            resourceInputs["revisionId"] = state?.revisionId;
            resourceInputs["rollout"] = state?.rollout;
            resourceInputs["rolloutState"] = state?.rolloutState;
            resourceInputs["skipAwaitRollout"] = state?.skipAwaitRollout;
            resourceInputs["uid"] = state?.uid;
        }
        else {
            const args = argsOrState;
            if (args?.instanceFilter === undefined && !opts.urn) {
                throw new Error("Missing required property 'instanceFilter'");
            }
            if (args?.location === undefined && !opts.urn) {
                throw new Error("Missing required property 'location'");
            }
            if (args?.osPolicies === undefined && !opts.urn) {
                throw new Error("Missing required property 'osPolicies'");
            }
            if (args?.rollout === undefined && !opts.urn) {
                throw new Error("Missing required property 'rollout'");
            }
            resourceInputs["description"] = args?.description;
            resourceInputs["instanceFilter"] = args?.instanceFilter;
            resourceInputs["location"] = args?.location;
            resourceInputs["name"] = args?.name;
            resourceInputs["osPolicies"] = args?.osPolicies;
            resourceInputs["project"] = args?.project;
            resourceInputs["rollout"] = args?.rollout;
            resourceInputs["skipAwaitRollout"] = args?.skipAwaitRollout;
            resourceInputs["baseline"] = undefined /*out*/;
            resourceInputs["deleted"] = undefined /*out*/;
            resourceInputs["etag"] = undefined /*out*/;
            resourceInputs["reconciling"] = undefined /*out*/;
            resourceInputs["revisionCreateTime"] = undefined /*out*/;
            resourceInputs["revisionId"] = undefined /*out*/;
            resourceInputs["rolloutState"] = undefined /*out*/;
            resourceInputs["uid"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(OsPolicyAssignment.__pulumiType, name, resourceInputs, opts);
    }
}
exports.OsPolicyAssignment = OsPolicyAssignment;
/** @internal */
OsPolicyAssignment.__pulumiType = 'gcp:osconfig/osPolicyAssignment:OsPolicyAssignment';
//# sourceMappingURL=osPolicyAssignment.js.map