@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
143 lines • 6.29 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.InstantSnapshot = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Represents an instant snapshot resource.
*
* An instant snapshot is an in-place backup of a disk that can be used to rapidly create a new disk in minutes.
*
* Instant snapshots capture data at a specific point in time. They are optimized for rapidly restoring captured
* data to a new disk. Use instant snapshots to quickly recover data in cases where the zone and disk are still intact
* but the data on the disk has been lost or corrupted
*
* To get more information about InstantSnapshot, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/instantSnapshots)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/compute/docs/disks/instant-snapshots)
*
* ## Example Usage
*
* ### Instant Snapshot Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const foo = new gcp.compute.Disk("foo", {
* name: "example-disk",
* type: "pd-ssd",
* size: 10,
* });
* const _default = new gcp.compute.InstantSnapshot("default", {
* name: "instant-snapshot",
* zone: "us-central1-a",
* sourceDisk: foo.selfLink,
* });
* ```
*
* ## Import
*
* InstantSnapshot can be imported using any of these accepted formats:
*
* * `projects/{{project}}/zones/{{zone}}/instantSnapshots/{{name}}`
*
* * `{{project}}/{{zone}}/{{name}}`
*
* * `{{zone}}/{{name}}`
*
* * `{{name}}`
*
* When using the `pulumi import` command, InstantSnapshot can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:compute/instantSnapshot:InstantSnapshot default projects/{{project}}/zones/{{zone}}/instantSnapshots/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/instantSnapshot:InstantSnapshot default {{project}}/{{zone}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/instantSnapshot:InstantSnapshot default {{zone}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/instantSnapshot:InstantSnapshot default {{name}}
* ```
*/
class InstantSnapshot extends pulumi.CustomResource {
/**
* Get an existing InstantSnapshot 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 InstantSnapshot(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of InstantSnapshot. 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'] === InstantSnapshot.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["creationTimestamp"] = state ? state.creationTimestamp : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["diskSizeGb"] = state ? state.diskSizeGb : undefined;
resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined;
resourceInputs["labelFingerprint"] = state ? state.labelFingerprint : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined;
resourceInputs["selfLink"] = state ? state.selfLink : undefined;
resourceInputs["sourceDisk"] = state ? state.sourceDisk : undefined;
resourceInputs["sourceDiskId"] = state ? state.sourceDiskId : undefined;
resourceInputs["zone"] = state ? state.zone : undefined;
}
else {
const args = argsOrState;
if ((!args || args.sourceDisk === undefined) && !opts.urn) {
throw new Error("Missing required property 'sourceDisk'");
}
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["sourceDisk"] = args ? args.sourceDisk : undefined;
resourceInputs["zone"] = args ? args.zone : undefined;
resourceInputs["creationTimestamp"] = undefined /*out*/;
resourceInputs["diskSizeGb"] = undefined /*out*/;
resourceInputs["effectiveLabels"] = undefined /*out*/;
resourceInputs["labelFingerprint"] = undefined /*out*/;
resourceInputs["pulumiLabels"] = undefined /*out*/;
resourceInputs["selfLink"] = undefined /*out*/;
resourceInputs["sourceDiskId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(InstantSnapshot.__pulumiType, name, resourceInputs, opts);
}
}
exports.InstantSnapshot = InstantSnapshot;
/** @internal */
InstantSnapshot.__pulumiType = 'gcp:compute/instantSnapshot:InstantSnapshot';
//# sourceMappingURL=instantSnapshot.js.map