"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.ResourcePolicy = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * A policy that can be attached to a resource to specify or schedule actions on that resource.
 *
 * To get more information about ResourcePolicy, see:
 *
 * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/resourcePolicies)
 *
 * ## Example Usage
 *
 * ### Resource Policy Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const foo = new gcp.compute.ResourcePolicy("foo", {
 *     name: "gce-policy",
 *     region: "us-central1",
 *     snapshotSchedulePolicy: {
 *         schedule: {
 *             dailySchedule: {
 *                 daysInCycle: 1,
 *                 startTime: "04:00",
 *             },
 *         },
 *     },
 * });
 * ```
 * ### Resource Policy Full
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const bar = new gcp.compute.ResourcePolicy("bar", {
 *     name: "gce-policy",
 *     region: "us-central1",
 *     snapshotSchedulePolicy: {
 *         schedule: {
 *             hourlySchedule: {
 *                 hoursInCycle: 20,
 *                 startTime: "23:00",
 *             },
 *         },
 *         retentionPolicy: {
 *             maxRetentionDays: 10,
 *             onSourceDiskDelete: "KEEP_AUTO_SNAPSHOTS",
 *         },
 *         snapshotProperties: {
 *             labels: {
 *                 my_label: "value",
 *             },
 *             storageLocations: "us",
 *             guestFlush: true,
 *         },
 *     },
 * });
 * ```
 * ### Resource Policy Placement Policy
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const baz = new gcp.compute.ResourcePolicy("baz", {
 *     name: "gce-policy",
 *     region: "us-central1",
 *     groupPlacementPolicy: {
 *         vmCount: 2,
 *         collocation: "COLLOCATED",
 *     },
 * });
 * ```
 * ### Resource Policy Placement Policy Max Distance
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const baz = new gcp.compute.ResourcePolicy("baz", {
 *     name: "gce-policy",
 *     region: "us-central1",
 *     groupPlacementPolicy: {
 *         vmCount: 2,
 *         collocation: "COLLOCATED",
 *         maxDistance: 2,
 *     },
 * });
 * ```
 * ### Resource Policy Instance Schedule Policy
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const hourly = new gcp.compute.ResourcePolicy("hourly", {
 *     name: "gce-policy",
 *     region: "us-central1",
 *     description: "Start and stop instances",
 *     instanceSchedulePolicy: {
 *         vmStartSchedule: {
 *             schedule: "0 * * * *",
 *         },
 *         vmStopSchedule: {
 *             schedule: "15 * * * *",
 *         },
 *         timeZone: "US/Central",
 *     },
 * });
 * ```
 * ### Resource Policy Snapshot Schedule Chain Name
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const hourly = new gcp.compute.ResourcePolicy("hourly", {
 *     name: "gce-policy",
 *     region: "us-central1",
 *     description: "chain name snapshot",
 *     snapshotSchedulePolicy: {
 *         schedule: {
 *             hourlySchedule: {
 *                 hoursInCycle: 20,
 *                 startTime: "23:00",
 *             },
 *         },
 *         retentionPolicy: {
 *             maxRetentionDays: 14,
 *             onSourceDiskDelete: "KEEP_AUTO_SNAPSHOTS",
 *         },
 *         snapshotProperties: {
 *             labels: {
 *                 my_label: "value",
 *             },
 *             storageLocations: "us",
 *             guestFlush: true,
 *             chainName: "test-schedule-chain-name",
 *         },
 *     },
 * });
 * ```
 * ### Resource Policy Consistency Group
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const cgroup = new gcp.compute.ResourcePolicy("cgroup", {
 *     name: "gce-policy",
 *     region: "europe-west1",
 *     diskConsistencyGroupPolicy: {
 *         enabled: true,
 *     },
 * });
 * ```
 * ### Resource Policy Workload Policy
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const bar = new gcp.compute.ResourcePolicy("bar", {
 *     name: "gce-policy",
 *     region: "europe-west1",
 *     workloadPolicy: {
 *         type: "HIGH_AVAILABILITY",
 *     },
 * });
 * ```
 * ### Resource Policy Workload Policy Accelerator Topology
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const bar = new gcp.compute.ResourcePolicy("bar", {
 *     name: "gce-policy",
 *     region: "europe-west1",
 *     workloadPolicy: {
 *         type: "HIGH_THROUGHPUT",
 *         acceleratorTopology: "SOME NEW TOPOLOGY",
 *     },
 * });
 * ```
 * ### Resource Policy Workload Policy Max Topology Distance
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const bar = new gcp.compute.ResourcePolicy("bar", {
 *     name: "gce-policy",
 *     region: "europe-west1",
 *     workloadPolicy: {
 *         type: "HIGH_THROUGHPUT",
 *         maxTopologyDistance: "BLOCK",
 *     },
 * });
 * ```
 * ### Resource Policy Placement Policy Gpu Topology
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const baz = new gcp.compute.ResourcePolicy("baz", {
 *     name: "gce-policy",
 *     region: "europe-west9",
 *     groupPlacementPolicy: {
 *         collocation: "COLLOCATED",
 *         gpuTopology: "1x72",
 *     },
 * });
 * ```
 * ### Resource Policy Placement Policy Tpu Topology
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const baz = new gcp.compute.ResourcePolicy("baz", {
 *     name: "gce-policy",
 *     region: "us-central1",
 *     groupPlacementPolicy: {
 *         vmCount: 2,
 *         collocation: "COLLOCATED",
 *         tpuTopology: "4x4",
 *     },
 * });
 * ```
 *
 * ## Import
 *
 * ResourcePolicy can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/regions/{{region}}/resourcePolicies/{{name}}`
 *
 * * `{{project}}/{{region}}/{{name}}`
 *
 * * `{{region}}/{{name}}`
 *
 * * `{{name}}`
 *
 * When using the `pulumi import` command, ResourcePolicy can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:compute/resourcePolicy:ResourcePolicy default projects/{{project}}/regions/{{region}}/resourcePolicies/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/resourcePolicy:ResourcePolicy default {{project}}/{{region}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/resourcePolicy:ResourcePolicy default {{region}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/resourcePolicy:ResourcePolicy default {{name}}
 * ```
 */
