"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.GuestPolicies = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * An OS Config resource representing a guest configuration policy. These policies represent
 * the desired state for VM instance guest environments including packages to install or remove,
 * package repository configurations, and software to install.
 *
 * To get more information about GuestPolicies, see:
 *
 * * [API documentation](https://cloud.google.com/compute/docs/osconfig/rest)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/compute/docs/os-config-management)
 *
 * ## Example Usage
 *
 * ### Os Config Guest Policies Basic
 *
 * ```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: "guest-policy-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 guestPolicies = new gcp.osconfig.GuestPolicies("guest_policies", {
 *     guestPolicyId: "guest-policy",
 *     assignment: {
 *         instances: [foobar.id],
 *     },
 *     packages: [{
 *         name: "my-package",
 *         desiredState: "UPDATED",
 *     }],
 * });
 * ```
 * ### Os Config Guest Policies Packages
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const guestPolicies = new gcp.osconfig.GuestPolicies("guest_policies", {
 *     guestPolicyId: "guest-policy",
 *     assignment: {
 *         groupLabels: [
 *             {
 *                 labels: {
 *                     color: "red",
 *                     env: "test",
 *                 },
 *             },
 *             {
 *                 labels: {
 *                     color: "blue",
 *                     env: "test",
 *                 },
 *             },
 *         ],
 *     },
 *     packages: [
 *         {
 *             name: "my-package",
 *             desiredState: "INSTALLED",
 *         },
 *         {
 *             name: "bad-package-1",
 *             desiredState: "REMOVED",
 *         },
 *         {
 *             name: "bad-package-2",
 *             desiredState: "REMOVED",
 *             manager: "APT",
 *         },
 *     ],
 *     packageRepositories: [
 *         {
 *             apt: {
 *                 uri: "https://packages.cloud.google.com/apt",
 *                 archiveType: "DEB",
 *                 distribution: "cloud-sdk-stretch",
 *                 components: ["main"],
 *             },
 *         },
 *         {
 *             yum: {
 *                 id: "google-cloud-sdk",
 *                 displayName: "Google Cloud SDK",
 *                 baseUrl: "https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64",
 *                 gpgKeys: [
 *                     "https://packages.cloud.google.com/yum/doc/yum-key.gpg",
 *                     "https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg",
 *                 ],
 *             },
 *         },
 *     ],
 * });
 * ```
 * ### Os Config Guest Policies Recipes
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const guestPolicies = new gcp.osconfig.GuestPolicies("guest_policies", {
 *     guestPolicyId: "guest-policy",
 *     assignment: {
 *         zones: [
 *             "us-east1-b",
 *             "us-east1-d",
 *         ],
 *     },
 *     recipes: [{
 *         name: "guest-policy-recipe",
 *         desiredState: "INSTALLED",
 *         artifacts: [{
 *             id: "guest-policy-artifact-id",
 *             gcs: {
 *                 bucket: "my-bucket",
 *                 object: "executable.msi",
 *                 generation: 1546030865175603,
 *             },
 *         }],
 *         installSteps: [{
 *             msiInstallation: {
 *                 artifactId: "guest-policy-artifact-id",
 *             },
 *         }],
 *     }],
 * });
 * ```
 *
 * ## Import
 *
 * GuestPolicies can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/guestPolicies/{{guest_policy_id}}`
 *
 * * `{{project}}/{{guest_policy_id}}`
 *
 * * `{{guest_policy_id}}`
 *
 * When using the `pulumi import` command, GuestPolicies can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:osconfig/guestPolicies:GuestPolicies default projects/{{project}}/guestPolicies/{{guest_policy_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:osconfig/guestPolicies:GuestPolicies default {{project}}/{{guest_policy_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:osconfig/guestPolicies:GuestPolicies default {{guest_policy_id}}
 * ```
 */
class GuestPolicies extends pulumi.CustomResource {
    /**
     * Get an existing GuestPolicies 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 GuestPolicies(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of GuestPolicies.  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'] === GuestPolicies.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["assignment"] = state?.assignment;
            resourceInputs["createTime"] = state?.createTime;
            resourceInputs["description"] = state?.description;
            resourceInputs["etag"] = state?.etag;
            resourceInputs["guestPolicyId"] = state?.guestPolicyId;
            resourceInputs["name"] = state?.name;
            resourceInputs["packageRepositories"] = state?.packageRepositories;
            resourceInputs["packages"] = state?.packages;
            resourceInputs["project"] = state?.project;
            resourceInputs["recipes"] = state?.recipes;
            resourceInputs["updateTime"] = state?.updateTime;
        }
        else {
            const args = argsOrState;
            if (args?.assignment === undefined && !opts.urn) {
                throw new Error("Missing required property 'assignment'");
            }
            if (args?.guestPolicyId === undefined && !opts.urn) {
                throw new Error("Missing required property 'guestPolicyId'");
            }
            resourceInputs["assignment"] = args?.assignment;
            resourceInputs["description"] = args?.description;
            resourceInputs["etag"] = args?.etag;
            resourceInputs["guestPolicyId"] = args?.guestPolicyId;
            resourceInputs["packageRepositories"] = args?.packageRepositories;
            resourceInputs["packages"] = args?.packages;
            resourceInputs["project"] = args?.project;
            resourceInputs["recipes"] = args?.recipes;
            resourceInputs["createTime"] = undefined /*out*/;
            resourceInputs["name"] = undefined /*out*/;
            resourceInputs["updateTime"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(GuestPolicies.__pulumiType, name, resourceInputs, opts);
    }
}
exports.GuestPolicies = GuestPolicies;
/** @internal */
GuestPolicies.__pulumiType = 'gcp:osconfig/guestPolicies:GuestPolicies';
//# sourceMappingURL=guestPolicies.js.map