class ResourcePolicy extends pulumi.CustomResource {
    /**
     * Get an existing ResourcePolicy 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 ResourcePolicy(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of ResourcePolicy.  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'] === ResourcePolicy.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["description"] = state?.description;
            resourceInputs["diskConsistencyGroupPolicy"] = state?.diskConsistencyGroupPolicy;
            resourceInputs["groupPlacementPolicy"] = state?.groupPlacementPolicy;
            resourceInputs["instanceSchedulePolicy"] = state?.instanceSchedulePolicy;
            resourceInputs["name"] = state?.name;
            resourceInputs["project"] = state?.project;
            resourceInputs["region"] = state?.region;
            resourceInputs["selfLink"] = state?.selfLink;
            resourceInputs["snapshotSchedulePolicy"] = state?.snapshotSchedulePolicy;
            resourceInputs["workloadPolicy"] = state?.workloadPolicy;
        }
        else {
            const args = argsOrState;
            resourceInputs["description"] = args?.description;
            resourceInputs["diskConsistencyGroupPolicy"] = args?.diskConsistencyGroupPolicy;
            resourceInputs["groupPlacementPolicy"] = args?.groupPlacementPolicy;
            resourceInputs["instanceSchedulePolicy"] = args?.instanceSchedulePolicy;
            resourceInputs["name"] = args?.name;
            resourceInputs["project"] = args?.project;
            resourceInputs["region"] = args?.region;
            resourceInputs["snapshotSchedulePolicy"] = args?.snapshotSchedulePolicy;
            resourceInputs["workloadPolicy"] = args?.workloadPolicy;
            resourceInputs["selfLink"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(ResourcePolicy.__pulumiType, name, resourceInputs, opts);
    }
}
exports.ResourcePolicy = ResourcePolicy;
/** @internal */
ResourcePolicy.__pulumiType = 'gcp:compute/resourcePolicy:ResourcePolicy';
//# sourceMappingURL=resourcePolicy.js.map